Sign in to follow this  
madsravn

OpenGL OpenGL run error

Recommended Posts

I have a problem with an OpenGL application I built. It works just fine on my pc, but when other users (non-developers) try to run it, it gives them a error and quit. The error, they say, is something about some "program configuration" and that they ought to re-install. Could anyone help me? I use MS VC++ 2005 Express with the following code:
#include <iostream>
#include<GL/glut.h>
#pragma(lib,"glut32.lib")
using namespace std;

float angle = 0.0;
float factor = 0.0;
float diff = 0.010;

void changeSize(int w, int h) {

	if(h == 0)
		h = 1;

	float ratio = 1.0* w / h;

	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	
	
    glViewport(0, 0, w, h);

	
	gluPerspective(45,ratio,1,1000);
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
	gluLookAt(0.0,0.0,10.0, 
		      0.0,0.0,-1.0,
			  0.0f,1.0f,0.0f);


}

void processNormalKeys(unsigned char key, int x, int y) {

	if (key == 27) 
		exit(0);
}


void renderScene(void) {
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	if (factor>4)
			diff=-0.010;
	if (factor<1)
			diff=0.010;			
	glPushMatrix();
	glRotatef(angle,0.0,1.0,0.0);
	glBegin(GL_TRIANGLES);
		glColor3f(0.0f,1.0f,0.0f);
		glVertex3f(factor*(-0.5),factor*(-0.5),0.0);
		glVertex3f(factor*(0.5),0.0,0.0);
		glVertex3f(0.0,factor*(0.5),0.0);
	glEnd();
	glPopMatrix();
	angle++;
	factor+=diff;
	glutSwapBuffers();
}

void main(int argc, char **argv) {
	glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA);
	glutInitWindowPosition(100,100);
	glutInitWindowSize(320,320);
	glutCreateWindow("Mads er nice ;)");
	glutDisplayFunc(renderScene);
	glutIdleFunc(renderScene);
	glutReshapeFunc(changeSize);
	glutKeyboardFunc(processNormalKeys);
	glutMainLoop();
}

which gives me one warning : "main.cpp(3) : warning C4081: expected 'identifier'; found '(' "... Can anyone tell me what to a little noob like me can do to get this working... I have tried to throw glut32.dll and opengl32.dll in the same folder as the program when rar'ing it so people could use it. What to do ? :'( (and hmm, how do you make a code-box in here?) - madsravn

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this