[SDL] surface to opengl texture problem

Peter Mulholland darkmatter at freeuk.com
Wed Nov 8 09:38:21 PST 2006


Hello Roger,

Wednesday, November 8, 2006, 5:36:03 PM, you wrote:

> 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?

You got "an error"? A compile error? A runtime error ? A crash,
wrong-looking texture?

Be more specific.

-- 
Best regards,
 Peter                            mailto:darkmatter at freeuk.com





More information about the SDL mailing list