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

Loading Textures with SOIL?

Started by eDuDe Apr 11, 2012 at 4:55 AM 2 replies 2.4k views
Original Post
eDuDe
eDuDe
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);
WhiskyJoe
WhiskyJoe
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
eDuDe
eDuDe
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.
WhiskyJoe
WhiskyJoe
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?

Topic Locked

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

Sign in to reply to this topic.