Jump to content

Welcome to Geeks to Go - Register now for FREE

Geeks To Go is a helpful hub, where thousands of volunteer geeks quickly serve friendly answers and support. Check out the forums and get free advice from the experts. Register now to gain access to all of our features, it's FREE and only takes one minute. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more.

Create Account How it Works
Photo

Trouble getting started with OpenGL in XP


  • Please log in to reply

#1
magnus80a

magnus80a

    Member

  • Member
  • PipPip
  • 10 posts
Hi, I'm trying to set up OpenGL on my XP box and I can't seem to include the right files. I've downloaded the packages from opengl.org, but is having problem setting them up. As a start I've tried compiling Sierpinki's Gasket algorithm, but I get these error messages: (How do I fix the errors?)

Warning 2: File not found opengl32.lib
Warning 2: File not found glu32.lib
Warning 2: File not found glut32.lib
.
.
.
*errors following from the first three messages*
.
.
.


This is the code:
#include <GL/glut.h>
void myinit();
void display();

int main(int argc, char **argv) {
	glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);
	glutInitWindowSize(500,500);
	glutInitWindowPosition(0,0);
	glutCreateWindow("Simple OpenGL Example");
	glutDisplayFunc(display);
	myinit();
	glutMainLoop();
	
	return 0;
}

void myinit(void) {
	/* Attributes */	
	glClearColor(1.0, 1.0, 1.0, 1.0);							   // White
	glColor3f(1.0, 0.0, 0.0);									   // Red
	
	/* Set up viewing */
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	gluOrtho2D(0.0, 500.0, 0.0, 500.0);
	glMatrixMode(GL_MODELVIEW);
}

void display(void) {
	typedef GLfloat point2[2];									  // Define a point data type
	
	point2 vertices[3]={{0.0, 0.0}, {250.0, 500.0}, {500.0, 0.0}};  // Triangle
	
	int i, j , k;
	int rand();
	point2 p={75.0,75.0};										   // Arbitrary point inside the triangle
	glClear(GL_COLOR_BUFFER_BIT);								   // Clear the window
	
	/* Compute and output 5000 new points */
	for (k=0;k<5000;k++) {
		j = rand()%3;											   // Pick a random vertex
		
		/* Compute halfway between vertex and old point */
		p[0]=(p[0]+vertices[j][0])/2.0;
		p[1]=(p[1]+vertices[j][1])/2.0;
		
		/* Plot point */
		glBegin(GL_POINTS);
			glVertex2fv(p);
		glEnd();
	}   
}

  • 0

Advertisements


#2
khayyam

khayyam

    New Member

  • Member
  • Pip
  • 5 posts
you need to copy the quoted lib's in the lib directory of your compiler.

Edited by khayyam, 23 December 2005 - 10:00 PM.

  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP