Page 1 of 1

SDL and OpenGL game, what still to use in SDL.

Posted: Sun Apr 08, 2012 8:07 pm
by jakobnator
Still programming my "games" in SDL, I want to move onto integrating OpenGL since its apparently so awesome. From my understanding the only thing OpenGL can do is render and can't handle input, correct me if I am wrong. So I am assuming that when you integrate OpenGL with SDL all that you need from SDL is input? I would just like some clarity on this and any other information on using OpenGL with SDL is also greatly appreciated.

Re: SDL and OpenGL game, what still to use in SDL.

Posted: Sun Apr 08, 2012 8:42 pm
by qpHalcy0n
That would be correct. OpenGL handles graphics only.

Use SDL or whatever else to deal with your input and anything else you need.

Re: SDL and OpenGL game, what still to use in SDL.

Posted: Sun Apr 08, 2012 8:47 pm
by YourNerdyJoe
I found this for connverting the SDL_Surface into OpenGL textures:
http://content.gpwiki.org/index.php/SDL ... ith_OpenGL
Hope it helps

Re: SDL and OpenGL game, what still to use in SDL.

Posted: Sun Apr 08, 2012 8:58 pm
by superLED
YourNerdyJoe wrote:I found this for connverting the SDL_Surface into OpenGL textures:
http://content.gpwiki.org/index.php/SDL ... ith_OpenGL
Hope it helps
I would recommend something pre-built, because this is only for loading .bmp images. And you would need to write a lot of those 'converters' to accept the other image formats.
DevIL or SOIL are some neat libraries that you can use to easily load up any image format you so desire. At least do this in the beginning, so it's not that hard of a switch from SDL to OpenGL.

Re: SDL and OpenGL game, what still to use in SDL.

Posted: Mon Apr 09, 2012 10:28 am
by YourNerdyJoe
superLED wrote:
YourNerdyJoe wrote:I found this for connverting the SDL_Surface into OpenGL textures:
http://content.gpwiki.org/index.php/SDL ... ith_OpenGL
Hope it helps
I would recommend something pre-built, because this is only for loading .bmp images. And you would need to write a lot of those 'converters' to accept the other image formats.
DevIL or SOIL are some neat libraries that you can use to easily load up any image format you so desire. At least do this in the beginning, so it's not that hard of a switch from SDL to OpenGL.
If you replace SDL_LoadBMP with IMG_Load and it works for everything supported by SDL_image.
It works nice when it's put in function like

Code: Select all

GLuint LoadTexture(const char* fn)
whick I think is much simpler than using another library.

Re: SDL and OpenGL game, what still to use in SDL.

Posted: Mon Apr 09, 2012 1:16 pm
by superLED
YourNerdyJoe wrote:
superLED wrote:
YourNerdyJoe wrote:I found this for connverting the SDL_Surface into OpenGL textures:
http://content.gpwiki.org/index.php/SDL ... ith_OpenGL
Hope it helps
I would recommend something pre-built, because this is only for loading .bmp images. And you would need to write a lot of those 'converters' to accept the other image formats.
DevIL or SOIL are some neat libraries that you can use to easily load up any image format you so desire. At least do this in the beginning, so it's not that hard of a switch from SDL to OpenGL.
If you replace SDL_LoadBMP with IMG_Load and it works for everything supported by SDL_image.
It works nice when it's put in function like

Code: Select all

GLuint LoadTexture(const char* fn)
whick I think is much simpler than using another library.
Yes, but different formats need to be read differently. You can't read and load a .png file the same way you would do with a .jpg file.
If you are working with different people, then you must tell them to only use one single format. Or if you get some images from the web, you'd have to convert them into the target format.

SDL_image supports a lot of formats, but the way the function you linked to works, is to read in the pixels from the file the way .png/.bmp is set up.

Re: SDL and OpenGL game, what still to use in SDL.

Posted: Sat Apr 28, 2012 8:46 pm
by saluege
wow. is gyrovorbis still working on this game? haven't been on this forum for prob a few years : |.
Anyways it really depends on what platform you want to develop for. If you are interested in cross platform capabilities, then you use sdl to handle everything except graphics which opengl handles. But if you are developing for windows and would like your application to be a bit more efficient(also depends on how good you are as a programmer) then use pure windows.h to do sdl's job. Now some may say this is reinventing the wheel and as such a waste of time, but in my opinion is the better option because you can code classes to handle input,window e.t.c without the extra stuff found in sdl. Anyhow it all depends on what your aim is.

Re: SDL and OpenGL game, what still to use in SDL.

Posted: Tue May 01, 2012 12:50 pm
by THe Floating Brain
saluege wrote:wow. is gyrovorbis still working on this game? haven't been on this forum for prob a few years : |.
Anyways it really depends on what platform you want to develop for. If you are interested in cross platform capabilities, then you use sdl to handle everything except graphics which opengl handles. But if you are developing for windows and would like your application to be a bit more efficient(also depends on how good you are as a programmer) then use pure windows.h to do sdl's job. Now some may say this is reinventing the wheel and as such a waste of time, but in my opinion is the better option because you can code classes to handle input,window e.t.c without the extra stuff found in sdl. Anyhow it all depends on what your aim is.
+1

Additionally Qt, has very nice glut compatible image loading classes and functions that you can use to apply textures: http://www.digitalfanatics.org/projects ... ter14.html (look around the bottom of chapter 6).

Re: SDL and OpenGL game, what still to use in SDL.

Posted: Wed May 02, 2012 8:22 am
by Falco Girgis
saluege wrote:wow. is gyrovorbis still working on this game? haven't been on this forum for prob a few years : |.
Anyways it really depends on what platform you want to develop for. If you are interested in cross platform capabilities, then you use sdl to handle everything except graphics which opengl handles. But if you are developing for windows and would like your application to be a bit more efficient(also depends on how good you are as a programmer) then use pure windows.h to do sdl's job. Now some may say this is reinventing the wheel and as such a waste of time, but in my opinion is the better option because you can code classes to handle input,window e.t.c without the extra stuff found in sdl. Anyhow it all depends on what your aim is.
Get your ass with the program. Check out our new shit on Youtube. ;)
THe Floating Brain wrote:
saluege wrote:wow. is gyrovorbis still working on this game? haven't been on this forum for prob a few years : |.
Anyways it really depends on what platform you want to develop for. If you are interested in cross platform capabilities, then you use sdl to handle everything except graphics which opengl handles. But if you are developing for windows and would like your application to be a bit more efficient(also depends on how good you are as a programmer) then use pure windows.h to do sdl's job. Now some may say this is reinventing the wheel and as such a waste of time, but in my opinion is the better option because you can code classes to handle input,window e.t.c without the extra stuff found in sdl. Anyhow it all depends on what your aim is.
+1

Additionally Qt, has very nice glut compatible image loading classes and functions that you can use to apply textures: http://www.digitalfanatics.org/projects ... ter14.html (look around the bottom of chapter 6).
I really wouldn't recommend all of QT's overhead for a video game. It is a fantastic framework for PC tools, but it isn't meant to be used for game development like that.