PDA

View Full Version : Problem on new computer with GF4



blood.angel
10-20-2002, 10:11 AM
I wrote a program which displays a start up screen. Which is basically a quad the size of the screen and a texture applied to it.
It worked perfectly on my old computer, but on my new GF4 machine the pic isnt displayed properly at all. Its a solid color of whatever the first pixel color is (red).

Heres my code:



//read in the startup screen bitmap
if( (input = fopen("title.raw", "rt")) == NULL )
{
exit(0);
}
else
{
//startup_bitmap = (GLubyte *) calloc(786432, sizeof(GLubyte));//512x512x3 bytes
for (row = 0; row < 512; row++)
{
for (column = 0; column < 512; column++)
{
startup_bitmap[row][column][0] = fgetc(input);//fread(startup_bitmap[row][column][0], sizeof(GLubyte), 1, input);
startup_bitmap[row][column][1] = fgetc(input);//fread(startup_bitmap[row][column][1], sizeof(GLubyte), 1, input);
startup_bitmap[row][column][2] = fgetc(input);//fread(startup_bitmap[row][column][2], sizeof(GLubyte), 1, input);
}
}

//now create and assign the texs in OpenGL
glGenTextures(1, &amp;StartupTex_Name);
glBindTexture(GL_TEXTURE_2D, StartupTex_Name);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 512, 512, 0, GL_RGB, GL_UNSIGNED_BYTE, startup_bitmap);

glEnable(GL_TEXTURE_2D);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glBindTexture(GL_TEXTURE_2D, StartupTex_Name);
glBegin(GL_QUADS);
glTexCoord2f(0.0, 0.0); glVertex2f(0.0, 1.0);
glTexCoord2f(1.0, 0.0); glVertex2f(1.0, 1.0);
glTexCoord2f(1.0, 1.0); glVertex2f(1.0, 0.0);
glTexCoord2f(0.0, 1.0); glVertex2f(0.0, 0.0);
glEnd();
glFlush();
glDisable(GL_TEXTURE_2D);


Am I forgetting something?

blood.angel
10-20-2002, 05:38 PM
I forget to say, my previous computer was Win2k and a non GF card.
The new one is WinXp and a GF4 card.

blood.angel
10-20-2002, 06:55 PM
Oh, and Im using glut.

Is there any compatability problems with WINXP/OpenGL?

zeckensack
10-20-2002, 09:17 PM
You are suffering from an incomplete mipmap set.
Specify non-mipmapped filtering for the texture.

Eg


glBindTexture(...);
glTexImage2D(...);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTE R,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTE R,GL_LINEAR);

blood.angel
10-20-2002, 09:45 PM
Thanks. That worked.
Thats weird though. It works on one machine and not another. And its a 2D space, with no z plane usage at all! So hoes does mipmapping still apply.