Paul Surgeon on Thu, 05 Jun 2003 23:49:53 +0200 (SAST)


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

[Linux dev] Re: Return types


You can find more than enough info on programming OpenGL under Linux on the 
Internet.
I wrote a basic terrain rendering app with the info I found on the Net.

First decide what language you want to code in.
C or C++ is a good choice.
I chose C++ since I like the whole object concept and it keeps code clean and 
tidy. I will not accept global variables ... they end up causing spagetti 
code and debugging becomes a pain.

Second decide what utility libraries you want to use.
GLUT is one popular library that makes setting up OpenGL contexts much easier 
and contains a lot of utility functions to make graphics programming easier.

However I suggest you take a look at SDL/libSDL.  http://www.libsdl.org
It is a cross-platform multimedia library designed to provide level access to 
audio, keyboard, mouse, joystick, 3D hardware via OpenGL, and 2D video 
framebuffer.
In a way it is the DirectX of the open source world and Loki used SDL when 
they ported games to Linux.
All the OpenGL programming is still done as OpenGL but SDL handles the 
graphics contexts for you. Setting up a basic SDL app with OpenGL support is 
about 20-30 lines of code at the most.
It runs on just about anything from mainframes to PDAs and has bindings to 
Ada, Eiffel, Java, Lua, ML, Perl, PHP, Pike, Python, and Ruby.

GLX is a library used on Unix OpenGL implementations to manage interaction 
with the X Window System and to encode OpenGL onto the X protocol stream for 
remote rendering. This is great for remote rendering but it a pain to use if 
you only want an OpenGL rendering context.

There are also Plib and Xlib but I don't suggest Xlib since it's a nightmare 
to setup contexts in (http://tronche.com/gui/x/xlib-tutorial) and SDL does 
all that nonsense in the background for you with just a few calls.
Plib is similar to libSDL but I haven't played with it yet.

GLU is an OpenGL utility library. It has functions for creating texture 
mipmaps from a base image, mapping coordinates between screen and object 
space, drawing quadric surfaces and NURBS and functions that help in the  
manipulation of the OpenGL matrices.
It is normally installed along with OpenGL so it's not an issue.

One of the best Web sites with OpenGL tutorials is http://nehe.gamedev.net/
Most of the tutorials have been ported to SDL or GLUT for Linux so you can 
just download and compile. You may have to tweak the Makefiles or create 
symbolic links to libraries depending on your system setup.

If you get stuck on an OpenGL issue then the forums at http://www.opengl.org 
are a great place to ask questions. Questions such as multitexturing, GL 
display lists, vertex arrays, graphics algorithms, etc.


Good books on OpenGL :
There are not many books on programming OpenGL under LInux and there don't 
need to be. Once you have OpenGL set up and running then it really doesn't 
matter what book you get because an OpenGL call is the same on any platform 
using a common language like C or C++.

1. Addison Wesley - OpenGL Programming Guide, 2nd Edition.pdf
(There may be a 3rd ed) It is know as the "Red Book". The "Blue Book" is the 
first edition if I'm not mistaken. Anyway they are the "authoritive guides" 
to OpenGL programming.

2. Advanced Graphics Programming Techniques using OpenGL.

3. OpenGL Super Bible. (Based on GLUT and Windows NT but has some basic 
generic OpenGL stuff for a newbies like how to draws primitives and shading 
and lighting, etc)


If you need help setting up an SDL/OpenGL app just yell and I'll send some of 
my C/C++ code your way. The tricky part for me what getting the G++ complier 
and linker to find all the includes and libraries.

Have fun!
Paul


On Thursday, 5 June 2003 09:03, Mario de Sousa wrote:
> I was just curious as to if it was possible. Does anyone know of a good
> OpenGL manual that is linux bias? All the manuals I have are directed
> more a windows programmers. Thanks.
>
> Mario de Sousa
> UCS Johannesburg

---
To unsubscribe: send the line "unsubscribe dev" in the subject of a
mail to dev-request@xxxxxxxxxxxxx Problems: dev-admins@xxxxxxxxxxxx
Archives at http://www.linux.org.za/Lists-Archives/