Results 1 to 10 of 15
I've attempted to embark on the task of learning how to use openGL with C/C++ on Linux Fedora 10, but have run into a major fallback: I cannot find any ...
- 04-10-2009 #1Just Joined!
- Join Date
- Apr 2009
- Posts
- 26
[SOLVED] C/C++ OpenGL Help
I've attempted to embark on the task of learning how to use openGL with C/C++ on Linux Fedora 10, but have run into a major fallback: I cannot find any decent sites that truly show me how to get started with learning it.
I am asking someone to help me learn the beginnings of OpenGL, at least how to run a simple OpenGL program in C/C++, since I already know most of basics in C and C++ I could find some understandable (to me) tutorials about how to use it (include files, libraries, etc.).
If there are any necessary libraries that I need to have downloaded and installed, I *MIGHT* have installed them but I might not have. Just to be sure, if you could include what I need to get started with OpenGL, i would greatly appreciate it.
Thanks in advance.
- 04-10-2009 #2
Hello atrx,
first of all, there are two complementary books that everybody who tackles OpenGL has to read. The "Red" and "Blue" book, which can be found in older editions as for free as ebooks.
OpenGL Reference Manual
OpenGL Programming Guide : Table of Contents
If you have a bigger library near you, try to get them as hardcopy in a more recent version. You will want to have them under your pillow anyway.
Then there is a famous series of tutorials, called
NeHe Productions: Main Page
Lastly, it is helpful to know the archive of extension documentation
for advanced topics
OpenGL® Registry
and in later stages (but not at the start) it is good to know
http://www.opengl.org/documentation/...glx/glx1.4.pdfDebian GNU/Linux -- You know you want it.
- 04-10-2009 #3Just Joined!
- Join Date
- Apr 2009
- Posts
- 26
Thanks, but...
Thanks for all the tutorials. Those will be very useful. However, one problem remains: the include files. I am running Fedora 10, using gedit, and downloaded a few OpenGL libraries a while back. However, I don't know what the include files are. If someone could please tell me what the necessary include files are, and where to download them, I would appreciate it.
- 04-11-2009 #4
The include file for basic OpenGL is <GL/gl.h>
Then you will need the proper implementation dependent files and extension header where applicable.
For example, I use X11 and GLX, so I include <X11/Xlib.h> and <GL/glx.h>.
Others use GLUT, so they need <GL/glut.h>
Some useful helpers can be found in the GLU, <GL/glu.h>.
The developer of the libraries on GNU/Linux systems is the Mesa project.
Mesa Home Page
But you will most certainly not want to get it directly from them because it wouldn't be customized to your distribution. The distributor usually does a better job at this so you will look in the package manager of Fedore for a package named "OpenGL dev(elopment)" or similar.Debian GNU/Linux -- You know you want it.
- 04-11-2009 #5Just Joined!
- Join Date
- Apr 2009
- Posts
- 26
Thanks again, but still another issue...
I downloaded all the glut include files and libraries, and have been using those tutorials, and others for GLUT. I am trying to run the basic openGL GLUT code that i got from it, to make a simple window. However, I am getting an error:
Code:
#include <GL/glut.h>
int main(int argc,char **argv)
{
glutInit(&argc,argv);
glutInitWindowPosition(100,100);
glutInitWindowSize(800,600);
glutInitDisplayMode(GLUT_DEPTH | GLUT_SINGLE | GLUT_RGBA);
glutCreateWindow("Window");
}
Error after using command "g++ OpenGL.c" in terminal (OpenGL.c being the exact file name):
/tmp/ccKZOaJF.o: In function `main':
OpenGL.c:(.text+0x1c): undefined reference to `glutInit'
OpenGL.c:(.text+0x30): undefined reference to `glutInitWindowPosition'
OpenGL.c:(.text+0x44): undefined reference to `glutInitWindowSize'
OpenGL.c:(.text+0x50): undefined reference to `glutInitDisplayMode'
OpenGL.c:(.text+0x5c): undefined reference to `glutCreateWindow'
collect2: ld returned 1 exit status
I was exploring the include files under /Usr/Include and found the .h files for freeglut and made sure that GL/glut.h existed, and it did. I noticed that it had some include files inside it. I followed these to freeglut_std.h and eventually came upon a few more include files. One of these was windows.h. It was nowhere to be found on my computer. I googled it, and am pretty sure it is a windows file for visual C/C++. I am running Fedora 10 and using C++ with the g++ compiler. I dont know if this is an issue or not, or has anything to do with the error, but it could, so I would appreciate any help anyone has to give. The code for the program is as follows:
- 04-11-2009 #6
This error isn't due to missing include files.
It comes from the linker stage. You will need to tell the linker what libraries to link against.
I use the "-lGL" option. For glut you may need "-lGLUT" or similar.Debian GNU/Linux -- You know you want it.
- 04-11-2009 #7Just Joined!
- Join Date
- Apr 2009
- Posts
- 26
Okay thanks but can you please tell me how to do that? I'm not sure what the linker stage is.
- 04-11-2009 #8
The linker stage is the last stage in producing an executable. All previously compiled parts of the project are mold together. Your code and the OpenGL code are mated, so to speak.
Link Options - Using the GNU Compiler Collection (GCC)Debian GNU/Linux -- You know you want it.
- 04-11-2009 #9Just Joined!
- Join Date
- Apr 2009
- Posts
- 26
- 04-11-2009 #10
No, it's a command line option.

g++ test.c -o test -IglutDebian GNU/Linux -- You know you want it.



