Note that there are some explanatory texts on larger screens.

plurals
  1. POWhen using a GL_RGBA16F_ARB-texture, it contains just crap, but I get no error message
    primarykey
    data
    text
    <p>I generate a texture like this:</p> <pre><code>GLuint id; glGenTextures(1, &amp;id); glBindTexture(GL_TEXTURE_2D, id); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA16, //GL_RGBA16F_ARB, //&lt; Won't work 256, 256, 0, GL_RGBA, GL_FLOAT, NULL ); glBindTexture(GL_TEXTURE_2D, 0); </code></pre> <p>I attach it to a framebuffer object (FBO) for rendering to. All of this works like a charm when I set the internal format to <code>GL_RGBA16</code>. However, I need a higher dynamic range and was thinking that <code>GL_RGBA16F_ARB</code> might do the trick.</p> <p>Unfortunately, if I replace <code>GL_RGBA16</code> with <code>GL_RGBA16F_ARB</code> in the code given above, the texture seems to stop working. Nothing I try to render to the FBO/texture sticks, and when I use the texture it contains random garbage. (A lot of purple, as it turns out) This would not be so frustrating if I had gotten an error message hinting at what might be wrong, but I can't seem to find one. In other words, <code>glGetError()</code> returns <code>0</code> after the <code>glTexImage2D</code>-call, and <code>glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT)</code> returns <code>GL_FRAMEBUFFER_COMPLETE_EXT</code> when I have attached the texture</p> <p>I haven't messed with <code>glClampColorARB(...)</code> ... yet :)</p> <ol> <li>Have I forgotten to check for errors in a place/way that I haven't thought of?</li> <li>Do <code>GL_RGBA16F_ARB</code>-textures require any special treatment that I haven't given?</li> <li>Is there anything else that might be wrong?</li> </ol> <p>I'm stumped, since everything works smoothly with <code>GL_RGBA16</code>... :(</p> <p><strong>EDIT:</strong> When using <code>GL_RGBA16F_ARB</code>, the first frame I try to render to screen doesn't make it. Seems to me that I should be getting an error message somewhere..?</p> <p><strong>EDIT:</strong> By inspecting ShadowIce's working code example I figured out that the problems disappeared if I changed the <em>depth buffer</em> on my FBO, and give <code>glRenderBufferStorageEXT(...)</code> <code>GL_DEPTH_COMPONENT24</code> as its second parameter, rather than <code>GL_DEPTH_COMPONENT16</code>. I have no idea <em>why</em> this works, but apparently it does work.</p> <p>Also, ShadowIce's code breaks like mine if I do the opposite substitution there.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload