Jump to content

Welcome to Geeks to Go - Register now for FREE

Need help with your computer or device? Want to learn new tech skills? You're in the right place!
Geeks to Go is a friendly community of tech experts who can solve any problem you have. Just create a free account and post your question. Our volunteers will reply quickly and guide you through the steps. Don't let tech troubles stop you. Join Geeks to Go now and get the support you need!

How it Works Create Account
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