c - Texture mapping in OpenGL (with SOIL) -


I have a problem getting a texture loaded with SOIL to show this quad accurately. This is not clear, so I'm just writing 2D PRIZH engines, and this is part of the rendering (without the need for optimization of any doubt). I have not done any OpenGL in a few months, and I have been very messy.

  #include & lt; OpenGL / OpenGL.h & gt; # Include & lt; GLUT / GLUT.h & gt; #include "SOIL.h" #include & lt; Stdio.h & gt; Glumeil Linktex; Zero draw (GLint left, GLint right, GLint bottom, GLint top, GLuint texture) {// Draw clockwise glColor3f (1.0, 1.0, 1.0); Globbdenactation (gL_treatmentdevddd, texture); GlBegin (GL_QUADS); GlTexCoord2i (1,1); GlVertex2i (right, up); GlTexCoord2i (1,0); GlVertex2i (right, bottom); GlTexCoord2i (0,0); GlVertex2i (left, bottom); GlTexCoord2i (0,1); GlVertex2i (left, above); GlEnd (); } Zero performance (zero) {glClearColor (0.0, 0.0, 0.0, 1.0); GlClear (GL_COLOR_BUFFER_BIT); GlLoadIdentity (); Glotho (0.0, 240.0, 0.0, 160.0, -1.0, 1.0); Draitsprit (50, 82, 50, 82, Linktex); GlFlush (); } Zero rearrangement (int v, int h) {glViewport (0, 0, (GLCC) w, (GLCC) H); GlMatrixMode (GL_PROJECTION); GlLoadIdentity (); GlMatrixMode (GL_MODELVIEW); } Zero init () {glEnable (GL_TEXTURE_2D); GlEnable (GL_BLEND); Globefenk (GLICCR_ALPHA, GL_ONMIMINUSURSCALAPHA); GlFrontFace (GL_CW); Glumeil Linktex = SOIL_load_OGL_texture ("link.png", SOIL_LOAD_AUTO, SOIL_CREATE_NEW_ID, SOIL_FLAG_INVERT_Y); GlTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); GlTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR_MIPMAP_LINEAR); If (0 == linktex) {printf ("SOIL loading error: '% s' \ n", SOIL_last_result ()); }} Int main (int argc, char ** argv) {glutInit (and argc, argv); GlutInitDisplayMode (GLUT_SINGLE); GlutInitWindowSize (240, 160); GlutInitWindowPosition (100, 100); Glute Crew Wandow ("Test"); Glute display (display); Glute Reshapfunk (reshape); GlutMainLoop (); in this(); Return 0; }  

It seems that when you are loading texture,

When you reference linktex in zero display ( < / P> , local / * gluent * / linktex = SOIL_load_OGL_texture ("link.png", SOIL_LOAD_AUTO, SOIL_CREATE_NEW_ID, SOIL_FLAG_INVERT_Y);


Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -