View Full Version : What should i install for C++/opengl programming
wannaBeHacker
January 8th, 2007, 08:53 AM
Hey can someone please tell me what packages i need to install to be able to program in c++ and in opengl.
i used to use eclipse.
And i want to do this all through the terminal, so please help me to do this through the terminal thank you!
tzulberti
January 8th, 2007, 09:08 AM
For C++ programming you should install:
build-essential
manpages-dev (man pages about C++)
hod139
January 8th, 2007, 09:37 AM
For OpenGL you want libgl1-mesa-dev and you probably also want libglu1-mesa-dev (for the glu* commands).
wannaBeHacker
January 8th, 2007, 10:27 AM
thanks, but im really a super noob
how do i install the packages again?
sudo apt-get build-essential?
dlai
January 8th, 2007, 11:12 AM
sudo apt-get install <package-name>
You can also use synaptic, which is the graphical interface for installing packages... It is in System->Administration->Synaptic Package Manager, if you are using Ubuntu. If you are using Kubuntu use Adept, I think it is in System Services (or something like that),
If you need any other help just say so... I've been doing quite a lot of SDL/OpenGL programming in ubuntu.
Wybiral
January 8th, 2007, 05:19 PM
You will probably want to install SDL, it's a library that offers things like initializing the window, catching events (mouse/keyboard/window close) and some other stuff. It will be under libsdl in synaptic, I think you need "libsdl1.2debian" and "libsdl1.2-dev" you may also want "libsdl-image1.2-dev" which is a library that makes loading textures a LOT easier.
Another option, as opposed to SDL, is GLUT. It's a little more restrictive than SDL, but it's smaller and most people find it easier to use. I believe the packages are "freeglut3" and "freeglut3-dev"
These are things you'll need to install AFTER mesa because OpenGL doesn't initialize itself, you need a library like one of these to do it. Both of these are cross platform too.
Best of luck!
You might be interested in...
http://ubuntu-gamedev.wikispaces.com/ (A couple of OpenGL examples with SDL)
http://www.lighthouse3d.com/opengl/glut/ (Thorough explanation of GLUT)
http://nehe.gamedev.net/ (has Linux+SDL and glut downloads, with makefiles to compile)
http://p13.wikispaces.com/Cpp (A couple of examples I've written)
Cesa
February 28th, 2007, 05:45 AM
Hi, I'm trying to get OpenGL programming going, using Eclipse and glut. However, it doesn't work, I am using aaindex from the red book (http://opengl.org/resources/code/samples/redbook/) as a test, I include:
#include <stdlib.h>
#include <stdio.h>
#include <GL/glew.h>
#include <GL/glut.h>
but get errors like:
../main.cpp:140: undefined reference to `glutPostRedisplay'
../main.cpp:122: undefined reference to `glLoadIdentity'
../main.cpp:125: undefined reference to `gluOrtho2D'
I get an error for each call to any gl, glu or glut function. I added the option -lglut for g++ (I let Eclipse handle compiling, linking etc., but I read somewhere the -lglut option was necessary)
Note that the -h files are all found, no warnings there.
What am I missing?
runningwithscissors
February 28th, 2007, 05:50 AM
I get an error for each call to any gl, glu or glut function. I added the option -lglut for g++ (I let Eclipse handle compiling, linking etc., but I read somewhere the -lglut option was necessary)
Note that the -h files are all found, no warnings there.
What am I missing?
Linker not finding the glut library. If there is a way, check the exact command Eclipse CDT is using to compile your program, or compile on the command line with
$ gcc <program.c> -o <binary> -lglut
and see.
Cesa
February 28th, 2007, 05:57 AM
Right now I feel really stupid, I simply added "-lglut" in the wrong place...
Though now that that works, I get another error:
freeglut (/media/D/MyDocuments/Exjobb/GPUtest/Debug/GPUTest): ERROR: Internal error <Visual with necessary capabilities not found> in function fgOpenWindow
X Error of failed request: BadWindow (invalid Window parameter)
Major opcode of failed request: 4 (X_DestroyWindow)
Resource id in failed request: 0x0
Serial number of failed request: 14
Current serial number in output stream: 17
:???:
I'll search for solutions, as well as trying a different example, but meanwhile if someone has a suggestion, shoot.
runningwithscissors
February 28th, 2007, 06:01 AM
Right now I feel really stupid, I simply added "-lglut" in the wrong place...
Though now that that works, I get another error:
freeglut (/media/D/MyDocuments/Exjobb/GPUtest/Debug/GPUTest): ERROR: Internal error <Visual with necessary capabilities not found> in function fgOpenWindow
X Error of failed request: BadWindow (invalid Window parameter)
Major opcode of failed request: 4 (X_DestroyWindow)
Resource id in failed request: 0x0
Serial number of failed request: 14
Current serial number in output stream: 17
:???:
I'll search for solutions, as well as trying a different example, but meanwhile if someone has a suggestions, shoot.
It could be due to your X server not supporting the glX extensions. Do you have the glx module loaded and are you using a display driver (and card) that supports OpenGL?
Cesa
February 28th, 2007, 06:11 AM
It could be due to your X server not supporting the glX extensions. Do you have the glx module loaded and are you using a display driver (and card) that supports OpenGL?
I have a nvidia Quadro FX 3450/4000 card with nvidias driver installed. I'm new to Ubuntu (and Linux), so I'm not sure how to know if a glx module is loaded or not. In the nvidia X server settings program there is a section called OpenGL/GLX information that says: "Direct Rendering: Yes", if that's what you mean.
runningwithscissors
February 28th, 2007, 06:24 AM
In the nvidia X server settings program there is a section called OpenGL/GLX information that says: "Direct Rendering: Yes", if that's what you mean.
Then you're all right.
What parameters are you passing to glutInitDisplayMode?
Cesa
February 28th, 2007, 06:26 AM
Then you're all right.
What parameters are you passing to glutInitDisplayMode?
GLUT_SINGLE | GLUT_INDEX
The program fails at glutCreateWindow (might be obvious from the error I guess)
Ok, I tried changing GLUT_INDEX to GLUT_RGBA, and than the program runs, still not sure what the problem is though.
Cesa
February 28th, 2007, 06:48 AM
Ok, anyway, all I wanted to do was to get OpenGL running, which it does now, I don't need that specific example to work. The difference between GLUT_INDEX and GLUT_RGBA is something I just have to read up on, and if I need index I will deal with that problem then.
Thanks for your help.
vBulletin® v3.8.4, Copyright ©2000-2012, Jelsoft Enterprises Ltd.