Jump to content
  • Advertisement
Sign in to follow this  
namingway

opengl textures not showing up

This topic is 4015 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

My texture is not drawing to the square ive drawn, heres the render code.
	glClear(GL_COLOR_BUFFER_BIT);
	
	glLoadIdentity();
	glBindTexture(GL_TEXTURE_2D, texture[0]);
	
	glBegin(GL_QUADS);
		glTexCoord2i(0, 0); glVertex2i(0, 0); //bottom left
		glTexCoord2i(32, 32); glVertex2i(32, 0);//top right
		glTexCoord2i(32, 0); glVertex2i(32, 32);//bottom right
		glTexCoord2i(0, 32); glVertex2i(0, 32);//top left
		
	glEnd();

I am using the loading code from the nehe tutorials. Also according to my logfile, if(!LoadGLTextures()) { Log.Write("Error: Failed to load textures...\n"); Log.Flush(); } Log.Write("Textures loaded...\n"); Log.Flush(); is successful.

Share this post


Link to post
Share on other sites
Advertisement
I originally had the 1's instead of 32's but that didnt help so i changed them for a just in case and never changed them back, ive done so now. but the texture still isnt drawing to it :(

Share this post


Link to post
Share on other sites
I remember having some troubles loading a texture with a width and/or a height that wasn't a power of 2 on some video cards, try loading a texture with a size of 256x256 for example.

Share this post


Link to post
Share on other sites
Make sure that texture[0] actually has a proper value. What you need as second parameter in bindtexture is unsigned int. Also, OpenGL starts indexing the textures from 1, rather than 0. So if your texture[0]==0, it explains your problem.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!