Problemas para compilar el codigo
MI programa es:
#pragma comment( lib, "opengl32.lib")
#pragma comment( lib, "glut32.lib")
#pragma comment( lib, "glu32.lib")
#include <windows.h> /* MS Windows requiere que este header se incluya antes de gl.h y glu.h */
#include <GL/glut.h> /* glut.h garantiza que gl.h y glu.h se incluyan */
#include <stdio.h> /* Ya que muchas aplicaciones en OpenGL hacen uso de C, es común incluir estos headers */
#include <stdlib.h>
int sol = 0, tierra = 0, luna = 0,n=0;
void init(void)
{
glClearColor (0.0, 0.0, 0.0, 0.0);
}
void display(void)
{
glClear (GL_COLOR_BUFFER_BIT);
glColor3f (1.0, 1.0, 1.0);
glPushMatrix();
glutWireSphere(.8, 20, 16); /* Sol */
glRotatef ((GLfloat) sol, 0.0, 1.0, 0.0);
glTranslatef (1.5, 0.0, 0.0);
glRotatef ((GLfloat) tierra, 0.0, 1.0, 0.0);
glColor3f (0.0, 0.0, 1.0);
glutWireSphere(0.3, 10, 8); /* Planeta */
glRotatef ((GLfloat) luna, 0.0, 1.0, 0.0);
glTranslatef (1.0, 0.0, 0.0);
glColor3f (0.0, 0.5, 0.5);
glutWireSphere(0.1, 10, 8); /* Luna */
glPopMatrix();
glutSwapBuffers();
}
void Idle(void)
{
sol = sol + 1;
tierra = tierra + 1;
luna = luna + 0.5;
glClear (GL_COLOR_BUFFER_BIT);
glColor3f (1.0, 1.0, 1.0);
glPushMatrix();
glPushMatrix();
glRotatef(n=n+1,0.00,1.0,0.0);
glColor3f(1,1,0);
glutSolidSphere(.8, 20, 16); /* Sol */
glPopMatrix();
glRotatef ((GLfloat) sol, 0.0, 1.0, 0.0);
glTranslatef (1.5, 0.0, 0.0);
glRotatef ((GLfloat) tierra, 0.0, 1.0, 0.0);
glColor3f (0.0, 0.0, 1.0);
glutWireSphere(0.3, 10, 8); /* Planeta */
glRotatef ((GLfloat) luna, 0.0, 1.0, 0.0);
glTranslatef (1.0, 0.0, 0.0);
glColor3f (0.0, 0.5, 0.5);
glutWireSphere(0.1, 10, 8); /* Luna */
glPopMatrix();
glutSwapBuffers();
}
void reshape (int w, int h)
{
glViewport (0, 0, (GLsizei) w, (GLsizei) h);
glMatrixMode (GL_PROJECTION);
glLoadIdentity ();
gluPerspective(60.0, (GLfloat) w/(GLfloat) h, 1.0, 20.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt (0.0, 0.0, 5.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);
}
void keyboard (unsigned char key, int x, int y)
{
switch (key) {
case \'d\':
tierra = (tierra + 10) % 360;
glutPostRedisplay();
break;
case \'D\':
tierra = (tierra - 10) % 360;
glutPostRedisplay();
break;
case \'y\':
sol = (sol + 5) % 360;
glutPostRedisplay();
break;
case \'Y\':
sol = (sol - 5) % 360;
glutPostRedisplay();
break;
case \'m\':
luna = (luna + 5) % 360;
glutPostRedisplay();
break;
case \'M\':
luna = (luna - 5) % 360;
glutPostRedisplay();
break;
case 27:
exit(0);
break;
default:
break;
}
}
int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB);
glutInitWindowSize (500, 500);
glutInitWindowPosition (100, 100);
glutCreateWindow ("Planetas");
init ();
glutDisplayFunc(display);
glutReshapeFunc(reshape);
glutKeyboardFunc(keyboard);
glutIdleFunc(Idle);
glutMainLoop();
return 0;
}
Y siempre me dice que no encuentra opengl.dl
Estoy desesperado algien me puede decir el problema que tengo como solucionarlo.
#pragma comment( lib, "opengl32.lib")
#pragma comment( lib, "glut32.lib")
#pragma comment( lib, "glu32.lib")
#include <windows.h> /* MS Windows requiere que este header se incluya antes de gl.h y glu.h */
#include <GL/glut.h> /* glut.h garantiza que gl.h y glu.h se incluyan */
#include <stdio.h> /* Ya que muchas aplicaciones en OpenGL hacen uso de C, es común incluir estos headers */
#include <stdlib.h>
int sol = 0, tierra = 0, luna = 0,n=0;
void init(void)
{
glClearColor (0.0, 0.0, 0.0, 0.0);
}
void display(void)
{
glClear (GL_COLOR_BUFFER_BIT);
glColor3f (1.0, 1.0, 1.0);
glPushMatrix();
glutWireSphere(.8, 20, 16); /* Sol */
glRotatef ((GLfloat) sol, 0.0, 1.0, 0.0);
glTranslatef (1.5, 0.0, 0.0);
glRotatef ((GLfloat) tierra, 0.0, 1.0, 0.0);
glColor3f (0.0, 0.0, 1.0);
glutWireSphere(0.3, 10, 8); /* Planeta */
glRotatef ((GLfloat) luna, 0.0, 1.0, 0.0);
glTranslatef (1.0, 0.0, 0.0);
glColor3f (0.0, 0.5, 0.5);
glutWireSphere(0.1, 10, 8); /* Luna */
glPopMatrix();
glutSwapBuffers();
}
void Idle(void)
{
sol = sol + 1;
tierra = tierra + 1;
luna = luna + 0.5;
glClear (GL_COLOR_BUFFER_BIT);
glColor3f (1.0, 1.0, 1.0);
glPushMatrix();
glPushMatrix();
glRotatef(n=n+1,0.00,1.0,0.0);
glColor3f(1,1,0);
glutSolidSphere(.8, 20, 16); /* Sol */
glPopMatrix();
glRotatef ((GLfloat) sol, 0.0, 1.0, 0.0);
glTranslatef (1.5, 0.0, 0.0);
glRotatef ((GLfloat) tierra, 0.0, 1.0, 0.0);
glColor3f (0.0, 0.0, 1.0);
glutWireSphere(0.3, 10, 8); /* Planeta */
glRotatef ((GLfloat) luna, 0.0, 1.0, 0.0);
glTranslatef (1.0, 0.0, 0.0);
glColor3f (0.0, 0.5, 0.5);
glutWireSphere(0.1, 10, 8); /* Luna */
glPopMatrix();
glutSwapBuffers();
}
void reshape (int w, int h)
{
glViewport (0, 0, (GLsizei) w, (GLsizei) h);
glMatrixMode (GL_PROJECTION);
glLoadIdentity ();
gluPerspective(60.0, (GLfloat) w/(GLfloat) h, 1.0, 20.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt (0.0, 0.0, 5.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);
}
void keyboard (unsigned char key, int x, int y)
{
switch (key) {
case \'d\':
tierra = (tierra + 10) % 360;
glutPostRedisplay();
break;
case \'D\':
tierra = (tierra - 10) % 360;
glutPostRedisplay();
break;
case \'y\':
sol = (sol + 5) % 360;
glutPostRedisplay();
break;
case \'Y\':
sol = (sol - 5) % 360;
glutPostRedisplay();
break;
case \'m\':
luna = (luna + 5) % 360;
glutPostRedisplay();
break;
case \'M\':
luna = (luna - 5) % 360;
glutPostRedisplay();
break;
case 27:
exit(0);
break;
default:
break;
}
}
int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB);
glutInitWindowSize (500, 500);
glutInitWindowPosition (100, 100);
glutCreateWindow ("Planetas");
init ();
glutDisplayFunc(display);
glutReshapeFunc(reshape);
glutKeyboardFunc(keyboard);
glutIdleFunc(Idle);
glutMainLoop();
return 0;
}
Y siempre me dice que no encuentra opengl.dl
Estoy desesperado algien me puede decir el problema que tengo como solucionarlo.