0

Hi all I'm learning to use OpenGL but im having trouble with my compiler I'm using CodeBlocks but i keep getting the gl/glaux.h: No such file or directory and a couple of error: syntax error before "xxx"

I don't know if I need to install any OpenGL stuff as I understand it it should be on windows already.

Any help will be greatly appreciated,
Thanks

4
Contributors
9
Replies
11
Views
7 Years
Discussion Span
Last Post by LauraWelch
0

Windows has "stuff" for running programs using OpenGL. It does not have anything on it for creating software with OpenGL. I tried out codeblocks but I didnt like it, so I switched to using dev-c++. You should do this to. This is because it has a package manager, where you choose what libraries you want to download and it installs them in the right place for you. Ask if you need any help!

0

Okay yeah I changed to Microsoft Visual Express 2010 but one thing I found is they changed how you add directories and now have to add directories to each project instead of a global directories... Anyway now on VC++ im getting some identifier not found errors like it cannot find either initRendering nor drawscene I'll paste the code so you can take a look

#include <iostream>
#include <stdafx.h>
#include <stdlib.h>
#include "targetver.h"
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
#include <stdlib.h>
#include <GL/glut.h>

using namespace std;


void handleKeypress(unsigned char key, 
	                 int x, int y) {
						 switch (key){
						 case 27: // ESC KEY
							 exit(0); 
						 }
}

void initRenderind() {

	glEnable(GL_DEPTH_TEST);
}

void handleResize(int w, int h) {
	
	glViewport(0, 0, w, h);

	glMatrixMode(GL_PROJECTION); 
	
    glLoadIdentity(); 
	gluPerspective(45.0,                  
		(double)w/ (double)h,
		1.0,                      
		200.0);                     
}

void drawscene() {
	
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	glMatrixMode(GL_MODELVIEW); 
	glLoadIdentity(); 

	glBegin(GL_QUADS); 

	
	glVertex3f(-0.7f,-1.5f,-5.0f);
	glVertex3f(0.7f,1.5f,5.0f);
	glVertex3f(0.4f,-0.5f,-5.0f);
	glVertex3f(-0.4f,-0.5f,-5.0f);

	glEnd(); 

	glutSwapBuffers(); 
}

	int main(int argc, char** argv) {
		//initialize GLUT
		glutInit (&argc, argv);
		glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
		glutInitWindowSize(400,400); 

		
		glutCreateWindow("Quads");
		initRendering(); 

		glutDisplayFunc(drawScene);
		glutKeyboardFunc(handleKeypress);
		glutReshapeFunc(handleResize);

		glutMainLoop();
return 0;//ill never reach this line
	}

I put all the includes i found in the header file in my main cpp file... also i just started learning this and i wonder why use a header file instead of calling everything in the main file?

thanks

0

Erm...VC++ 2010 is good, but it's not dev-c++. Anyway I don't know much about OpenGL, just what's in my above post. Oh...this should be in the C++ forum BTW

0

Expora, your issues are due to typos. You're passing "drawScene" to the glDisplayFunc function, but your function is named "drawscene". The "initRendering" function called in main is defined as "initRenderind".

Sometimes it just helps to have someone else glance at it =)

Also, about your choice of compiler, just use whatever works for you, rather than what someone says you should use because it's their preference. No offense, Sgt, but people should use what they feel comfortable with.

0

OK soda...it's just easier for installing other packages...you can use many compilers, not just one ;)

0

Yeah I got it working thanks. Also noticed I really need to learn c++ first before entering into the 3d realm so im doing that I'm getting the hang of if statements, variables, loops, functions in c++ really fun!! and thanks for the replies. After I'm confident in c++ i'll prolly start learning OPenGL again.

0

Thanks for sharing with us. I am going to tell you a truth that I don't know about this.

Votes + Comments
dirty rotten spammer
And another truth.. No one cares about your spam and your SEO 'technique' is outdated.
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.