Ver Mensaje Individual
  #1 (permalink)  
Antiguo 18/02/2014, 22:02
leamsi007
 
Fecha de Ingreso: noviembre-2013
Mensajes: 8
Antigüedad: 10 años, 5 meses
Puntos: 0
Errores en ejercicio OpenGL C++

Hola a todos miren he echo este ejercicio de C++ con OpenGL y no logro solucionar estos 8 errores de los cuales 6 se repiten.
Utilizo "Visual Studios Express 2008 C++".

Aquí os dejo el código:


#include <windows.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glut.h>

void init (void)
{
glClearColor(0.0, 0.0, 0.0, 0.0);
glEnable(GL_DEPTH_TEST);
glShadeModel(GL_FLAT);
glMatrixMode(GL_MODELVIEW);
gluLookAt(3, 2, 3, 0, 0, 0, 0, 1, 0);
}

void redimensionar(int ancho, int alto)
{
glViewport (0.0, (GLint)ancho, (Glint)alto);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(35,((float)ancho/alto), 0.1, 1000);
}

void dibujar(void)
{
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);

//---PRIMERA CARA----
glBegin(GL_POLYGON)
glColor3f(1.0, 0.0, 0.0);
glVertex3f(0, 0, 1);
glVertex3f(1, 0, 1);
glVertex3f(1, 1, 1);
glVertex3f(0, 1, 1);
glEnd();

//--SEGUNDA CARA---
glBegin(GL_POLYGON)
glColor3f(0.0, 1.0, 0.0);
glVertex3f(1, 0, 0);
glVertex3f(0, 0, 0);
glVertex3f(0, 1, 0);
glVertex3f(1, 1, 0);
glEnd();

//--TERCERA CARA---
glBegin(GL_POLYGON)
glColor3f(0.0, 0.0, 1.0);
glVertex3f(0, 0, 0);
glVertex3f(0, 1, 1);
glVertex3f(1, 1, 1);
glVertex3f(0, 1, 0);
glEnd();

//--CUARTA CARA---
glBegin(GL_POLYGON)
glColor3f(1.0, 0.0, 1.0);
glVertex3f(0, 0, 1);
glVertex3f(1, 0, 1);
glVertex3f(1, 0, 0);
glVertex3f(0, 0, 0);
glEnd();

//--SEXTA CARA---
glBegin(GL_POLYGON)
glColor3f(0.5, 0.5, 0.5);
glVertex3f(1, 0, 1);
glVertex3f(1, 0, 0);
glVertex3f(1, 1, 0);
glVertex3f(1, 1, 1);
glEnd();
glutSwapBuffers();
}

void teclado(unsigned char key, int x, int y)
{
if(key==27) exit(0);
}

void main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGB|GLUT_DEPT H);
glutInitWindowSize(320,240);
glutCreateWindow("Intro");
init();

//Registrar las Funciones
glutKeyboardFunc(teclado);
glutDisplayFunc(dibujar);
glutReshapeFunc(redimensionar);

//Bucle de Eventos Principal
glutMainLoop();
}


Y aquí hos dejo la solucion:


1>------ Operación Generar iniciada: proyecto: Ejercicio 1, configuración: Debug Win32 ------
1>Compilando...
1>CPP.cpp
1>c:\users\ismael\skydrive (2)\estudios\app c++, opengl y unity\opengl\ejercicio 1\ejercicio 1\cpp.cpp(17) : error C2065: 'Glint' : identificador no declarado
1>c:\users\ismael\skydrive (2)\estudios\app c++, opengl y unity\opengl\ejercicio 1\ejercicio 1\cpp.cpp(17) : error C2146: error de sintaxis : falta ')' delante del identificador 'alto'
1>c:\users\ismael\skydrive (2)\estudios\app c++, opengl y unity\opengl\ejercicio 1\ejercicio 1\cpp.cpp(17) : error C2059: error de sintaxis : ')'
1>c:\users\ismael\skydrive (2)\estudios\app c++, opengl y unity\opengl\ejercicio 1\ejercicio 1\cpp.cpp(29) : error C2146: error de sintaxis : falta ';' delante del identificador 'glColor3f'
1>c:\users\ismael\skydrive (2)\estudios\app c++, opengl y unity\opengl\ejercicio 1\ejercicio 1\cpp.cpp(38) : error C2146: error de sintaxis : falta ';' delante del identificador 'glColor3f'
1>c:\users\ismael\skydrive (2)\estudios\app c++, opengl y unity\opengl\ejercicio 1\ejercicio 1\cpp.cpp(47) : error C2146: error de sintaxis : falta ';' delante del identificador 'glColor3f'
1>c:\users\ismael\skydrive (2)\estudios\app c++, opengl y unity\opengl\ejercicio 1\ejercicio 1\cpp.cpp(56) : error C2146: error de sintaxis : falta ';' delante del identificador 'glColor3f'
1>c:\users\ismael\skydrive (2)\estudios\app c++, opengl y unity\opengl\ejercicio 1\ejercicio 1\cpp.cpp(65) : error C2146: error de sintaxis : falta ';' delante del identificador 'glColor3f'
1>El registro de compilación se guardó en el "file://c:\Users\Ismael\SkyDrive (2)\Estudios\App C++, OPENGL y Unity\OpenGL\Ejercicio 1\Ejercicio 1\Debug\BuildLog.htm"
1>Ejercicio 1 - 8 errores, 0 advertencias
========== Generar: 0 correctos, 1 incorrectos, 0 actualizados, 0 omitidos ==========

Muchas gracias de antemano a todos.

Un saludo.