[SDL] surface to opengl texture problem
Roger D. Vargas
roger at ehtsc.co.cu
Wed Nov 8 09:36:03 PST 2006
The following code I use to convert a surface to opengl texture works
fine when compiled with old gcc.When compiled with VC Express 2005 or gcc
4.1 I got an error:
tmp=IMG_Load("data/green.jpg");
glGenTextures(1, &grass);
glBindTexture(GL_TEXTURE_2D, grass); // 2d texture (x and y size)
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
gluBuild2DMipmaps(GL_TEXTURE_2D,GL_RGB,tmp->w, tmp->h, GL_RGB,
GL_UNSIGNED_BYTE, tmp->pixels);
No matter what image type I use, jpg or png it is the same. Can somebody
suggest me some more reliable way to do this?
--
Roger D. Vargas
http://dsgp.blogspot.com
More information about the SDL
mailing list