Jump to content
  • Advertisement
Sign in to follow this  
madsravn

OpenGL OpenGL run error

This topic is 4127 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
At the top of your code, it should be:

#pragma comment(lib, "glut32.lib")

you are missing "comment" keyword.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!