0
votes

(This is actually a crosspost from gamedev , but I thought you guys and girls might be helpful too!)

Edit: I elaborated about what I mean with overlay. After some sleep I have found that my call to glGenerateMipmaps is useless, since I use null as pointer to glTexImage2D.

On OpenGL 3.3, Ubuntu 11.04, nVidia drivers 280.13, GeForce GT240.

I'm making a deferred shader and wants to display my G-buffer in small overlays in the lower part of the screen. Overlays in this case meaning no z-test, textured screen aligned quads, and rendered last.

When rendering (one at a time) the G-buffers (FBO textures ) in full window they shows up correctly. When rendering to these overlays I get trash (seemingly random GPU-memory as static interference, but different between runs, sometimes clear picture).

If I create a different texture, say from file, it shows without trash in the overlays, so that code should be OK. Can anyone explain why? I have used glGenerateMipmap for the textures in the G-buffer.

I know this might be not enough information, but starts with this. Please ask about any relevant information. Can the problem be related to FBO-rendering and mipmapping? Surely my code wants to show unreserved/uninitialized memory, but I don't know why. The four textures below have trash data in them.


The full-window green picture is my current result from the lighting stage, in resolution (256*256) to save GPU memory because of fat G-buffer. Also, in the material shader (generating the G-buffer) I use "out vec4 fragment[3]", and the textures are of different internal formats. Can that be a problem?

PS. The lights are at (-30,0,0) and (30,0,0) but seems to be "nearer". Can that be a precision problem? I use GL_RGBA16F for the normals, GL_RGBA32F for the positions, GL_DEPTH_COMPONENT24 for depth and GL_RGBA for the albedo (Yes, an enormous waste, but I will optimize later).

1
"When rendering to small overlays I get trash": What are "small overlays"?Nicol Bolas
Given the complete lack of code, could be anything.genpfault

1 Answers

1
votes

OK, I found the problem. I generated mipmaps before any meaningful data was in the memory. Turning off mipmapping for the relevant textures solved the problem. Thank you anyway for your attention! enter image description here