Archived

This topic is now archived and is closed to further replies.

Moogle

Okay, why ?

Recommended Posts

First I initalize my teture:
glEnable(GL_TEXTURE_2D);
	bitmapData = LoadBitmapFile("test.bmp", &bitmapInfoHeader);
glGenTextures(1, &texture);
glBindTexture(GL_TEXTURE_2D, texture);
glTexImage2D(GL_TEXTURE_2D,0,GL_RGB,bitmapInfoHeader.biWidth, bitmapInfoHeader.biHeight, 0, GL_RGB, GL_UNSIGNED_BYTE, bitmapData);
 
Then I draw my thing:
glLoadIdentity();
			glTranslatef(x, y, z);
			glRotatef(r, 0.0f, 1.0f, 0.0f);


			glBegin(GL_QUADS);
				glColor3f(1.0f,1.0f,1.0f);
				glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, 1.0f, 0.0f);
				glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f,-1.0f, 0.0f);
				glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f,-1.0f, 0.0f);
				glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, 1.0f, 0.0f);
			glEnd();
 
And what the f-ck? No texture there!

Share this post


Link to post
Share on other sites
Try drawing the square like this:

glTexCoord2f(1, 1); glVertex2f(1.0f, 1.0f);
glTexCoord2f(0, 1); glVertex2f(-1.0f, 1.0f);
glTexCoord2f(0, 0); glVertex2f(-1.0f, -1.0f);
glTexCoord2f(1, 0); glVertex2f(1.0f, -1.0f);

Share this post


Link to post
Share on other sites
>>bitmapData = LoadBitmapFile("test.bmp", &bitmapInfoHeader);
glGenTextures(1, &texture);
glBindTexture(GL_TEXTURE_2D, texture);
glTexImage2D(GL_TEXTURE_2D,0,GL_RGB,bitmapInfoHeader.biWidth, bitmapInfoHeader.biHeight, 0, GL_RGB, GL_UNSIGNED_BYTE, bitmapData);<<

youre missing about 4 lines check other ppls code eg wheres the filtering method + texture wrap

Share this post


Link to post
Share on other sites
they have to be called somewhere or else youll end up with a white texture (which is prolly what the poster is experiencing)

Share this post


Link to post
Share on other sites