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

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

Post Reply
User avatar
jakobnator
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 20
Joined: Thu Mar 31, 2011 8:14 pm
Current Project: Black Jack
Favorite Gaming Platforms: N64,DC,PC,360
Programming Language of Choice: C++0x
Location: (n): A particle place in physical space.

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

Post 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.
Image

Current Games:
Black Jack [WIP]
Tic Tac Toe [SDL]
Tic Tac Toe
qpHalcy0n
Respected Programmer
Respected Programmer
Posts: 387
Joined: Fri Dec 19, 2008 3:33 pm
Location: Dallas
Contact:

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

Post 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.
User avatar
YourNerdyJoe
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 79
Joined: Sun Oct 02, 2011 3:28 pm
Current Project: Top secret (not really) Top-Down Shooter for GBA
Favorite Gaming Platforms: GBA, Gamecube, PC, 3DS
Programming Language of Choice: C/C++
Contact:

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

Post 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
See that?.....
Exactly
https://yournerdyjoe.github.io/
User avatar
superLED
Chaos Rift Junior
Chaos Rift Junior
Posts: 303
Joined: Sun Nov 21, 2010 10:56 am
Current Project: Engine
Favorite Gaming Platforms: N64
Programming Language of Choice: C++, PHP
Location: Norway

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

Post 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.
User avatar
YourNerdyJoe
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 79
Joined: Sun Oct 02, 2011 3:28 pm
Current Project: Top secret (not really) Top-Down Shooter for GBA
Favorite Gaming Platforms: GBA, Gamecube, PC, 3DS
Programming Language of Choice: C/C++
Contact:

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

Post 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.
See that?.....
Exactly
https://yournerdyjoe.github.io/
User avatar
superLED
Chaos Rift Junior
Chaos Rift Junior
Posts: 303
Joined: Sun Nov 21, 2010 10:56 am
Current Project: Engine
Favorite Gaming Platforms: N64
Programming Language of Choice: C++, PHP
Location: Norway

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

Post 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.
saluege
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 9
Joined: Wed May 12, 2010 8:32 am
Current Project: TwelveSky2 Hacks
Favorite Gaming Platforms: PC,PS3
Programming Language of Choice: c#
Contact:

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

Post 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.
User avatar
THe Floating Brain
Chaos Rift Junior
Chaos Rift Junior
Posts: 284
Joined: Tue Dec 28, 2010 7:22 pm
Current Project: RTS possible Third Person shooter engine.
Favorite Gaming Platforms: PC, Wii, Xbox 360, GAME CUBE!!!!!!!!!!!!!!!!!!!!!!
Programming Language of Choice: C/C++, Python 3, C#
Location: U.S

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

Post 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).
"Why did we say we were going to say we were going to change the world tomorrow yesterday? Maybe you can." - Myself

ImageImage
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

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

Post 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.
Post Reply