Hello,
I’ve got a strange behaivior and need some Ideas.
My Graphiccard: ATI Mobility Radeon X1600
I create a Float Texture and set some Values to It. After this, I render this to an Texture created with GL_ARB_framebuffer_object. It is from same Type and I render only a Plane with the Full Texture. Try to add some code below.
If I create my Texture with values like 1,2,3,4,5,6 and so on, the values are In Texture after Rendering too. If I use the Values (22.4,0,11.2) I got some values changed to (1,1,1).
Some code:
Create Texture with:
int Dim = 32;
int TexSize = Dim * Dim;
float * ImgData = new float[TexSize * 3];
memset(ImgData, 0, sizeof(float) * TexSize * 3);
for (int i = 0; i < TexSize; i++)
{
ImgData[i*3] = i*3;
ImgData[i*3+1] = i*3+1;
ImgData[i*3+2] = i*3+2;
}
GLuint vtex;
glEnable(GL_TEXTURE_2D);
glGenTextures(1, &vtex);
glBindTexture(GL_TEXTURE_2D, vtex);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
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_RGB32F_ARB,Dim,Dim, 0, GL_RGB, GL_FLOAT, ImgData);
printTexture(vtex, Dim, Dim);
PrintOpenGLErrors();
delete[] ImgData;
Render to Texture with:
mRenderTarget->enable();
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, vtex);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glClearColor(1,1,1,1);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glBegin(GL_QUADS);
glTexCoord2f(0.0f,0.0f);
glVertex2f(0.0f,0.0f);
glTexCoord2f(1.0f,0.0f);
glVertex2f(1.0f,0.0f);
glTexCoord2f(1.0f,1.0f);
glVertex2f(1.0f,1.0f);
glTexCoord2f(0.0f,1.0f);
glVertex2f(0.0f,1.0f);
glEnd();
mRenderTarget->disable();
glBindTexture(GL_TEXTURE_2D, 0);
In most cases the output of the Texture created and the Texture rendered are the same, but if you Replace the loop, which set the Values for the Texture with:
for (int i = 0; i < TexSize; i++)
{
ImgData[i*3] = 22.4f;
ImgData[i*3+1] = 0.0f;
ImgData[i*3+2] = 11.2f;
}
I’ve got the following Pixel Values (some of them listet, but You’ll see)
(22.4/0/11.2)(1/1/1)(22.4/0/11.2)(1/1/1)(22.4/0/11.2)(1/1/1)(22.4/0/11.2)
I’ve copletely no Idea how this can be!
Some Ideas?
Obs