Which package is the right one?

Hi,
i am a real beginner to opengl. But i am familiar with C and C++.

I am using Ubuntu 9.04, and i wondered which package i need to get the OpenGL libs and headers?
I have a new intel on board graphic chip. I think intel series 4 or something like that.

Is libgl1 or libgl1-mesa the right one?

There are so much packages, what is the “dev” standing for? And do i need the dri packages too?

By the way another question: Is it possible to use OpenGL together with Trolltechs Qt? How complicated is it to use OGL with X11? Or should i use glut?

My first aim is to create a very simple but 3D strategy game.

Greetings, Rain

In a general sense :

  1. the -dev packages are needed for development, as the name implies : header (.h), static libraries, …
  2. the non-dev are for running programs already compiled with 1). They provides dynamic libraries, configuration, sometimes data (such as icons etc).
  3. the -dev packages depend on non-dev, so :
  • on a fresh system, installing only non-dev will allow running programs, but not compiling from source.
  • on a fresh system, installing only -dev will also installl non-dev, and allow both compiling and running.

By default you should already have Gl libs, in stalled by non-dev packages. But you need the -dev versions.
Check the installed packages named libgl*, and get the -dev versions with same name.

You have to know that installing GL dev package is fairly independent of installing GL hardware optimized drivers. Both should be done though.

If your already know very well your Qt, you can go with it for GL.
Otherwise, get freeglut(-dev) and use glut, as it is very simple and a lot of tutorial use it. Later when you feel more confident, it will be easy to move on something that allow lower level windowing management.

By default you should already have Gl libs, in stalled by non-dev packages.

They should be in /usr/include/GL or not?

But i dont have packages installed. I’ve read in the internet, that i should install the libgl1-mesa-dev package.
If there is no GL lib installed at the moment, which one should a use?

Thank you for your great answere.

GL include files should be off of /usr/include/GL.
GL libraries should be off of /usr/lib64 or /usr/lib32 (or /usr/lib) for 64-bit and 32-bit libs.

If there is no GL lib installed at the moment, which one should a use?

What graphics card do you have?

And it would help to establish what level you’re at. Do you know C/C++? Is that how you plan to use OpenGL?

And yes you can use OpenGL and Qt together.

Just to see what state your system is w.r.t. OpenGL, paste this into a file called glut_test.cxx:


#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glut.h>

void reshape(int width, int height)
{
  glViewport(0, 0, width, height);
}

void display()
{
  glClear(GL_COLOR_BUFFER_BIT);
  glutSwapBuffers();
}

int main (int argc, char** argv)
{
  glutInit(&argc, argv);
  glutInitDisplayMode( GLUT_RGBA | GLUT_DOUBLE | GLUT_MULTISAMPLE);
  glutCreateWindow(argv[0]);

  glutDisplayFunc(display);
  glutReshapeFunc(reshape);
  
  glutReshapeWindow(400,400);

  printf("GL_RENDERER = %s
",glGetString(GL_RENDERER));

  glClearColor(0,0,0,0);

  //glutMainLoop();
  return 0;
}

and then compile/link with:

g++ -o glut_test glut_test.cxx -lglut

You my have some compile or link errors, but that’ll at least tell you/us what you’re missing.