Skip to main content
GameDev.net gamedev.net
🔒 Locked

.bmp color problem....

Started by bballmitch Jun 2, 2006 at 1:31 AM 2 replies 650+ views
Original Post
bballmitch
bballmitch
Here is what my .bmp looks like : http://img20.imageshack.us/my.php?image=rockstileable1iv.png Here is what my program looks like when I load the .bmp and add the texture to my ground: http://img20.imageshack.us/my.php?image=mygame20060601163947788to.png For some reason its making the ground bluish instead of redish. here's my code:

unsigned int textures[5];
FIBITMAP *reticle;
.
.
.
glBindTexture(GL_TEXTURE_2D, textures[3]); 
     reticle = FreeImage_Load(FIF_BMP, "rockstileable.bmp", BMP_DEFAULT);
     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
     glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 512, 512, 0, GL_RGB, GL_UNSIGNED_BYTE, FreeImage_GetBits(reticle));
.
.
.
glPushMatrix();       //draws land
	glBindTexture(GL_TEXTURE_2D, textures[3]);
	glTranslatef(0,-4.3,-3.0);
	glScalef(100,1,100);
	glColor3f(1.0,1.0,1.0);
	glBegin(GL_QUADS);
         glTexCoord2f(0,0); glVertex3f(-1,-1,-1);
         glTexCoord2f(10,0); glVertex3f(-1,-1,1);
         glTexCoord2f(10,10); glVertex3f(1,-1,1);
         glTexCoord2f(0,10); glVertex3f(1,-1,-1);
	glEnd();
	glPopMatrix();
.
.
.

The name of the file is rockstileable.bmp and it is in the correct place. I don't know why the color is disoriented. I tried changing, both the third and seventh variables in glTexImage2D(), to GL_BGR instead of GL_RGB, but neither variable would compile while being GL_BGR. Any idea what the problem is?
Mitchen Games
Niddles
Niddles
BMP files use GL_BGR, which you have to include glext.h to use.
luisillo
luisillo
I use GL_BGR_EXT and works

glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 512, 512, 0, GL_BGR_EXT, GL_UNSIGNED_BYTE, FreeImage_GetBits(reticle));
Smit
Smit
Quote:
Original post by luisillo
I use GL_BGR_EXT and works

glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 512, 512, 0, GL_BGR_EXT, GL_UNSIGNED_BYTE, FreeImage_GetBits(reticle));


Yep, use GL_BGR_EXT. [smile]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.