SOIL, putting texture on rectangle
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement