Sdl&opengl

can you advise books on sdl&opengl (not only either) ??
i have ,focus on sdl, but theres no much about opengl in it…

Then you just need an OpenGL book/resource. The wonderful thing
about the two is that you just need to get the opengl context (using
SDL), and then it’s like normal any-other-day opengl. For best
results on OpenGL, I think basically everyone (including myself)
recommends http://nehe.gamedev.net as the number one online tutorial
resource site. Also, basically all of the tutorials have Linux/SDL
(which means any platform/SDL, for the most part) versions of the
source code available for download, so you will likely find any
applicable SDL code in there for free.

I’m sorry I don’t have the names of any books which deal with SDL and
OpenGL specifically, but I’ve not needed any books thus far, and I
used the SDL tutorials and the NeHe tutorials almost exclusively in
the beginning. :slight_smile:

Good luck,
– ScottOn 2007/05/31, at 12:33, engin wrote:

can you advise books on sdl&opengl (not only either) ??
i have ,focus on sdl, but theres no much about opengl in it…


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

http://delphigl.com/ is a good (german) resource, too.
They have lots of tutorials and a really extensive reference.
And despite the name, it is not only useful if you are coding in Delphi and
several users in their forums don’t code Delphi, either.

–Dennis
-------------- next part --------------
A non-text attachment was scrubbed…
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20070531/02a4a024/attachment.pgpAm Donnerstag, 31. Mai 2007 schrieb Scott Harper:

Then you just need an OpenGL book/resource. The wonderful thing
about the two is that you just need to get the opengl context (using
SDL), and then it’s like normal any-other-day opengl. For best
results on OpenGL, I think basically everyone (including myself)
recommends http://nehe.gamedev.net as the number one online tutorial
resource site. Also, basically all of the tutorials have Linux/SDL
(which means any platform/SDL, for the most part) versions of the
source code available for download, so you will likely find any
applicable SDL code in there for free.

I’m sorry I don’t have the names of any books which deal with SDL and
OpenGL specifically, but I’ve not needed any books thus far, and I
used the SDL tutorials and the NeHe tutorials almost exclusively in
the beginning. :slight_smile:

OpenGL Distilled is a nice, affordable and down-to-earth OpenGL
reference book. It doesn’t cover a lot of stuff, but it’s by the same
author as the almghty redbook, so you know it’s stuff you can trust. I
wouldn’t say it’s the best book to learn about OpenGL though.

Book website: http://www.opengldistilled.com/On 5/31/07, engin wrote:

can you advise books on sdl&opengl (not only either) ??
i have ,focus on sdl, but theres no much about opengl in it…

  • SR

2007/5/31, Dennis Schridde :

Then you just need an OpenGL book/resource. The wonderful thing
about the two is that you just need to get the opengl context (using
SDL), and then it’s like normal any-other-day opengl. For best
results on OpenGL, I think basically everyone (including myself)
recommends http://nehe.gamedev.net as the number one online tutorial
resource site. Also, basically all of the tutorials have Linux/SDL
(which means any platform/SDL, for the most part) versions of the
source code available for download, so you will likely find any
applicable SDL code in there for free.

I’m sorry I don’t have the names of any books which deal with SDL and
OpenGL specifically, but I’ve not needed any books thus far, and I
used the SDL tutorials and the NeHe tutorials almost exclusively in
the beginning. :slight_smile:
http://delphigl.com/ is a good (german) resource, too.
They have lots of tutorials and a really extensive reference.
And despite the name, it is not only useful if you are coding in Delphi and
several users in their forums don’t code Delphi, either.

Also, the OpenGL redbook is a good reference:
http://www.opengl.org/documentation/red_book/

[ ]'s
Farrer> Am Donnerstag, 31. Mai 2007 schrieb Scott Harper:

–Dennis


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

thanks to all but ,
i already have some knowledge and experience on opengl…I just want to
integrate it with sdl,and get rid of glut.As a problem for me,how to
upload a sdl surface as a texture for opengl?

