Jump to content
  • Advertisement

Archived

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

Okay, why ?

This topic is 5972 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!