Need Help : How to make buttons in SDL_opengl?

Started by
3 comments, last by pandaraf 11 years, 9 months ago
How to make buttons in SDL_opengl?

When i'm using SDL and use BlitSurface to make button, it's work! But, currently i'm using SDL_opengl, How can i make buttons in SDL_opengl?
SDL_BlitSurface isn't work in SDL_OpenGL.

Any Help? :)
Advertisement
I'm pretty sure you're confusing some stuff up :)

1) SDL's default mode of rendering works by "blitting". Thus, you can use operations such as SDL_BlitSurface to render onto the screen.
2) OpenGL, DirectX, etc are all rendering API's that let you interface with the graphics card. They have their own rendering models. So you'll have to use functions provided by openGL. Using blitSurface, newSurface, and most other SDL related rendering functions *will not work* with openGL. this is why you're not able to see anything being rendered on the screen.
3) as for making buttons in SDL_openGL, you can either a) use a library such as GLUT(http://www.opengl.org/resources/libraries/glut/) or b) roll your own menu system. I'd suggest using GLUT if you're a beginner. (being quite new to this myself, it's helped me save loads of trouble :P)

some useful links: http://nehe.gamedev.net/ (outdated in some areas, but is still pretty solid)
http://www.opengl.org/archives/resources/faq/technical/gettingstarted.htm
http://www.libsdl.org/opengl/index.php

hope this helps!
PS- I'm really sorry if I've messed up the terminology. I'm quite new to programming >.>;

a WIP 2d game engine: https://code.google.com/p/modulusengine/

English is not my first language, so do feel free to correct me :)


3) as for making buttons in SDL_openGL, you can either a) use a library such as GLUT(http://www.opengl.or...libraries/glut/) or b) roll your own menu system. I'd suggest using GLUT if you're a beginner. (being quite new to this myself, it's helped me save loads of trouble )



Hmm...

1. Is GLUT can run in Ubuntu?
2. How about GLUI, what's the difference?
3. If neither of them, is SDL_opengl can make Buttons by itself? or still need another library?

Perharps, i will use one of them.
I'm not really sure about *nix, but as far as I've heard, yes, it does run. GLUI depends on GLUT.

So the dependency chain would be GLUI -> GLUT -> OpenGL (SDL_OpenGL).

Hope you manage to complete what you want :)

a WIP 2d game engine: https://code.google.com/p/modulusengine/

English is not my first language, so do feel free to correct me :)


I'm not really sure about *nix, but as far as I've heard, yes, it does run. GLUI depends on GLUT.

So the dependency chain would be GLUI -> GLUT -> OpenGL (SDL_OpenGL).

Hope you manage to complete what you want smile.png


Oh, so that is how they are work :D
Do you have a link that contain how to setting glut and glui in an IDE?

I have search in google, but it really hard to find the correct one :S

This topic is closed to new replies.

Advertisement