PDA

View Full Version : SDL + OpenGL 3.2?



chronozphere
10-04-2010, 11:09 PM
Hey Guys

Is it possible/easy to use (jedi) SDL with OpenGL 3.2 in Delphi and Lazarus? I'm considering this because it would give me a complete cross-platform sollution without having to bother with different windows etc.. :)

I thought I'd better ask this before investing a lot of time in a SDL + GL3 project.

Thanks.

phibermon
10-04-2010, 11:39 PM
with the context created in SDL i've been using the DGL OpenGL 3.2 (http://www.delphigl.com/) header translation, however I'm currently using gl2 style. I think I remember reading that SDL 1.3 added support for opengl 3 contexts (or somthing like that) but the jedi-sdl headers are not up to date.

http://www.opengl.org/wiki/Tutorial1:_Creating_a_Cross_Platform_OpenGL_3.2_Co ntext_in_SDL_%28C_/_SDL%29

taking a quick look at this C sdl opengl 3.2 context example, I see a few sdl calls not present in jedi-sdl:

SDL_GL_SetSwapInterval()
SDL_GL_CreateContext()


it's probably the CreateContext() that sets the important stuff, it should be trivial to append this to the jedi-sdl header, then you should be good with the DGL opengl 3.2 header with a true 3.2 context.

I believe that because new versions of SDL are backwards compatible (and thus don't remove or change aready implemented funcs, I think..) it should be safe to just add these missing decelerations and update the SDL dll/.so whatever to v1.3

I'll test tomorrow, hopefully I'm not mistaken about the backwards compatibility.

someone needs to get the headers up to date, but sourceforge jedi-sdl looks like it's dead.

phibermon
10-04-2010, 11:52 PM
ahh crap, sdl 1.3 is still living in SVN :( anyone using your code on posix systems are going to have to compile sdl from svn atm

WILL
11-04-2010, 02:03 AM
I can't say for SDL + GL3.0, BUT I can say for sure that SDL + GL 2.0 go well together. In fact I know first hand that JEDI-SDL contains the OpenGL headers.

Not sure what state the SDL API is at with GL3/4 compatibility, but I can't see why it wouldn't be able to work with it. What do you want to do that requires GL3 anyhow? Some effect or scripting features?

Oh and did you know that OpenGL 4.0 was out already? http://www.opengl.org/

chronozphere
11-04-2010, 06:33 AM
Thanks. ;)

@Fhibermon: Nice tutorial page. I'm gonna read that. :)

@WILL: Yes I know about GL 4.0. I was reading the specs the other day. Unfortunately there are no drivers yet. Also It'll take some time before we have updated headers for pascal.

Maybe I should contact Dom as he maintains the jediSDL source (AFAIK). I'd really like to get this working.

Brainer
11-04-2010, 08:03 AM
@WILL: Yes I know about GL 4.0. I was reading the specs the other day. Unfortunately there are no drivers yet. Also It'll take some time before we have updated headers for pascal.

There may be no drivers yet, but headers are updated already. :) Grab 'em here (http://files.delphigl.com/new/dglOpenGL.zip).

WILL
12-04-2010, 01:55 AM
Ah good old DelphiGL.com? Love those Germans. ;)

Yeah get in touch with Dom if you can. JEDI-SDL hasn't had an update in a while maybe it has a new version of SDL to include.

Stoney
12-04-2010, 02:52 AM
I've began to create SDL 1.3 bindings for Pascal, initially made for iPhone/iTouch/iPad, but I guess they should work on other platforms as well. It's still Pre-Alpha/Alpha, but if you are interested in trying them out, send me a PM. :)

chronozphere
17-04-2010, 10:39 AM
Hey guys,

I'd like to get something working this weekend. The problem is that I don't have a clue where to start.

This is how initialization should be done for OpenGL 3.2:

http://www.opengl.org/wiki/Tutorial1:_Creating_a_Cross_Platform_OpenGL_3.2_Co ntext_in_SDL_%28C_/_SDL%29

It seems like I need SDL 1.3 which is not officially released yet. This means I have to compile the libraries myself for different platforms. This is not something I see myself doing quickly, as I'm always struggling to get compilers working (especially on other platforms). :(

Would it be possible to use SDL 1.2 with OpenGL 3.2?

phibermon
24-05-2010, 06:51 PM
Well the other option would be to create the SDL window without a GL context and then write your own platform specifics for GL3 Context Creation and attach it to the window.

then you get to keep SDL for most other things.

in fact, why not just translate the following into pascal? :

http://old.nabble.com/OpenGL-3.0-Context-Creation-td22645797.html

that's a discussion of a patch that allows for the new style contexts to be created, there's a windows implementation and an X11 implementation to get you started.

you'll need a few other functions but then you'll be sailing. :)

phibermon
24-05-2010, 06:59 PM
In fact, what am I thinking? just download the latest SVN for SDL 1.3 and implement the needed functions in pascal. Then you'd have all the fun of 1.3 while using the widespread 1.2.


Shouldn't take too long, it's probably mostly platform specific API calls with the odd SDL classic thrown in for good measure. Not too many C busy routines