Sign in to follow this  
polarboy

What are my options? (Using SDL+OpenGL)

Recommended Posts

Hi, guys, I've been lurking around gamedev and trying to get an engine running for a while now. But I went through different trials until I came to this point: I need help. I've decided to stick with SDL for a 2D (maybe isometric) project, while reading more on gamedev, I decided to go with SDL+openGL for that extra special effects (especially lighting) from OpenGL However, as I started changing my tileviewer to openGL, I realized that putpixel no longer works (I can tell by having a cout before and after my putpixel statement) I'm using a custom format for my tilesets Reading info bit by bit to get colour codes, so I have to use pixel manipulation so my question is: What are some of the other options I have? I'm trying not to use a a big picture file(ie. png, bmp, gif etc) for tiling as I find it hard to draw each tile in a 64 * 32 (or 32* 32...or any fixed dimension for that matter), I mean...we have to be very precise on the size or the map will look retarded, no? Saving each tile to a different file is not an option, I mean...that's gonna be a pain for map format, wouldn't it Right now, I'm thinking that using a big picture with all the tiles in it could be a viable option...but how would you edit the tiles in it tho...wouldn't it be a pain in the ass to select JUST one tile and move it to the EXACT position? Anyways, that's all for now, thank you very much [Edited by - polarboy on July 26, 2008 6:57:49 PM]

Share this post


Link to post
Share on other sites
If you're going to use OpenGL look into reading some tutorials about opengl specifically. NeHe is where a lot of people learn from, although an equally large number of people seem to hate it. There are even some SDL version of each tutorial way down at the bottom of each tutorial page.

The basic idea when using opengl with sdl is that sdl manipulation of the surface no longer works. You can't just write to the SDL_Surface pixels value anymore. All drawing must be done with opengl calls. This can introduce slightly more complexity when dealing only with 2d graphics, although it is a very good approach once you understand it.

First tutorial that actually draws anything is lesson 2, clicky

Share this post


Link to post
Share on other sites
Quote:
Original post by DaedalusOwnsYou
If you're going to use OpenGL look into reading some tutorials about opengl specifically. NeHe is where a lot of people learn from, although an equally large number of people seem to hate it. There are even some SDL version of each tutorial way down at the bottom of each tutorial page.

The basic idea when using opengl with sdl is that sdl manipulation of the surface no longer works. You can't just write to the SDL_Surface pixels value anymore. All drawing must be done with opengl calls. This can introduce slightly more complexity when dealing only with 2d graphics, although it is a very good approach once you understand it.

First tutorial that actually draws anything is lesson 2, clicky


thank you for your advice

I looked at Nehe's actually, but I didn't find too many information regarding 2D graphics, but I'm gonna take a look at it again

Hehe, thanks, now I'm back on track again


[Edited by - polarboy on July 27, 2008 6:09:48 PM]

Share this post


Link to post
Share on other sites
Quote:
I looked at Nehe's actually, but I didn't find too many information regarding 2D graphics, but I'm gonna take a look at it again


Actually, it's hidden under the basecode section on the nehe main page, but there's a <ahref="http://nehe.gamedev.net/counter.asp?file=files/basecode/nehegl_sdl.zip">nehe basecode for SDL/Opengl which has a great example of how to draw images and polygons together on the screen.





Share this post


Link to post
Share on other sites
Quote:
I looked at Nehe's actually, but I didn't find too many information regarding 2D graphics, but I'm gonna take a look at it again


Actually, it's hidden under the basecode section on the nehe main page, but there's a nehe basecode for SDL/Opengl which shows a great example of how to draw images and polygons together on the screen.

get it here:
http://nehe.gamedev.net/counter.asp?file=files/basecode/nehegl_sdl.zip

Share this post


Link to post
Share on other sites
From what I understand with sdl it is an either or sort of thing. You can use sdl's 2d stuff or you can use opengl but not both at the same time. You need to look at either using polys with your 2d stuff drawn on them as textures or you need to look at the 2d stuff in opengl it has it's own glDrawPixels that should get you started.

Share this post


Link to post
Share on other sites
Quote:
Original post by stonemetal
From what I understand with sdl it is an either or sort of thing. You can use sdl's 2d stuff or you can use opengl but not both at the same time. You need to look at either using polys with your 2d stuff drawn on them as textures or you need to look at the 2d stuff in opengl it has it's own glDrawPixels that should get you started.


Thank you so much, that's just what I needed

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this