2d prob

I’ve read NeHe’s tutorail on texture mapping… and I wish to show a bmp in a window (640x400) everything works fine and the image displays when its small (256x256) but when i attempt to display it whilst its large (using below code) It just shows up as white!

glBindTexture(GL_TEXTURE_2D, texture[0]);			// Select Our Logo Texture
glBegin(GL_QUADS);									// Start Drawing A Textured Quad
	glTexCoord2f(0.0f, -roll+0.0f); glVertex3f(-1.1f, -1.1f,  0.0f);	// Bottom Left
	glTexCoord2f(3.0f, -roll+0.0f); glVertex3f( 1.1f, -1.1f,  0.0f);	// Bottom Right
	glTexCoord2f(3.0f, -roll+3.0f); glVertex3f( 1.1f,  1.1f,  0.0f);	// Top Right
	glTexCoord2f(0.0f, -roll+3.0f); glVertex3f(-1.1f,  1.1f,  0.0f);	// Top Left
glEnd();

Are you using two diffrent sized images, one for the windowed and one for the full screen?

Originally posted by Nial:
[b]I’ve read NeHe’s tutorail on texture mapping… and I wish to show a bmp in a window (640x400) everything works fine and the image displays when its small (256x256) but when i attempt to display it whilst its large (using below code) It just shows up as white!

glBindTexture(GL_TEXTURE_2D, texture[0]); // Select Our Logo Texture
glBegin(GL_QUADS); // Start Drawing A Textured Quad
glTexCoord2f(0.0f, -roll+0.0f); glVertex3f(-1.1f, -1.1f, 0.0f); // Bottom Left
glTexCoord2f(3.0f, -roll+0.0f); glVertex3f( 1.1f, -1.1f, 0.0f); // Bottom Right
glTexCoord2f(3.0f, -roll+3.0f); glVertex3f( 1.1f, 1.1f, 0.0f); // Top Right
glTexCoord2f(0.0f, -roll+3.0f); glVertex3f(-1.1f, 1.1f, 0.0f); // Top Left
glEnd();[/b]

No, for my engine i’ve disabled full screen.

So really I need to know why my bmp comes up white!

(I’ve gotten rid of everything else except the logo display code (which works for smaller images) but no my large!)

So you changed the size of the image? It needs to be a power of two from my understanding, you can prolly bypass. But for what your doing, I’d make it a power of 2. IE:

2x2, 4x4, 8x8, 16x16, 32x32, 64x64, 128x128, 256x256, 512x512, 1024x1024 Etc…

Okay 512x512, the image works!

But it shows 9 smaller version in the window. Its got the polygon the width and height of the screen but its not applying the image actual size heres my drawglscene code:

int DrawGLScene(GLvoid) // Here’s Where We Do All The Drawing
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear The Screen And The Depth Buffer
glLoadIdentity(); // Reset The Modelview Matrix
glTranslatef(0.0f,0.0f,-2.0f); // Move Into The Screen 5 Units
glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
glBindTexture(GL_TEXTURE_2D, texture[0]); // Select Our Logo Texture
glBegin(GL_QUADS); // Start Drawing A Textured Quad
glTexCoord2f(0.0f, -roll+0.0f); glVertex3f(-1.1f, -1.1f, 0.0f); // Bottom Left
glTexCoord2f(3.0f, -roll+0.0f); glVertex3f( 1.1f, -1.1f, 0.0f); // Bottom Right
glTexCoord2f(3.0f, -roll+3.0f); glVertex3f( 1.1f, 1.1f, 0.0f); // Top Right
glTexCoord2f(0.0f, -roll+3.0f); glVertex3f(-1.1f, 1.1f, 0.0f); // Top Left
glEnd(); // Done Drawing The Quad

glEnable(GL_BLEND);									// Enable Blending
glDisable(GL_DEPTH_TEST);							// Disable Depth Testing

if (masking)										// Is Masking Enabled?
{
	glBlendFunc(GL_DST_COLOR,GL_ZERO);				// Blend Screen Color With Zero (Black)
}



glEnable(GL_DEPTH_TEST);							// Enable Depth Testing
glDisable(GL_BLEND);								// Disable Blending


return TRUE;										// Everything Went OK

}

Ya, I forgot to mention, change the “3” in all of the glTexCoord to 1. What it does when set to 3 is devide the Face into a 3x3 Square. (9 Seperate sections) and maps the texture to each individual sections.

Keep in mind though, if you come across making a large wall, increasing this number can be helpful to add detail, etc.

IE:
glTexCoord2f(1.0f, -roll);

Originally posted by Nial:
[b]Okay 512x512, the image works!

But it shows 9 smaller version in the window. Its got the polygon the width and height of the screen but its not applying the image actual size heres my drawglscene code:

int DrawGLScene(GLvoid) // Here’s Where We Do All The Drawing
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear The Screen And The Depth Buffer
glLoadIdentity(); // Reset The Modelview Matrix
glTranslatef(0.0f,0.0f,-2.0f); // Move Into The Screen 5 Units
glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
glBindTexture(GL_TEXTURE_2D, texture[0]); // Select Our Logo Texture
glBegin(GL_QUADS); // Start Drawing A Textured Quad
glTexCoord2f(0.0f, -roll+0.0f); glVertex3f(-1.1f, -1.1f, 0.0f); // Bottom Left
glTexCoord2f(3.0f, -roll+0.0f); glVertex3f( 1.1f, -1.1f, 0.0f); // Bottom Right
glTexCoord2f(3.0f, -roll+3.0f); glVertex3f( 1.1f, 1.1f, 0.0f); // Top Right
glTexCoord2f(0.0f, -roll+3.0f); glVertex3f(-1.1f, 1.1f, 0.0f); // Top Left
glEnd(); // Done Drawing The Quad

glEnable(GL_BLEND); // Enable Blending
glDisable(GL_DEPTH_TEST); // Disable Depth Testing

if (masking) // Is Masking Enabled?
{
glBlendFunc(GL_DST_COLOR,GL_ZERO); // Blend Screen Color With Zero (Black)
}

glEnable(GL_DEPTH_TEST); // Enable Depth Testing
glDisable(GL_BLEND); // Disable Blending

return TRUE; // Everything Went OK
}[/b]

Thanks that helped alot!