Hello,
I have a really strange problem with my GL_TEXTURE_RECTANGLE_ARB texture.
When my initial image for my texture is completly white, my program seems to work fine, except for the fact that the texture is white instead of black.
However, when my initial image for my texture is black my complete screen remains black. Even when I remove my texture-rendering related code, it still shows a blackscreen.
I find this quite odd since, I can’t find anything in my code that could possible cause strange behaviour.
Here’s my code(with a black texture):
INIT CODE:
glEnable(GL_TEXTURE_RECTANGLE_ARB);
glGenTextures(1, &TextureIndex);
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, TextureIndex);
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_T, GL_CLAMP);
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
GLubyte BlackImage[width()][height()][4]; // RGBA image
for(int i = 0;i < width();i++)
{
for(int j = 0;j < height();j++)
{
for(uint k = 0;k < 4;k++)
BlackImage[i][j][k] = 0;
}
}
glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA, width(), height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, BlackImage);
RENDER CODE:
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, TextureIndex);
glCopyTexSubImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, 0, 0, 0, 0, width()-1, height()-1);
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_QUADS);
glTexCoord2d(0.0, 0.0); glVertex2f(-2.0, -2.0);
glTexCoord2f(width(), 0.0); glVertex2f(2.0, -2.0);
glTexCoord2f(width(), height()); glVertex2f(2.0, 2.0);
glTexCoord2f(0.0, height()); glVertex2f(-2.0, 2.0);
glEnd();
[..]
I hope somebody can help me with this strange thing.
Thanks in advance,
Hylke