opengl-es-2.0

OpenGL ES 2.0 an Android: What dimensions should the normalMatrix have?

女生的网名这么多〃 提交于 2019-12-25 02:57:11
问题 I am learning OpenGL ES 2.0, without ever having learned OpenGL or OpenGL ES 1.x. I'm applying non-uniform scaling to my modelViewMatrix, so the tutorials tell me that I need to take special steps to compute a normalMatrix. In my application the modelViewMatrix has dimension 4x4. Some tutorials say that for the normalMatrix I need to simply calculate transpose(inverse(modelViewMatrix)). Other instructions say that I need to first take the upper left 3x3 sub-matrix of my modelViewMatrix and

OpenGL ES 2.0 displaying objects in opposite depth order using LibGDX

夙愿已清 提交于 2019-12-25 02:27:05
问题 I am using LibGDX and rendering a few models. This works as expected, except objects that are "further away" are displayed "in front" of "closer" objects. In other words the depth order seems to be the opposite of what I intended for it to be. Strangely, the models are clipped in the correct order by the far clipping-plane. (Most distance objects disappear first) I have tried enabling GL_DEPTH_TEST , and I am clearing GL_DEPTH_BUFFER_BIT . Does anyone know what could be causing this? 回答1: If

iOS: Creating an overlay on top of an EAGLView / GLKView

ⅰ亾dé卋堺 提交于 2019-12-24 23:20:12
问题 I'm trying to create an overlay on top of a GLKView (effectively an EAGLView ). I'm aware of the performance impact, but in my situation that's not a problem, since the scene is paused in the background, it merely needs to remain visible. I've created a custom UIView called ReaderView whose only custom code is the following: -(CALayer*)layer { CATextLayer *textLayer = [[CATextLayer alloc] init]; // Layer settings. [textLayer setCornerRadius:5.0f]; // Text settings. [textLayer setFont

Box2D debug draw in a specific layer

不想你离开。 提交于 2019-12-24 12:43:11
问题 This article tell how to wrap Box2D debug draw in a layer. But I do not understand why it is being drawn in the specific layer. As far as I don't know OpenGL, I don't understand where it is being drawn at all. But my problem is that I want to draw in a specific layer, so that I could put that layer on top of all layers and make Box2D shapes always visible. Today I have found the solution how to do debug draw Box2D shapes in C++ but I cannot draw in a specific layer. Could you help me

OpenGL ES 2 : use an additional texture unit to blend this image with the current one

て烟熏妆下的殇ゞ 提交于 2019-12-24 11:53:46
问题 I am trying to figure out a tutorial on OpenGL ES 2.0 Now the book requires as an exercise to "Try loading in a different image, and use an additional texture unit to blend this image with the current one. You can try adding or multiplying the values together when you assign them to gl_FragColor in your fragment shader." But I am lost... This is the code: @Override public void onDrawFrame(GL10 gl) { // Clear the rendering surface. glClear(GL_COLOR_BUFFER_BIT); // Draw the table.

Explain how premultiplied alpha works

笑着哭i 提交于 2019-12-24 11:34:35
问题 Can somebody please explain why rendering with premultiplied alpha (and corrected blending function) looks differently than "normal" alpha when, mathematically speaking, those are the same? I've looked into this post for understanding of premultiplied alpha: http://blogs.msdn.com/b/shawnhar/archive/2009/11/06/premultiplied-alpha.aspx The author also said that the end computation is the same: "Look at the blend equations for conventional vs. premultiplied alpha. If you substitute this color

Android. Couldn't load gpuimage-library

ぐ巨炮叔叔 提交于 2019-12-24 10:48:49
问题 I just downloaded GPUImageLibrary 1.2.3 snapshot and import the library and the sample project. In the sample app, when i pick image from gallery, everything works fine. But everytime i try to pick image from camera, the app crashes. package jp.co.cyberagent.android.gpuimage; public class GPUImageNativeLibrary { static { //there is the crash happened System.loadLibrary("gpuimage-library"); } public static native void YUVtoRBGA(byte[] yuv, int width, int height, int[] out); public static

“stack corruption detected” when using glGetProgramiv

狂风中的少年 提交于 2019-12-24 06:43:04
问题 I am writing native Android OpenGLES 2 code. When loading shaders (shader loading code is very similar to the NDK sample "hello-gl2"), my program does not link (shaders themselves compile without errors). This code: GLint linkStatus = GL_FALSE; GLCALL(glGetProgramiv(programId, GL_LINK_STATUS, &linkStatus)); if (linkStatus != GL_TRUE) { Returns false, so I proceed to calling LOGE("Could not link program, gathering log..."); GLint bufLength = 0; GLCALL(glGetProgramiv(programId, GL_INFO_LOG

GLSL texture2D() always returns (0, 0, 0, 1)

别等时光非礼了梦想. 提交于 2019-12-24 06:29:27
问题 I'm super-baffled by this. I'm trying to render to an off-screen texture so I can perform some post-processing, but can't even get that texture to draw to the screen unmodified. I'm currently targeting OpenGL ES 2.0 on the iPhone simulator. I've narrowed down the problem to GLSL's texture2D() function returning vec4(0, 0, 0, 1) since, if I replace that call with any a constant color, the screen fills with the specified color. The texture is created, bound to texture unit 0, its storage is

GLSL texture2D() always returns (0, 0, 0, 1)

时光怂恿深爱的人放手 提交于 2019-12-24 06:29:14
问题 I'm super-baffled by this. I'm trying to render to an off-screen texture so I can perform some post-processing, but can't even get that texture to draw to the screen unmodified. I'm currently targeting OpenGL ES 2.0 on the iPhone simulator. I've narrowed down the problem to GLSL's texture2D() function returning vec4(0, 0, 0, 1) since, if I replace that call with any a constant color, the screen fills with the specified color. The texture is created, bound to texture unit 0, its storage is