Sign in to follow this  
aeltani

SOIL, putting texture on rectangle

Recommended Posts

Hi, I want to insert an image on a rectangular quad using SOIL. It's my first time using SOIL and I have no clue how to use it. That's my code. //---------------------------------------------------------------------- GLuint tex_2d = SOIL_load_OGL_texture ( "img.png", SOIL_LOAD_AUTO, SOIL_CREATE_NEW_ID, SOIL_FLAG_MIPMAPS | SOIL_FLAG_INVERT_Y | SOIL_FLAG_NTSC_SAFE_RGB | SOIL_FLAG_COMPRESS_TO_DXT ); /* check for an error during the load process */ if( 0 == tex_2d ) { printf( "SOIL loading error: '%s'\n", SOIL_last_result() ); } glBegin(GL_POLYGON); glVertex2f(50,50); glVertex2f(50,200); glVertex2f(200,200); glVertex2f(200,50); glEnd(); //----------------------------------------------------------------------- It loads an image into an array. Then I draw a rectangle using GL_QUADS. But how do i put the image on the quad? Thanks.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this