to scott harper::in which part(forum,articles…) of the nehe can i find
sdl&opengl context??

thanks to all but ,
i already have some knowledge and experience on opengl…I just want to
integrate it with sdl,and get rid of glut.As a problem for me,how to
upload a sdl surface as a texture for opengl?

to scott harper::in which part(forum,articles…) of the nehe can i
find
sdl&opengl context??

If you go to any of the tutorials/articles and scroll to the very
bottom, they have a long list of files to download the source code in
various formats. For instance, with the second tutorial, they have
listings for Java, Jedi-SDL, Linux/GLX, Linux/SDL, MacOS X/Cocoa (one
of my favorites), as well as a score of others. The Linux/SDL is
likely to be what you’re wanting.

I also found on the SDL website (the Articles section) a nifty
article by Bob Pendleton (one of the great names of this list an
another I frequent) on OpenGL within SDL here:

http://www.linuxdevcenter.com/pub/a/linux/2003/10/23/sdl_anim.html

If you’re on a Mac (like I), you could use this link:

http://www.meandmark.com/sdlopenglpart1.html

(And if you’re not, I bet you could still find the information you
need, just by taking the parts that look at all familiar or have SDL
in them and ignoring whatever else seems weird, 'cause it’s probably
the Mac-specific stuff, though there’s little of it in that tutorial.)

Lastly (and likely the most useful), we have an example from the SDL
Docs Wiki for a generic OpenGL/SDL setup, which looks to draw
something subdivided… Triangles or some such. :slight_smile:

http://www.libsdl.org/cgi/docwiki.cgi/OpenGL_20Full_20Example

Good luck, and let me know if you have any more problems!

– ScottOn 2007/05/31, at 18:01, engin wrote:

Hi all,
I decided to pick up on SDL again and this time gave OpenGL a try.
If i create a new project in XCode i get the standard example with the
fishies.
If i rename it from main.c to main.cpp however i get:

main.cpp:62: error: invalid conversion from 'int' to 'SDL_GLattr'
main.cpp:62: error:   initializing argument 1 of 'int 

SDL_GL_GetAttribute(SDL_GLattr, int*)'
on
SDL_GL_GetAttribute (attr[i], &value);

if i explicitly cast attr[i] to a SDL_GLattr or i define the attr array
as an array of SDL_GLattr instead of int, i get:

ZeroLink: unknown symbol '__Z13Atlantis_Initv'
SolverOpenGL has exited due to signal 6 (SIGABRT).

when ran.

This is where my knowledge ends…
Any ideas?

ps. i like to work in cpp mainly because the rest of the project i am
trying to get a visualisation on is allready in cpp…

Regards,
Ellert van Koperen.

What is the content of attr array? I’m not expert but I think you need to
pass a valid SDL_GLattr.

typedef enum {
SDL_GL_RED_SIZE,
SDL_GL_GREEN_SIZE,
SDL_GL_BLUE_SIZE,
SDL_GL_ALPHA_SIZE,
SDL_GL_BUFFER_SIZE,
SDL_GL_DOUBLEBUFFER,
SDL_GL_DEPTH_SIZE,
SDL_GL_STENCIL_SIZE,
SDL_GL_ACCUM_RED_SIZE,
SDL_GL_ACCUM_GREEN_SIZE,
SDL_GL_ACCUM_BLUE_SIZE,
SDL_GL_ACCUM_ALPHA_SIZE,
SDL_GL_STEREO,
SDL_GL_MULTISAMPLEBUFFERS,
SDL_GL_MULTISAMPLESAMPLES,
SDL_GL_ACCELERATED_VISUAL,
SDL_GL_SWAP_CONTROL
} SDL_GLattr;

I don’t think you can just put any interger value there. But like I said
I’m not expert so I may be wrong.On Fri, Jun 20, 2008 at 10:00 AM, ellert van koperen wrote:

