Hello,

Im using SOIL library to display a random png image and learn this process in openGL with Codeblocks. Everything compiles fine and without errors but then nothing comes up in the created black screen. Ive checked that the png file is in the required folder where the exe is and everything seems correct but image wont show up. Any idea why this happens? This is the code:

#include <GL/glut.h>
#include <stdlib.h>
#include <stdio.h>
#include <SOIL.h>

void LoadPNG()
{
GLuint tex_2d = SOIL_load_OGL_texture(

"C:\\Users\\Serrano\\Documents\\Sources\\HelloWorl d2\\.binsd\\img_test.png",
//"img_test.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() );
}
}

void init(void)
{
glClearColor(0.0, 0.0, 0.0, 0.0);
glShadeModel(GL_FLAT);
}

void display(void)
{
glClear(GL_COLOR_BUFFER_BIT),
glColor3f(1.0, 1.0, 1.0);
glLoadIdentity();
LoadPNG();
glFlush();
}

void reshape(int w, int h)
{
glViewport(0, 0, (GLsizei) w, (GLsizei) h);
glMatrixMode(GL_PROJECTION),
glLoadIdentity();
//glFrustum(-1.0, 1.0, -1.0, 1.0, 1.5, 20.0);*/
gluPerspective(100.0, 1.0, 1.5, 20.0);
glMatrixMode(GL_MODELVIEW);
}
/* Program entry point */

int main(int argc, char *argv[])
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize(500,500);
glutInitWindowPosition(200,200);
glutCreateWindow(argv[0]);
init();
glutDisplayFunc(display);
glutReshapeFunc(reshape);
glutMainLoop();
return 0;
}

Thank you!