Archived

This topic is now archived and is closed to further replies.

BradDaBug

OpenGL Another SDL + OpenGL quandary...

Recommended Posts

How do I load texture data with SDL? I''m reading OpenGL Game Programming, and it''s pretty Win32 specific. How to I get bitmap data from an SDL_Surface onto a texture? This is my code to load the pixels onto a surface: SDL_LockSurface(lpSurface); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, lpSurface->w, lpSurface->h, 0, GL_RGB, GL_UNSIGNED_BYTE, lpSurface->pixels); SDL_UnlockSurface(lpSurface); It crashes whenever it gets to this point.

Share this post


Link to post
Share on other sites
OK, I got it to load a texture. I accidently put the texture loading code before the surface was actually loaded.

Anyways, I can draw a nice textured polygon, but the colors are all wrong. What''s up with that?

Share this post


Link to post
Share on other sites