PDA

View Full Version : the program of my geosphrere don't work !



airseb
06-30-2002, 11:41 AM
#include <GL/glut.h>
#include <stdlib.h>
const float X= 0.525731112119133606 ;
const float Z= 0.850650808352039932 ;

void display ()
{
static GLfloat tableau_entrelace [] = {1.0, 1.0, 1.0, -X, 0.0, Z, 1.0, 1.0, 1.0, X, 0.0, Z,
1.0, 1.0, 1.0, -X, 0.0, -Z,1.0, 1.0, 1.0, X, 0.0, -Z, 1.0, 1.0, 1.0, 0.0, Z, X,
1.0, 1.0, 1.0, 0.0, Z, -X, 1.0, 1.0, 1.0, 0.0, -Z, X, 1.0, 1.0, 1.0, 0.0, -Z, -X,
1.0, 1.0, 1.0, Z, X, 0.0, 1.0, 1.0, 1.0,, -Z, X, 0.0,1.0, 1.0, 1.0, Z, -X, 0.0,
1.0, 1.0, 1.0, -Z, -X, 0.0} ;

glInterleavedArrays (GL_C3F_V3F, 0, tableau_entrelace) ;

static GLuint indices [20][3]= {1,4,0,4,9,0,4,5,9,8,5,4,1,8,4,1,10,8,10,3,8,8,3,5 ,3,2,5,
3,7,2,3,10,7,10,6,7,6,11,7,6,0,11,6,1,0,10,1,6,11, 0,9,2,11,9,5,2,9,11,2,7};

glPolygonMode (GL_FRONT, GL_LINE) ;
glFrontFace (GL_CCW) ;
glEnable (GL_CULL_FACE) ;
glCullFace (GL_BACK) ;

glDrawElements (GL_TRIANGLES, 60, GL_UNSIGNED_BYTE, indices) ;

glutSwapBuffers() ;
glFlush () ;
}


void main (int argc, char** argv)

{
glutInit (&argc, argv) ;
glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH) ;
glutInitWindowSize (640, 480) ;
glutInitWindowPosition (250,250) ;
glutCreateWindow (argv [0]) ;

glClearColor (0.0, 0.0, 0.0, 0.0) ;
glClear (GL_COLOR_BUFFER_BIT) ;

glMatrixMode(GL_PROJECTION);
glLoadIdentity();

glOrtho(25.0 , -20.0, 20.0, -20.0, -10.0, 16.0);

glMatrixMode(GL_MODELVIEW);
glLoadIdentity();

glutDisplayFunc (display) ;
glutMainLoop () ;

}

this is the errors:

Compiling...
Geosphere.cpp
D:\programmation\[Mes programmes Open GL\Geosphere.cpp(14) : error C2059: syntax error : ','
D:\programmation\[Mes programmes Open GL\Geosphere.cpp(17) : error C2065: 'tableau_entrelace' : undeclared identifier
D:\programmation\[Mes programmes Open GL\Geosphere.cpp(17) : error C2501: 'glInterleavedArrays' : missing storage-class or type specifiers
D:\programmation\[Mes programmes Open GL\Geosphere.cpp(17) : error C2373: 'glInterleavedArrays' : redefinition; different type modifiers
d:\visual c++\include\gl\gl.h(1294) : see declaration of 'glInterleavedArrays'
D:\programmation\[Mes programmes Open GL\Geosphere.cpp(17) : error C2078: too many initializers
D:\programmation\[Mes programmes Open GL\Geosphere.cpp(22) : error C2501: 'glPolygonMode' : missing storage-class or type specifiers
D:\programmation\[Mes programmes Open GL\Geosphere.cpp(22) : error C2373: 'glPolygonMode' : redefinition; different type modifiers
d:\visual c++\include\gl\gl.h(1352) : see declaration of 'glPolygonMode'
D:\programmation\[Mes programmes Open GL\Geosphere.cpp(22) : error C2078: too many initializers
D:\programmation\[Mes programmes Open GL\Geosphere.cpp(25) : error C2501: 'glDrawElements' : missing storage-class or type specifiers
D:\programmation\[Mes programmes Open GL\Geosphere.cpp(25) : error C2373: 'glDrawElements' : redefinition; different type modifiers
d:\visual c++\include\gl\gl.h(1219) : see declaration of 'glDrawElements'
D:\programmation\[Mes programmes Open GL\Geosphere.cpp(25) : error C2078: too many initializers
D:\programmation\[Mes programmes Open GL\Geosphere.cpp(25) : error C2440: 'initializing' : cannot convert from 'unsigned int [20][3]' to 'int'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
D:\programmation\[Mes programmes Open GL\Geosphere.cpp(27) : error C2556: 'int __cdecl glutSwapBuffers(void)' : overloaded function differs only by return type from 'void __stdcall glutSwapBuffers(void)'
d:\visual c++\include\gl\glut.h(513) : see declaration of 'glutSwapBuffers'
D:\programmation\[Mes programmes Open GL\Geosphere.cpp(27) : error C2373: 'glutSwapBuffers' : redefinition; different type modifiers
d:\visual c++\include\gl\glut.h(513) : see declaration of 'glutSwapBuffers'
D:\programmation\[Mes programmes Open GL\Geosphere.cpp(28) : error C2556: 'int __cdecl glFlush(void)' : overloaded function differs only by return type from 'void __stdcall glFlush(void)'
d:\visual c++\include\gl\gl.h(1242) : see declaration of 'glFlush'
D:\programmation\[Mes programmes Open GL\Geosphere.cpp(28) : error C2373: 'glFlush' : redefinition; different type modifiers
d:\visual c++\include\gl\gl.h(1242) : see declaration of 'glFlush'
D:\programmation\[Mes programmes Open GL\Geosphere.cpp(29) : error C2143: syntax error : missing ';' before '}'
D:\programmation\[Mes programmes Open GL\Geosphere.cpp(29) : error C2143: syntax error : missing ';' before '}'
D:\programmation\[Mes programmes Open GL\Geosphere.cpp(29) : error C2143: syntax error : missing ';' before '}'
D:\programmation\[Mes programmes Open GL\Geosphere.cpp(42) : error C2143: syntax error : missing ';' before '{'
D:\programmation\[Mes programmes Open GL\Geosphere.cpp(42) : error C2447: missing function header (old-style formal list?)
Error executing cl.exe.

Geosphere.exe - 21 error(s), 0 warning(s)

no-one
06-30-2002, 12:49 PM
on error is this;

static GLfloat tableau_entrelace [] = {1.0, 1.0, 1.0, -X, 0.0, Z, 1.0, 1.0, 1.0, X, 0.0, Z,
1.0, 1.0, 1.0, -X, 0.0, -Z,1.0, 1.0, 1.0, X, 0.0, -Z, 1.0, 1.0, 1.0, 0.0, Z, X,
1.0, 1.0, 1.0, 0.0, Z, -X, 1.0, 1.0, 1.0, 0.0, -Z, X, 1.0, 1.0, 1.0, 0.0, -Z, -X,
1.0, 1.0, 1.0, Z, X, 0.0, 1.0, 1.0, 1.0

,, // you have an extra comma

-Z, X, 0.0,1.0, 1.0, 1.0, Z, -X, 0.0,
1.0, 1.0, 1.0, -Z, -X, 0.0} ;

[This message has been edited by no-one (edited 06-30-2002).]

airseb
06-30-2002, 01:11 PM
thank you http://www.opengl.org/discussion_boards/ubb/biggrin.gif