Jump to content
  • Advertisement
Sign in to follow this  
eDuDe

OpenGL Loading Textures with SOIL?

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

I'm runnning into a goofy texturing issue while trying to implemented this OpenGL tutorial (NeHe Lesson 10), and I've narrowed it down to how I'm loading textures using SOIL. Unfortunately this appeared to be working in previous lessons so I'm kinda lost on what to do.

Any ideas?

http://imgur.com/24gGJ

Should be tiled, not stretched and facing one direction.

texture[0] = SOIL_load_OGL_texture( "Assets/2D/Mud.bmp",
SOIL_LOAD_AUTO,
SOIL_CREATE_NEW_ID,
SOIL_FLAG_INVERT_Y );
texture[1] = SOIL_load_OGL_texture( "Assets/2D/Mud.bmp",
SOIL_LOAD_AUTO,
SOIL_CREATE_NEW_ID,
SOIL_FLAG_INVERT_Y );
texture[2] = SOIL_load_OGL_texture( "Assets/2D/Mud.bmp",
SOIL_LOAD_AUTO,
SOIL_CREATE_NEW_ID,
SOIL_FLAG_INVERT_Y | SOIL_FLAG_MIPMAPS );
glBindTexture(GL_TEXTURE_2D, texture[0]);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
glBindTexture(GL_TEXTURE_2D, texture[1]);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
glBindTexture(GL_TEXTURE_2D, texture[2]);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_NEAREST);

Share this post


Link to post
Share on other sites
Advertisement
Never done the tutorial, so can't really comment on that, however, you are loading the same texture 3 times. Perhaps the purpose of the tutorial was to show off the different parameters. To make a texture tile, you should use the following parameters:


glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );

Hope it helps

Share this post


Link to post
Share on other sites
From what I understand of SOIL, I was loading the same texture but with two different methods (generating mipmaps for one, not for the other two). It is just laid out that way so I have an easier time staring at it trying to figure out what was wrong.

Share this post


Link to post
Share on other sites
Yeah could be that it does that under the hood, I haven't checked the depths of soil yet. Doesn't do any harm anyway. But did the parameters work?

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!