views:

281

answers:

4

I have a specific problem.
I am starting learning OpenGL and I am not sure, how to set it up on (Ubuntu) Linux.

I think that this could be a way: ========================================================================
OpenGL is only a graphics language "specification" (or "interface") and to properly use it I have to download some library (for the specific OS) that "implements" the OpenGL specification.
After long searching and from multiple sources I found that the "Mesa 3D Graphics Library" would be the best for me.
I also found the "SDL" (Simple DirectMedia Layer) library but it seems to be a library for "all other" things beside graphics (e.g. GUI, sound, keyboard and mouse input, ...). I need "ONLY" a "graphics" library, so that it will implement the OpenGL specification.

As a "graphical user interface" I use "gtkmm" library and I am "very satisfied" with it so far, so I would like to "connect" gtkmm with OpenGL - for that I found an extension to gtkmm library called "gtkglextmm" by means of which I should be able to "draw" the OpenGL animation to a window (or "DrawingArea" in gtkmm jargon) in GUI (but I have not tried it yet so I hope it will work :-) ).

And the last problem is the "cross compilation" from Linux to Windows (with "MinGW" cross compiler). So far, I have successfully cross compiled (from Linux to Windows) all my work done with gtkmm library.
When I combine it with OpenGL, won't it be any problem to cross compile it (e.g. do I need to link something special when compiling with "gcc" compiler, or should I distribute some "Windows" OpenGL library with my application?) ? ========================================================================

I would be very pleased I you confirmed that I am in the right direction or turned me in the "right direction" that I could done something easier or better way.

Thanks in advance.

A: 

I'm not of much help in the Linux realm. And I'm behind the times when it comes to OpenGL. However, it looks like NeHe has a new set of tutorials where they're putting together some nice base code.

As they say on the site:

When writing the new tutorials we have several goals:

  • Write using a clean, simple and consistent coding standard
  • Write using modern C++
  • Remain totally cross-platform (that is OpenGL's strength after all)
  • Inspire people to submit their own lessons based on our basecode

So I'd highly recommend at least giving their code a try. NeHe has a long standing tradition of creating some very nice tutorials.

Steve Wortham
+1  A: 

It should all just work out of the box given the right packages.

That said, here is the relevant chunk of the Build-Depends: used to build the rgl package (which provides on OpenGL device for R) on Debian. As Ubuntu uses the same settings for their build of the package, you should really bet set:

libgl1-mesa-dev | libgl-dev, libglu1-mesa-dev | libglu-dev, \
libpng12-dev, libx11-dev, libxt-dev, x11proto-core-dev

The | means alternative, so you can use the mesa-based packages or ones matching your graphics card (like the various nvidia-* packages).

Just grab some OpenGPl examples from somewhere and try it.

Dirk Eddelbuettel
A: 

You are going right direction. I used Eclipse CDT+ SDL + openGL for developing my app under Ubuntu Linux (I used this tutorial for setup: http://www.ferdychristant.com/blog/articles/DOMM-72MPPE) and then successfully compiled my app under Windows with Dev C++

Maciek Sawicki
+2  A: 

To some extent its graphics card dependent, the proprietary driver packs include their own libGL.so and also include the libGL.la (to link against the .so) and any relevant header files.

  • Nvidia - OpenGL libraries and headers are included in the proprietary driver package.
  • ATi FGLRX - OpenGL libraries and headers are included in the proprietary driver package.
  • Open Source Drivers - OpenGL libraries and headers are provided as a part of Mesa. Depending on your distribution you may need to install the *-devel packages to get the headers and linkable libraries you'll need.

If you're using an Intel or Matrox card, or you're running an ATi card with the rage, radeon or radeonhd driver you're using the Open Source drivers.

GLUT will be the shortest path to a working program. Otherwise you'll need to write the code to create the OpenGL context (OS specific) yourself.

If you're still having issues, let us know more about whats not working for you.

EDIT Here's some sample commands/code that might be relevant or useful.

GCC Compiling:

gcc -lGL glprogram.c -o glprogram

Includes:

#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glut.h>
Adam Luchjenbroers
ashishsony
and i suspect that v3.2 isn't supported by mesa yet??
ashishsony
The headers are always installed to a common path. And yes, Mesa are still working towards OpenGL 3.x support (there's some issues around the S3 Texture Compression extension and most open source drivers are still developing the required functionality).
Adam Luchjenbroers