OpengGL with SDL

Started by
8 comments, last by decsonic 19 years, 5 months ago
Is there any website tutorial or hints to do OpenGL with SDL Im only read from cone3d.gamedev.net thanks for the help..
Advertisement
SDL only intersects with opengl in a few places.

Initialization and mode setting, and image loading (also text rendering).

The rest of the time you're working with purely opengl, so any opengl tutorial will do.

I haven't looked at cone3d, but I'm sure it covers these areas. (edit: indeed it does, except only bitmap fonts. I really should go write a SDL_ttf/GL article)
This should get you started, the nehe tutorials converted to SDL http://www.libsdl.org/opengl/OpenGL-intro-1.1.1.zip (Haven't posted here for a while, so I forgot the url code :P)
--monkey
Quote:Original post by ninmonkey
This should get you started, the nehe tutorials converted to SDL http://www.libsdl.org/opengl/OpenGL-intro-1.1.1.zip (Haven't posted here for a while, so I forgot the url code :P)
same as html: link(click "edit post" to find out what tag I used)
Wah Thank you ..

So Can I do the light and fog effect with SDL?

Is SDL actually use any openGL? because from what I doing, ITs not using any openGL attribute.. Or it is using oepnGL in the SDL library?

I dont need to have winmain and stuff again.

btw, ok I will read the zip files first.
Quote: So Can I do the light and fog effect with SDL?


Nope, you can't do that in plain SDL but if you're using mega combo SDL+OpenGL then yes, you can do it.

Quote:Is SDL actually use any openGL? because from what I doing, ITs not using any openGL attribute.. Or it is using oepnGL in the SDL library?


SDL is not using OpenGL, on windows it uses DirectX (version 5.0... :-/ ) however you can tell SDL that you want to work with OGL instead, but then you must write some code yourself.

Read in SDL docs! there's chapter about using SDL with OGL.
SDL does not actually do the rendering when you set up SDL + OpenGL.

SDL sets up the rendering context (in a platform-specific way) and allows you to get input events and such like (also in a platform specific way).

Have a look around, I think someone's ported the majority of NeHe's tutorials from the original Win32 to SDL. But don't worry - in most cases it makes them simpler not more complicated.

The SDL / OpenGL setup code is a lot smaller than the equivalent win32.

Mark
Really simply put.

Use SDL to handle windows, media and input and OpenGL to handle 3D rendering.
Mm yeah I have read that from the sdl manual.
Thanks Guys, I understand now...

So If I do pure SDL, I cant use any of the openGL features, like fog, lightning rite.

Im just trying to make 2d game, And I found using openGL is harder, I wont have enough time for that.

So I will just SDL then.
Thankss.. for all the help
nehe for opengl tutorials [smile] and of course [google]

Edit:
And no, you cant mix SDL's 2D framebuffer with OpenGL,
however doing 2D in OpenGL is neat.

This topic is closed to new replies.

Advertisement