Hi all,
I decided to pick up on SDL again and this time gave OpenGL a try.
If i create a new project in XCode i get the standard example with the
fishies.
If i rename it from main.c to main.cpp however i get:

main.cpp:62: error: invalid conversion from ‘int’ to 'SDL_GLattr’
main.cpp:62: error: initializing argument 1 of 'int
SDL_GL_GetAttribute(SDL_GLattr, int*)'
on
SDL_GL_GetAttribute (attr[i], &value);

if i explicitly cast attr[i] to a SDL_GLattr or i define the attr array as
an array of SDL_GLattr instead of int, i get:

ZeroLink: unknown symbol '__Z13Atlantis_Initv’
SolverOpenGL has exited due to signal 6 (SIGABRT).
when ran.

This is where my knowledge ends…
Any ideas?

ps. i like to work in cpp mainly because the rest of the project i am
trying to get a visualisation on is allready in cpp…

Regards,
Ellert van Koperen.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Rogelio Nodal

main.cpp:62: error: invalid conversion from ‘int’ to 'SDL_GLattr’
main.cpp:62: error: initializing argument 1 of 'int
SDL_GL_GetAttribute(SDL_GLattr, int*)'
on
SDL_GL_GetAttribute (attr[i], &value);

Your fix of casting or (preferably) changing the type of the attr[]
array to SDL_GLattr is correct. In C, enums are just a fancy way of
saying “int”, everything converts from any enum/int to any enum/int
with nary a warning (in C, you can pass SDLK_RETURN to
SDL_GL_GetAttribute, not in C++, because, well, that wouldn’t make any
sense).

ZeroLink: unknown symbol '__Z13Atlantis_Initv’
SolverOpenGL has exited due to signal 6 (SIGABRT).
when ran.

It’s looking for a function called Atlantis_Init, but it cannot find
it. The reason is most likely because the file that contains it is
still in C (C++ symbols are encoded with their type, hence the “__Z13"
and the “v” at the end). There are two options. You could leave that
file in C, and put the content of its header in an ‘extern “C”’. Look
at SDL_video.h (or any SDL header, really), you’ll see a bit that says
#ifdef __cplusplus", both at the beginning and the end, this is what
you need.

The other option, is, of course, to change the file to be C++.

ps. i like to work in cpp mainly because the rest of the project i am trying
to get a visualisation on is allready in cpp…

As a bonus, you also get better warnings. :wink:

Note that you do not strictly need to convert your whole project. You
could make a C wrapper for the C++ stuff, making sure there is only C
stuff in the header file, wrapping it with ‘extern “C”’, and then keep
all the C++ in that single file.

