Another SDL + OpenGL quandary...

Started by
1 comment, last by BradDaBug 22 years, 1 month ago
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.
I like the DARK layout!
Advertisement
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?
I like the DARK layout!
This is a really wild guess, but try replacing GL_RGB with GL_BGR or variations of that.

This topic is closed to new replies.

Advertisement