Talk:SDL:Tutorials:Using SDL with OpenGL

From GPWiki

Files:GUITutorial_warn.gif The Game Programming Wiki has moved! Files:GUITutorial_warn.gif

The wiki is now hosted by GameDev.NET at wiki.gamedev.net. All gpwiki.org content has been moved to the new server.

However, the GPWiki forums are still active! Come say hello.

Can anyone verify the anonymous user's changes of glTexCoord2f to glTexCoord2i? No reason was given for the changes, and I'm not knowledgeable enough in OpenGL to know if this is vandalism or not. Ryan Clark 14:07, 24 Jun 2005 (EDT)


glTexCoord2i is just the integer version of the texture mapping function. As the parameters are not floats it's OK. Codehead 14:32, 24 Jun 2005 (EDT)

SDL_BlitSurface and SDL

The example on the page contains the following two lines.

SDL_BlitSurface(image, &src, screen, &dest);
SDL_UpdateRects(screen, 1, &dest); //This is the only new part

The libSDL manual for SDL_BlitSurface contains the following paragraph:

The blit function should not be called on a locked surface. I.e. when you use your own drawing functions you may need to lock a surface, but this is not the case with SDL_BlitSurface. Like most surface manipulation functions in SDL, it should not be used together with OpenGL.

Thus maybe the SDL_BlitSurface call above is not such a good idea? --Jochen


Probably not a good idea. However, the SDL_BlitSurface() function and SDL_OPENGLBLIT init flag are there for backwards compatibility reasons. If you're using SDL as a OpenGL context then you probably want to draw only with OpenGL. SDL_BlitSurface() is there for the possibility of drawing with purely SDL. As of SDL version 1.2.9 though, I think SDL_OPENGLBLIT was dropped altogether, so this piece of code may now be void.
Maybe this article needs to be reworked since there have been several other complaints about it. --sdw 20:16, 26 October 2005 (EDT)

Just a random note about the article -

For win32 apps you'll need to include:


  • windows.h
  • sdl.h
  • sdl_main.h
  • gl.h


and you'll have to link in


  • sdl.lib
  • sdlmain.lib
  • opengl32.lib


Just a random gripe - took me a book lookup to find opengl32.lib was the one I was missing. Arr, always forget that '32' on the end :/

Big Changes

I removed the code associated with OPENGLBLIT altogether so that people wouldn't use it. Should I link to another page that describes how to use it for reference anyways? --sdw 21:58, 10 August 2006 (EDT)