OpenGL

I recently have been trying to figure out how to get OpenGL working on Dev-C++. I downloaded the glut3.7.6 dev pack and got that working on Dev-C++ (I think).

So I was looking for tutorials on OpenGL and found this one: http://www.youtube.com/watch?v=TH_hA_Sru6Q

I tried to follow the glut installation things but couldn't figure out where to put them in Dev... That's why I installed the glut3.7.6 dev pack...

I tried compiling this source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// A Simple OpenGL Project
// Author: Michael Hall
//
// This C++ code and project are provided "as is" without warranty of any kind.
//
// Copyright 2010 XoaX - For personal use only, not for distribution
#include <gl/glut.h>

void Draw()
{
	glClear(GL_COLOR_BUFFER_BIT);
	glColor3f(1.0, 1.0, 1.0);
	glBegin(GL_LINES);
		glVertex3f(0.25, 0.25, 0.0);
		glVertex3f(0.75, 0.75, 0.0);
	glEnd();
	glFlush();
}

void Initialize()
{
	glClearColor(0.0, 0.0, 0.0, 0.0);
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
}

int main(int iArgc, char** cppArgv)
{
	glutInit(&iArgc, cppArgv);
	glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
	glutInitWindowSize(250, 250);
	glutInitWindowPosition(200, 200);
	glutCreateWindow("XoaX.net");
	Initialize();
	glutDisplayFunc(Draw);
	glutMainLoop();
	return 0;
}


Except the compiler won't run due to the whole bunch of linker errors.

Can anyone point me to source code I can get to see how OpenGl works... Or point me to the right way on how to get OpenGL working on Dev-C++ if I did it wrong...

I'm a beginner to these things...... You'll probably have to walk me through step by step
Last edited on
If you created a Project then go to Project Options, Parameters and at the Linker area be sure the GLut library is added.

Edit: also when you start a new project in Dev-C++ you'll find an OpenGL Project template at the Multimedia section. It does not use GLut.
Last edited on
I have no idea what the GLut library is... Like I said before, really new to these things...
GLut is there to simplify OpenGL for you. Meaning that you don't necessarily have to use it.

Anyway, all .lib files are stored in your C:\Dev-Cpp\lib\ folder. If you installed the GLut devpack correctly you should have a file libglut32.a in there?

Edit:
Also a "glut" Project template should appear in the Multimedia section when you start a new Project.
Last edited on
YES FINALLY!!!

Thank you so much, didn't see the Multimedia section before, but I've got it now. THANKS SO MUCH!!!
Glad you got it to work; though I wouldn't use GLut myself.

Anyway check this out: http://nehe.gamedev.net/
The OpenGL tutorials are on the left.
OpenGL game downloads are on the right (they often come with source code).
Topic archived. No new replies allowed.