Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Loading Textures with SOIL?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 eDuDe   Members   -  Reputation: 122

Like
0Likes
Like

Posted 10 April 2012 - 10:55 PM

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);


Sponsor:

#2 Rld_   Members   -  Reputation: 1515

Like
0Likes
Like

Posted 12 April 2012 - 07:39 AM

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

#3 eDuDe   Members   -  Reputation: 122

Like
0Likes
Like

Posted 14 April 2012 - 08:20 PM

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.

#4 Rld_   Members   -  Reputation: 1515

Like
0Likes
Like

Posted 15 April 2012 - 04:09 AM

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?




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS