-
OpenGL/GLUT in Dev C++
I'm just trying to get a simple program up and running using openGl but I'm having a hard time figuring it out. As I understand it, openGl comes with windows right? I downloaded the glut package from update menu in dev c++. I tried running this hello world source from wikibooks but I get linker errors like "undefined reference to 'glutInit'.
Code:
#include <gl/gl.h>
#include <gl/glut.h>
#include <gl/glu.h>
int main(int argc, char *argv[])
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
glutInitWindowSize(800,600);
glutCreateWindow("Hello World");
glutMainLoop();
return 0;
}
Thanks for any help.
-
You have to link with the GL and GLUT libraries as well. On Dev-C++ you can "add these commands to the linker command line" under compiler options, or if you have a project you can set up the libraries in project options. In fact if you had chosen OpenGL project from the list in Dev-C++ in the first place they'd already be there.
-
Thanks alot. I didn't even realize those options existed, I just always started with a blank source.
-
You may want to try video tutorials rock.com for tutorials as the formerly suggested ones at nehe are getting to be even more outdated (GLUT itself is old) and do not meet my standards.
You can check out gamedev.net to get more information on openGL and glut.