[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: SDL (was: Re: SVGALIB on Thinkpad)

On Tue, 14 May 2002, Chris Purnell wrote:

> I've also tried to program using SDL.  The initial learning curve seems
> to be very steep.  Worse than OpenGL or even Athena Widgets.  I gave up
> in the end and used something else (I think it was X lib).

An example (640x480x8 window):
surface = SDL_SetVideoMode(640, 480, 8,
if (surface == NULL) {
     fprintf(stderr, "SDL SetVideoMode failed: %s\n", SDL_GetError());


<insert code here that finds the desired X visual>
win = XCreateWindow(dpy, root, 0, 0, 640, 480, 0, CopyFromParent,
      InputOutput, vi->visual, mask, &attr);
if (win == None) {
	/* error handling */
<insert lots of code to deal with VidMode>

Steven Fuller

PS. I too learned Xlib before SDL.

And I had similiar linking problems with SDL programs.  I would always
have to add -L/usr/X11R6/lib -lX11 -lXext to Makefiles to get SDL programs
to link.  Months later, I decided to fix it; the problem was that
/etc/ld.so.conf was only readable by root.   Try adding "-v -Wl,-t"
(or look at http://www.icculus.org/~relnev/GLtest.tar.gz) to the gcc command
when linking, and see where it fails.  "readelf -a" is also very useful.