But even if you do not use C++ classes, templates or any other
features, my personal opinion
(http://advogato.org/person/pphaneuf/diary/334.html) is that just the
extra warnings/errors and strictness is good for your code.On Fri, Jun 20, 2008 at 10:00 AM, ellert van koperen wrote:


http://pphaneuf.livejournal.com/

I don’t think you can just put any interger value there. But like I said
I’m not expert so I may be wrong.

In C, anywhere you see an enum parameter, you can put any int, or any
other enum, this is not even a warning.On Fri, Jun 20, 2008 at 11:18 AM, Rogelio Nodal wrote:


http://pphaneuf.livejournal.com/

Thanks for the correction. That error message of the compiler making a
distinction between SDL_GLattr and int really through me off. Thanks.On Fri, Jun 20, 2008 at 11:27 AM, Pierre Phaneuf wrote:

On Fri, Jun 20, 2008 at 11:18 AM, Rogelio Nodal <@Rogelio_Nodal> wrote:

I don’t think you can just put any interger value there. But like I
said
I’m not expert so I may be wrong.

In C, anywhere you see an enum parameter, you can put any int, or any
other enum, this is not even a warning.


http://pphaneuf.livejournal.com/


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Rogelio Nodal

Pierre Phaneuf wrote:

The reason is most likely because the file that contains it is
still in C (C++ symbols are encoded with their type, hence the "__Z13"
and the “v” at the end).

Aw ofcourse!. now i feel like a noob, which in a way i am, not having
had my hands on any proper programming for years.
Thanks for the proper correction.

ps. i like to work in cpp mainly because the rest of the project i am trying
to get a visualisation on is allready in cpp…

As a bonus, you also get better warnings. :wink:

And new + delete :slight_smile:

Note that you do not strictly need to convert your whole project. You
could make a C wrapper for the C++ stuff, making sure there is only C
stuff in the header file, wrapping it with ‘extern “C”’, and then keep
all the C++ in that single file.

But even if you do not use C++ classes, templates or any other
features, my personal opinion
(http://advogato.org/person/pphaneuf/diary/334.html) is that just the
extra warnings/errors and strictness is good for your code.

Ill keep that in mind :slight_smile:

As a side note, is there a group effort for better / more readable
documentation ?
I would like to use these experiences i am ‘going through’ to help
others not making the same mistakes or having to ask these trivial
things on the mailinglist :slight_smile:

Regards,
Ellert van Koperen.> On Fri, Jun 20, 2008 at 10:00 AM, ellert van koperen <@ellert_van_koperen> wrote:

Aw ofcourse!. now i feel like a noob, which in a way i am, not having had my
hands on any proper programming for years.

Mixing C and C++ and details of the working of the compiler aren’t
exactly presented on the first days of a C++ programming class either.
:wink:

As a side note, is there a group effort for better / more readable
documentation ?
I would like to use these experiences i am ‘going through’ to help others
not making the same mistakes or having to ask these trivial things on the
mailinglist :slight_smile:

For SDL or C/C++? For SDL, I find that the documentation wiki is
pretty nice. For C/C++, you probably on your own, though… I like
http://cppreference.com/ and http://www.parashift.com/c++-faq-lite/
for various C++ issues, but that’s pretty much that I have in mind at
the moment…

I do feel that it’s not really the place of SDL to document C or C++, though.On Sat, Jun 21, 2008 at 5:11 AM, ellert van koperen wrote:


http://pphaneuf.livejournal.com/

As a side note, is there a group effort for better / more readable
documentation ?

By the way, the command I used to unmangle the symbol name is c++filt.
Also, you will find that
http://www.parashift.com/c++-faq-lite/mixing-c-and-cpp.html describes
in more detail how to mix C and C++.On Sat, Jun 21, 2008 at 5:11 AM, ellert van koperen wrote:


http://pphaneuf.livejournal.com/

As a side note, is there a group effort for better / more readable
documentation ?

By the way, the command I used to unmangle the symbol name is c++filt.
Also, you will find that
http://www.parashift.com/c++-faq-lite/mixing-c-and-cpp.html describes
in more detail how to mix C and C++.

Speaking of which, I find stlfilt to be priceless:

http://www.bdsoft.com/tools/stlfilt.html

-CrystalOn Sat, 21 Jun 2008, Pierre Phaneuf wrote:

On Sat, Jun 21, 2008 at 5:11 AM, ellert van koperen wrote:

ellert van koperen wrote:

Hi all,
I decided to pick up on SDL again and this time gave OpenGL a try.
If i create a new project in XCode i get the standard example with the
fishies.
If i rename it from main.c to main.cpp however i get:

main.cpp:62: error: invalid conversion from ‘int’ to 'SDL_GLattr’
main.cpp:62: error: initializing argument 1 of 'int
SDL_GL_GetAttribute(SDL_GLattr, int*)'
on
SDL_GL_GetAttribute (attr[i], &value);

if i explicitly cast attr[i] to a SDL_GLattr or i define the attr array
as an array of SDL_GLattr instead of int, i get:

In C++, you should be using SDL_GLattr(i) to index into an enumerated type.

If I understand what you’ve done, it would also make the array unnecessary.

Eddy