PDA

View Full Version : Repainting the viewport



devdept
05-25-2010, 06:46 AM
Hi All,

We are storing and repainting the viewport using the following code (four pot textures of the size necessary to cover the viewport size).

Unfortunately on some machines (Sony VAIO laptop / 6GB RAM /Win 7 - x64 / NVIDIA GeForce GT 330M Graphics / 1GB RAM / Driver 8.16.11.8867) the two texture on the upper row are rendered equal to the two on the lower one. Why can this happen? On this specific machine the texture we are using are 512x512 and the viewport size is 782x705 pixels.

Thanks,

Alberto

Grabbing:

for (int j = 0; j < 2; j++)

for (int i = 0; i < 2; i++)
{

glBindTexture(gl.TEXTURE_2D, texName[count++]);

glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, texSize, texSize, 0, GL_RGBA, GL_UNSIGNED_BYTE, null);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);

glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, texSize*i, texSize*j, texSize, texSize);

}


Drawing:

for (int j = 0; j < 2; j++)

for (int i = 0; i < 2; i++)
{
glBindTexture(GL_TEXTURE_2D, texName[i]);
glColor3f(1, 1, 1);
glBegin(gl.QUADS);

glTexCoord2d(0, 0);
glVertex2i(i * texSize, j * texSize);

glTexCoord2d(1, 0);
glVertex2i((i+1) * texSize, j * texSize);

glTexCoord2d(1, 1);
glVertex2i((i + 1) * texSize, (j + 1) * texSize);

glTexCoord2d(0, 1);
gl.Vertex2i(i * texSize, (j + 1) * texSize);

glEnd();

}

ZbuffeR
05-25-2010, 07:31 AM
for (int j = 0; j < 2; j++)
for (int i = 0; i < 2; i++) {
glBindTexture(GL_TEXTURE_2D, texName[i]); // you surely meant count++ instead of i ? texName[i] will only toggle between 2 textures, not 4.

devdept
05-25-2010, 08:22 AM
WOW! sorry everybody, this is probably the problem.

Thanks ZBuffeR!