Hi there.
I have a problem porting a SDL/OpenGL App from Windows to Linux. I am using a 1024x768x32bpp mode, and .png files as source for 2DMipmaps.
In linux everything looks fine, in Windows it seems like it is only 16bpp mode instead of 32bpp ( but it isn’t actually).
Here’s the code of how I load a texture :
glEnable(GL_TEXTURE_2D);
glGenTextures(1, &texture);
glBindTexture(GL_TEXTURE_2D, texture);
gluBuild2DMipmaps(GL_TEXTURE_2D,
4,
bitmap->w,
bitmap->h,
(bitmap->format->BitsPerPixel == 32) ? GL_RGBA : GL_RGB,
GL_UNSIGNED_BYTE,
bitmap->pixels);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
// glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glFinish();
And here is how I draw it onto the Screen :
float scalefx = (float(settings.display.width) / ( 1024.0f / 100.0f ))/100.0f;
float scalefy = (float(settings.display.height) / ( 768.0f / 100.0f ))/100.0f;
glPushMatrix();
GL_TexEnable(1);
GL_Bind(image.texture);
if ( alpha ) {
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
glTranslatef(x,y,z);
glScalef(1.0f*scale,1.0f*scale,1.0f*scale);
glColor4f(1.0f,1.0f,1.0f, aChannel);
glBegin(GL_QUADS);
glTexCoord2f(0.0f, 0.0f); glVertex3f(0.0f,0.0f,0.0f);
glTexCoord2f(1.0f, 0.0f); glVertex3f(float(image.w)*scalefx, 0.0f, 0.0f);
glTexCoord2f(1.0f, 1.0f); glVertex3f(float(image.w)*scalefx, float(image.h)*scalefy, 0.0f);
glTexCoord2f(0.0f, 1.0f); glVertex3f(0.0f, float(image.h)*scalefy, 0.0f);
glEnd();
if ( alpha ) {
glDisable(GL_BLEND);
}
GL_TexEnable(0);
glPopMatrix();
Here’s a screenshot, you can see it : left is the windows-crap and right is the original image. You can save it as .png file and zoom it a bit, to have a closer look.
/*** EDIT : Included zoomed Version of the Image,
/*** EDIT : so it’s better to see.
Please let me know if you have any Ideas regarding this problem.
Best regards, Nico