Bimbol Temat założony przez niniejszego użytkownika |
[C++, OpenGL] error: 'GLAPI' does not name a type » 2013-11-18 16:40:44 Witam, zakupiłem książkę OpenGL Księga eksperta, wydanie V. I mam problem z pierwszym przykładem, mianowicie nie kompiluje się w CodeBlock'u. Kod:
#include <GLTools.h> #include <GLMatrixStack.h> #include <GLFrame.h> #include <GLFrustum.h> #include <GLBatch.h> #include <GLGeometryTransform.h>
#include <math.h> #ifdef __APPLE__ #include <glut/glut.h> #else #define FREEGLUT_STATIC #include <GL/glut.h> #endif
GLShaderManager shaderManager; GLMatrixStack modelViewMatrix; GLMatrixStack projectionMatrix; GLFrame cameraFrame; GLFrustum viewFrustum; GLBatch cubeBatch; GLBatch floorBatch; GLBatch topBlock; GLBatch frontBlock; GLBatch leftBlock;
GLGeometryTransform transformPipeline; M3DMatrix44f shadowMatrix;
int nStep = 0;
GLfloat lightAmbient[] = { 0.2f, 0.2f, 0.2f, 1.0f }; GLfloat lightDiffuse[] = { 0.7f, 0.7f, 0.7f, 1.0f }; GLfloat lightSpecular[] = { 0.9f, 0.9f, 0.9f }; GLfloat vLightPos[] = { - 8.0f, 20.0f, 100.0f, 1.0f };
GLuint textures[ 4 ];
void MakeCube( GLBatch & cubeBatch ) { cubeBatch.Begin( GL_TRIANGLES, 36, 1 ); cubeBatch.Normal3f( 0.0f, 1.0f, 0.0f ); cubeBatch.MultiTexCoord2f( 0, 1.0f, 1.0f ); cubeBatch.Vertex3f( 1.0f, 1.0f, 1.0f ); cubeBatch.Normal3f( 0.0f, 1.0f, 0.0f ); cubeBatch.MultiTexCoord2f( 0, 1.0f, 0.0f ); cubeBatch.Vertex3f( 1.0f, 1.0f, - 1.0f ); cubeBatch.Normal3f( 0.0f, 1.0f, 0.0f ); cubeBatch.MultiTexCoord2f( 0, 0.0f, 0.0f ); cubeBatch.Vertex3f( - 1.0f, 1.0f, - 1.0f ); cubeBatch.Normal3f( 0.0f, 1.0f, 0.0f ); cubeBatch.MultiTexCoord2f( 0, 1.0f, 1.0f ); cubeBatch.Vertex3f( 1.0f, 1.0f, 1.0f ); cubeBatch.Normal3f( 0.0f, 1.0f, 0.0f ); cubeBatch.MultiTexCoord2f( 0, 0.0f, 0.0f ); cubeBatch.Vertex3f( - 1.0f, 1.0f, - 1.0f ); cubeBatch.Normal3f( 0.0f, 1.0f, 0.0f ); cubeBatch.MultiTexCoord2f( 0, 0.0f, 1.0f ); cubeBatch.Vertex3f( - 1.0f, 1.0f, 1.0f ); cubeBatch.Normal3f( 0.0f, - 1.0f, 0.0f ); cubeBatch.MultiTexCoord2f( 0, 0.0f, 0.0f ); cubeBatch.Vertex3f( - 1.0f, - 1.0f, - 1.0f ); cubeBatch.Normal3f( 0.0f, - 1.0f, 0.0f ); cubeBatch.MultiTexCoord2f( 0, 1.0f, 0.0f ); cubeBatch.Vertex3f( 1.0f, - 1.0f, - 1.0f ); cubeBatch.Normal3f( 0.0f, - 1.0f, 0.0f ); cubeBatch.MultiTexCoord2f( 0, 1.0f, 1.0f ); cubeBatch.Vertex3f( 1.0f, - 1.0f, 1.0f ); cubeBatch.Normal3f( 0.0f, - 1.0f, 0.0f ); cubeBatch.MultiTexCoord2f( 0, 0.0f, 1.0f ); cubeBatch.Vertex3f( - 1.0f, - 1.0f, 1.0f ); cubeBatch.Normal3f( 0.0f, - 1.0f, 0.0f ); cubeBatch.MultiTexCoord2f( 0, 0.0f, 0.0f ); cubeBatch.Vertex3f( - 1.0f, - 1.0f, - 1.0f ); cubeBatch.Normal3f( 0.0f, - 1.0f, 0.0f ); cubeBatch.MultiTexCoord2f( 0, 1.0f, 1.0f ); cubeBatch.Vertex3f( 1.0f, - 1.0f, 1.0f ); cubeBatch.Normal3f( - 1.0f, 0.0f, 0.0f ); cubeBatch.MultiTexCoord2f( 0, 1.0f, 1.0f ); cubeBatch.Vertex3f( - 1.0f, 1.0f, 1.0f ); cubeBatch.Normal3f( - 1.0f, 0.0f, 0.0f ); cubeBatch.MultiTexCoord2f( 0, 1.0f, 0.0f ); cubeBatch.Vertex3f( - 1.0f, 1.0f, - 1.0f ); cubeBatch.Normal3f( - 1.0f, 0.0f, 0.0f ); cubeBatch.MultiTexCoord2f( 0, 0.0f, 0.0f ); cubeBatch.Vertex3f( - 1.0f, - 1.0f, - 1.0f ); cubeBatch.Normal3f( - 1.0f, 0.0f, 0.0f ); cubeBatch.MultiTexCoord2f( 0, 1.0f, 1.0f ); cubeBatch.Vertex3f( - 1.0f, 1.0f, 1.0f ); cubeBatch.Normal3f( - 1.0f, 0.0f, 0.0f ); cubeBatch.MultiTexCoord2f( 0, 0.0f, 0.0f ); cubeBatch.Vertex3f( - 1.0f, - 1.0f, - 1.0f ); cubeBatch.Normal3f( - 1.0f, 0.0f, 0.0f ); cubeBatch.MultiTexCoord2f( 0, 0.0f, 1.0f ); cubeBatch.Vertex3f( - 1.0f, - 1.0f, 1.0f ); cubeBatch.Normal3f( 1.0f, 0.0f, 0.0f ); cubeBatch.MultiTexCoord2f( 0, 0.0f, 0.0f ); cubeBatch.Vertex3f( 1.0f, - 1.0f, - 1.0f ); cubeBatch.Normal3f( 1.0f, 0.0f, 0.0f ); cubeBatch.MultiTexCoord2f( 0, 1.0f, 0.0f ); cubeBatch.Vertex3f( 1.0f, 1.0f, - 1.0f ); cubeBatch.Normal3f( 1.0f, 0.0f, 0.0f ); cubeBatch.MultiTexCoord2f( 0, 1.0f, 1.0f ); cubeBatch.Vertex3f( 1.0f, 1.0f, 1.0f ); cubeBatch.Normal3f( 1.0f, 0.0f, 0.0f ); cubeBatch.MultiTexCoord2f( 0, 1.0f, 1.0f ); cubeBatch.Vertex3f( 1.0f, 1.0f, 1.0f ); cubeBatch.Normal3f( 1.0f, 0.0f, 0.0f ); cubeBatch.MultiTexCoord2f( 0, 0.0f, 1.0f ); cubeBatch.Vertex3f( 1.0f, - 1.0f, 1.0f ); cubeBatch.Normal3f( 1.0f, 0.0f, 0.0f ); cubeBatch.MultiTexCoord2f( 0, 0.0f, 0.0f ); cubeBatch.Vertex3f( 1.0f, - 1.0f, - 1.0f ); cubeBatch.Normal3f( 0.0f, 0.0f, 1.0f ); cubeBatch.MultiTexCoord2f( 0, 1.0f, 0.0f ); cubeBatch.Vertex3f( 1.0f, - 1.0f, 1.0f ); cubeBatch.Normal3f( 0.0f, 0.0f, 1.0f ); cubeBatch.MultiTexCoord2f( 0, 1.0f, 1.0f ); cubeBatch.Vertex3f( 1.0f, 1.0f, 1.0f ); cubeBatch.Normal3f( 0.0f, 0.0f, 1.0f ); cubeBatch.MultiTexCoord2f( 0, 0.0f, 1.0f ); cubeBatch.Vertex3f( - 1.0f, 1.0f, 1.0f ); cubeBatch.Normal3f( 0.0f, 0.0f, 1.0f ); cubeBatch.MultiTexCoord2f( 0, 0.0f, 1.0f ); cubeBatch.Vertex3f( - 1.0f, 1.0f, 1.0f ); cubeBatch.Normal3f( 0.0f, 0.0f, 1.0f ); cubeBatch.MultiTexCoord2f( 0, 0.0f, 0.0f ); cubeBatch.Vertex3f( - 1.0f, - 1.0f, 1.0f ); cubeBatch.Normal3f( 0.0f, 0.0f, 1.0f ); cubeBatch.MultiTexCoord2f( 0, 1.0f, 0.0f ); cubeBatch.Vertex3f( 1.0f, - 1.0f, 1.0f ); cubeBatch.Normal3f( 0.0f, 0.0f, - 1.0f ); cubeBatch.MultiTexCoord2f( 0, 1.0f, 0.0f ); cubeBatch.Vertex3f( 1.0f, - 1.0f, - 1.0f ); cubeBatch.Normal3f( 0.0f, 0.0f, - 1.0f ); cubeBatch.MultiTexCoord2f( 0, 0.0f, 0.0f ); cubeBatch.Vertex3f( - 1.0f, - 1.0f, - 1.0f ); cubeBatch.Normal3f( 0.0f, 0.0f, - 1.0f ); cubeBatch.MultiTexCoord2f( 0, 0.0f, 1.0f ); cubeBatch.Vertex3f( - 1.0f, 1.0f, - 1.0f ); cubeBatch.Normal3f( 0.0f, 0.0f, - 1.0f ); cubeBatch.MultiTexCoord2f( 0, 0.0f, 1.0f ); cubeBatch.Vertex3f( - 1.0f, 1.0f, - 1.0f ); cubeBatch.Normal3f( 0.0f, 0.0f, - 1.0f ); cubeBatch.MultiTexCoord2f( 0, 1.0f, 1.0f ); cubeBatch.Vertex3f( 1.0f, 1.0f, - 1.0f ); cubeBatch.Normal3f( 0.0f, 0.0f, - 1.0f ); cubeBatch.MultiTexCoord2f( 0, 1.0f, 0.0f ); cubeBatch.Vertex3f( 1.0f, - 1.0f, - 1.0f ); cubeBatch.End(); }
void MakeFloor( GLBatch & floorBatch ) { GLfloat x = 5.0f; GLfloat y = - 1.0f; floorBatch.Begin( GL_TRIANGLE_FAN, 4, 1 ); floorBatch.MultiTexCoord2f( 0, 0.0f, 0.0f ); floorBatch.Vertex3f( - x, y, x ); floorBatch.MultiTexCoord2f( 0, 1.0f, 0.0f ); floorBatch.Vertex3f( x, y, x ); floorBatch.MultiTexCoord2f( 0, 1.0f, 1.0f ); floorBatch.Vertex3f( x, y, - x ); floorBatch.MultiTexCoord2f( 0, 0.0f, 1.0f ); floorBatch.Vertex3f( - x, y, - x ); floorBatch.End(); }
void SetupRC() { GLbyte * pBytes; GLint nWidth, nHeight, nComponents; GLenum format; shaderManager.InitializeStockShaders(); glClearColor( 0.0f, 0.0f, 0.0f, 1.0f ); glEnable( GL_DEPTH_TEST ); glLineWidth( 2.5f ); glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); glHint( GL_LINE_SMOOTH_HINT, GL_NICEST ); transformPipeline.SetMatrixStacks( modelViewMatrix, projectionMatrix ); cameraFrame.MoveForward( - 15.0f ); cameraFrame.MoveUp( 6.0f ); cameraFrame.RotateLocalX( float( m3dDegToRad( 20.0f ) ) ); MakeCube( cubeBatch ); MakeFloor( floorBatch ); topBlock.Begin( GL_TRIANGLE_FAN, 4, 1 ); topBlock.Normal3f( 0.0f, 1.0f, 0.0f ); topBlock.MultiTexCoord2f( 0, 0.0f, 0.0f ); topBlock.Vertex3f( - 1.0f, 1.0f, 1.0f ); topBlock.Normal3f( 0.0f, 1.0f, 0.0f ); topBlock.MultiTexCoord2f( 0, 1.0f, 0.0f ); topBlock.Vertex3f( 1.0f, 1.0f, 1.0f ); topBlock.Normal3f( 0.0f, 1.0f, 0.0f ); topBlock.MultiTexCoord2f( 0, 1.0f, 1.0f ); topBlock.Vertex3f( 1.0f, 1.0f, - 1.0f ); topBlock.Normal3f( 0.0f, 1.0f, 0.0f ); topBlock.MultiTexCoord2f( 0, 0.0f, 1.0f ); topBlock.Vertex3f( - 1.0f, 1.0f, - 1.0f ); topBlock.End(); frontBlock.Begin( GL_TRIANGLE_FAN, 4, 1 ); frontBlock.Normal3f( 0.0f, 0.0f, 1.0f ); frontBlock.MultiTexCoord2f( 0, 0.0f, 0.0f ); frontBlock.Vertex3f( - 1.0f, - 1.0f, 1.0f ); frontBlock.Normal3f( 0.0f, 0.0f, 1.0f ); frontBlock.MultiTexCoord2f( 0, 1.0f, 0.0f ); frontBlock.Vertex3f( 1.0f, - 1.0f, 1.0f ); frontBlock.Normal3f( 0.0f, 0.0f, 1.0f ); frontBlock.MultiTexCoord2f( 0, 1.0f, 1.0f ); frontBlock.Vertex3f( 1.0f, 1.0f, 1.0f ); frontBlock.Normal3f( 0.0f, 0.0f, 1.0f ); frontBlock.MultiTexCoord2f( 0, 0.0f, 1.0f ); frontBlock.Vertex3f( - 1.0f, 1.0f, 1.0f ); frontBlock.End(); leftBlock.Begin( GL_TRIANGLE_FAN, 4, 1 ); leftBlock.Normal3f( - 1.0f, 0.0f, 0.0f ); leftBlock.MultiTexCoord2f( 0, 0.0f, 0.0f ); leftBlock.Vertex3f( - 1.0f, - 1.0f, - 1.0f ); leftBlock.Normal3f( - 1.0f, 0.0f, 0.0f ); leftBlock.MultiTexCoord2f( 0, 1.0f, 0.0f ); leftBlock.Vertex3f( - 1.0f, - 1.0f, 1.0f ); leftBlock.Normal3f( - 1.0f, 0.0f, 0.0f ); leftBlock.MultiTexCoord2f( 0, 1.0f, 1.0f ); leftBlock.Vertex3f( - 1.0f, 1.0f, 1.0f ); leftBlock.Normal3f( - 1.0f, 0.0f, 0.0f ); leftBlock.MultiTexCoord2f( 0, 0.0f, 1.0f ); leftBlock.Vertex3f( - 1.0f, 1.0f, - 1.0f ); leftBlock.End(); GLfloat floorPlane[] = { 0.0f, 1.0f, 0.0f, 1.0f }; m3dMakePlanarShadowMatrix( shadowMatrix, floorPlane, vLightPos ); glGenTextures( 4, textures ); pBytes = gltReadTGABits( "floor.tga", & nWidth, & nHeight, & nComponents, & format ); glBindTexture( GL_TEXTURE_2D, textures[ 0 ] ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT ); glTexImage2D( GL_TEXTURE_2D, 0, nComponents, nWidth, nHeight, 0, format, GL_UNSIGNED_BYTE, pBytes ); free( pBytes ); pBytes = gltReadTGABits( "Block4.tga", & nWidth, & nHeight, & nComponents, & format ); glBindTexture( GL_TEXTURE_2D, textures[ 1 ] ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT ); glTexImage2D( GL_TEXTURE_2D, 0, nComponents, nWidth, nHeight, 0, format, GL_UNSIGNED_BYTE, pBytes ); free( pBytes ); pBytes = gltReadTGABits( "block5.tga", & nWidth, & nHeight, & nComponents, & format ); glBindTexture( GL_TEXTURE_2D, textures[ 2 ] ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT ); glTexImage2D( GL_TEXTURE_2D, 0, nComponents, nWidth, nHeight, 0, format, GL_UNSIGNED_BYTE, pBytes ); free( pBytes ); pBytes = gltReadTGABits( "block6.tga", & nWidth, & nHeight, & nComponents, & format ); glBindTexture( GL_TEXTURE_2D, textures[ 3 ] ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT ); glTexImage2D( GL_TEXTURE_2D, 0, nComponents, nWidth, nHeight, 0, format, GL_UNSIGNED_BYTE, pBytes ); free( pBytes ); }
void RenderBlock( void ) { GLfloat vRed[] = { 1.0f, 0.0f, 0.0f, 1.0f }; GLfloat vWhite[] = { 1.0f, 1.0f, 1.0f, 1.0f }; switch( nStep ) { case 0: glEnable( GL_BLEND ); glEnable( GL_LINE_SMOOTH ); shaderManager.UseStockShader( GLT_SHADER_FLAT, transformPipeline.GetModelViewProjectionMatrix(), vRed ); glPolygonMode( GL_FRONT_AND_BACK, GL_LINE ); glDisable( GL_CULL_FACE ); cubeBatch.Draw(); break; case 1: shaderManager.UseStockShader( GLT_SHADER_FLAT, transformPipeline.GetModelViewProjectionMatrix(), vRed ); glPolygonMode( GL_FRONT_AND_BACK, GL_FILL ); glEnable( GL_STENCIL_TEST ); glStencilFunc( GL_NEVER, 0, 0 ); glStencilOp( GL_INCR, GL_INCR, GL_INCR ); cubeBatch.Draw(); glStencilOp( GL_KEEP, GL_KEEP, GL_KEEP ); glDisable( GL_STENCIL_TEST ); glEnable( GL_BLEND ); glEnable( GL_LINE_SMOOTH ); glPolygonMode( GL_FRONT_AND_BACK, GL_LINE ); cubeBatch.Draw(); break; case 2: shaderManager.UseStockShader( GLT_SHADER_FLAT, transformPipeline.GetModelViewProjectionMatrix(), vRed ); cubeBatch.Draw(); break; case 3: shaderManager.UseStockShader( GLT_SHADER_POINT_LIGHT_DIFF, modelViewMatrix.GetMatrix(), projectionMatrix.GetMatrix(), vLightPos, vRed ); cubeBatch.Draw(); break; case 4: case 5: default: glBindTexture( GL_TEXTURE_2D, textures[ 2 ] ); shaderManager.UseStockShader( GLT_SHADER_TEXTURE_POINT_LIGHT_DIFF, modelViewMatrix.GetMatrix(), projectionMatrix.GetMatrix(), vLightPos, vWhite, 0 ); glBindTexture( GL_TEXTURE_2D, textures[ 1 ] ); topBlock.Draw(); glBindTexture( GL_TEXTURE_2D, textures[ 2 ] ); frontBlock.Draw(); glBindTexture( GL_TEXTURE_2D, textures[ 3 ] ); leftBlock.Draw(); break; } glPolygonMode( GL_FRONT_AND_BACK, GL_FILL ); glEnable( GL_CULL_FACE ); glDisable( GL_BLEND ); glDisable( GL_LINE_SMOOTH ); glDisable( GL_STENCIL_TEST ); }
void RenderFloor( void ) { GLfloat vBrown[] = { 0.55f, 0.292f, 0.09f, 1.0f }; GLfloat vFloor[] = { 1.0f, 1.0f, 1.0f, 0.6f }; switch( nStep ) { case 0: glEnable( GL_BLEND ); glEnable( GL_LINE_SMOOTH ); shaderManager.UseStockShader( GLT_SHADER_FLAT, transformPipeline.GetModelViewProjectionMatrix(), vBrown ); glPolygonMode( GL_FRONT_AND_BACK, GL_LINE ); glDisable( GL_CULL_FACE ); break; case 1: glEnable( GL_BLEND ); glEnable( GL_LINE_SMOOTH ); glEnable( GL_STENCIL_TEST ); glStencilFunc( GL_EQUAL, 0, 0xff ); shaderManager.UseStockShader( GLT_SHADER_FLAT, transformPipeline.GetModelViewProjectionMatrix(), vBrown ); glPolygonMode( GL_FRONT_AND_BACK, GL_LINE ); break; case 2: case 3: shaderManager.UseStockShader( GLT_SHADER_FLAT, transformPipeline.GetModelViewProjectionMatrix(), vBrown ); break; case 4: case 5: default: glBindTexture( GL_TEXTURE_2D, textures[ 0 ] ); shaderManager.UseStockShader( GLT_SHADER_TEXTURE_MODULATE, transformPipeline.GetModelViewProjectionMatrix(), vFloor, 0 ); break; } floorBatch.Draw(); glPolygonMode( GL_FRONT_AND_BACK, GL_FILL ); glEnable( GL_CULL_FACE ); glDisable( GL_BLEND ); glDisable( GL_LINE_SMOOTH ); glDisable( GL_STENCIL_TEST ); }
void RenderScene( void ) { glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT ); modelViewMatrix.PushMatrix(); M3DMatrix44f mCamera; cameraFrame.GetCameraMatrix( mCamera ); modelViewMatrix.MultMatrix( mCamera ); if( nStep == 5 ) { glDisable( GL_CULL_FACE ); modelViewMatrix.PushMatrix(); modelViewMatrix.Scale( 1.0f, - 1.0f, 1.0f ); modelViewMatrix.Translate( 0.0f, 2.0f, 0.0f ); modelViewMatrix.Rotate( 35.0f, 0.0f, 1.0f, 0.0f ); RenderBlock(); modelViewMatrix.PopMatrix(); glEnable( GL_BLEND ); glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); RenderFloor(); glDisable( GL_BLEND ); } modelViewMatrix.PushMatrix(); modelViewMatrix.Rotate( 35.0f, 0.0f, 1.0f, 0.0f ); RenderBlock(); modelViewMatrix.PopMatrix(); if( nStep != 5 ) RenderFloor(); modelViewMatrix.PopMatrix(); glutSwapBuffers(); }
void KeyPressFunc( unsigned char key, int x, int y ) { if( key == 32 ) { nStep++; if( nStep > 5 ) nStep = 0; } glutPostRedisplay(); }
void ChangeSize( int w, int h ) { glViewport( 0, 0, w, h ); viewFrustum.SetPerspective( 35.0f, float( w ) / float( h ), 1.0f, 500.0f ); projectionMatrix.LoadMatrix( viewFrustum.GetProjectionMatrix() ); modelViewMatrix.LoadIdentity(); }
int main( int argc, char * argv[] ) { gltSetWorkingDirectory( argv[ 0 ] ); glutInit( & argc, argv ); glutInitDisplayMode( GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH | GLUT_STENCIL ); glutInitWindowSize( 800, 600 ); glutCreateWindow( "3D Effects Demo" ); GLenum err = glewInit(); if( GLEW_OK != err ) { fprintf( stderr, "Error: %s\n", glewGetErrorString( err ) ); return 1; } glutReshapeFunc( ChangeSize ); glutKeyboardFunc( KeyPressFunc ); glutDisplayFunc( RenderScene ); SetupRC(); glutMainLoop(); glDeleteTextures( 4, textures ); return 0; }
A tutaj błędy: ||=== 1, Debug ===| c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glu.h|225|error: 'GLAPI' does not name a type| c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glu.h|226|error: 'GLAPI' does not name a type| c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glu.h|227|error: 'GLAPI' does not name a type| c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glu.h|228|error: 'GLAPI' does not name a type| c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glu.h|229|error: 'GLAPI' does not name a type| c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glu.h|230|error: 'GLAPI' does not name a type| c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glu.h|231|error: 'GLAPI' does not name a type| c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glu.h|232|error: 'GLAPI' does not name a type| c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glu.h|233|error: 'GLAPI' does not name a type| c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glu.h|234|error: 'GLAPI' does not name a type| c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glu.h|235|error: 'GLAPI' does not name a type| c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glu.h|236|error: 'GLAPI' does not name a type| c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glu.h|237|error: 'GLAPI' does not name a type| c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glu.h|238|error: 'GLAPI' does not name a type| c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glu.h|239|error: 'GLAPI' does not name a type| c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glu.h|240|error: 'GLAPI' does not name a type| c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glu.h|241|error: 'GLAPI' does not name a type| c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glu.h|242|error: 'GLAPI' does not name a type| c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glu.h|243|error: 'GLAPI' does not name a type| c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glu.h|244|error: 'GLAPI' does not name a type| c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glu.h|245|error: 'GLAPI' does not name a type| c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glu.h|246|error: 'GLAPI' does not name a type| c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glu.h|247|error: 'GLAPI' does not name a type| c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glu.h|248|error: 'GLAPI' does not name a type| c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glu.h|249|error: 'GLAPI' does not name a type| c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glu.h|250|error: 'GLAPI' does not name a type| c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glu.h|251|error: 'GLAPI' does not name a type| c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glu.h|252|error: 'GLAPI' does not name a type| c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glu.h|253|error: 'GLAPI' does not name a type| c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glu.h|254|error: 'GLAPI' does not name a type| c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glu.h|255|error: 'GLAPI' does not name a type| c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glu.h|256|error: 'GLAPI' does not name a type| c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glu.h|257|error: 'GLAPI' does not name a type| c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glu.h|258|error: 'GLAPI' does not name a type| c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glu.h|259|error: 'GLAPI' does not name a type| c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glu.h|260|error: 'GLAPI' does not name a type| c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glu.h|261|error: 'GLAPI' does not name a type| c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glu.h|262|error: 'GLAPI' does not name a type| c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glu.h|263|error: 'GLAPI' does not name a type| c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glu.h|264|error: 'GLAPI' does not name a type| c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glu.h|265|error: 'GLAPI' does not name a type| c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glu.h|266|error: 'GLAPI' does not name a type| c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glu.h|267|error: 'GLAPI' does not name a type| c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glu.h|268|error: 'GLAPI' does not name a type| c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glu.h|269|error: 'GLAPI' does not name a type| c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glu.h|270|error: 'GLAPI' does not name a type| c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glu.h|271|error: 'GLAPI' does not name a type| c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glu.h|272|error: 'GLAPI' does not name a type| c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glu.h|273|error: 'GLAPI' does not name a type| c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glu.h|274|error: 'GLAPI' does not name a type| ||More errors follow but not being shown.| ||Edit the max errors limit in compiler options...| ||=== Build finished: 50 errors, 0 warnings (0 minutes, 0 seconds) ===|
Tak to właśnie wygląda. GLUT jest dobrze z linkowany, gdyż testując przykładowy kod CodeBlock'a działa. Pozdrawiam Bimbol. |