16 Bit Non-Clamped Texture

Started by
1 comment, last by V-man 12 years, 3 months ago
Ok Dudes,

I've searched for an hour and still I cannot figure out what I am doing wrong. I want to make a simple 16 bit float 3D texture that is not clamped and I'm trying to accomplish this via this call:


glTexImage3D(GL_TEXTURE_3D, 0, GL_LUMINANCE16F_ARB,
dims[0],
dims[1],
dims[2], 0,
GL_LUMINANCE, GL_SHORT, volumeData);


The code runs fine, and yet my values are still clamped to 0-1. I must be missing something, or perhaps one of the types are incorrect, but I'm at a loss. Is there perhaps some call to an enable function that must preceed the usage of non-clamped textures?

As far as I can tell it should work with 3D textures just fine...

Gazoo
Advertisement
Let it be known! I've spent a few hours and come to the following conclusion. Someone please correct me if I am wrong:

OpenGL clamps values IF they're provided in the GL_SHORT format (and perhaps other non-float formats). It does not matter if you want them represented at 16 bit float or 32 bit float internally. They WILL be clamped between 0 and 1.


In other words, to upload actual NON-clamped data, stick to this upload code:


glTexImage3D(GL_TEXTURE_3D, 0, GL_LUMINANCE16F_ARB, tWidth, tHeight, tDepth, 0, GL_LUMINANCE, GL_FLOAT, ptexels);


Note that the values MUST be provided in float...

Gazoo out...
If you want to actually have SHORT, then such integer formats are supported in GL 3. Have a look at the spec. All SM 4 GPUs support integer samplers.
Sig: http://glhlib.sourceforge.net
an open source GLU replacement library. Much more modern than GLU.
float matrix[16], inverse_matrix[16];
glhLoadIdentityf2(matrix);
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhRotateAboutXf2(matrix, angleInRadians);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glhQuickInvertMatrixf2(matrix, inverse_matrix);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);

This topic is closed to new replies.

Advertisement