in superbible fifth edition with this code from LISTING 2.1 and 2.2 (from page 62,63,64,74 and 75) i get this errors =
Error 1 error C2065: ‘vVerts’ : undeclared identifier
Error 2 error C2065: ‘vVerts’ : undeclared identifier
Error 3 error C2065: ‘blockSize’ : undeclared identifier
Error 4 error C2065: ‘blockSize’ : undeclared identifier
Error 5 error C2065: ‘blockSize’ : undeclared identifier
Error 6 error C2065: ‘blockSize’ : undeclared identifier
Error 7 error C2065: ‘vVerts’ : undeclared identifier
Error 8 error C2065: ‘vVerts’ : undeclared identifier
Error 9 error C2065: ‘blockSize’ : undeclared identifier
Error 10 error C2065: ‘vVerts’ : undeclared identifier
Error 11 error C2065: ‘blockSize’ : undeclared identifier
Error 12 error C2065: ‘vVerts’ : undeclared identifier
Error 13 error C2065: ‘blockSize’ : undeclared identifier
Error 14 error C2065: ‘vVerts’ : undeclared identifier
Error 15 error C2065: ‘blockSize’ : undeclared identifier 51
Error 16 error C2065: ‘vVerts’ : undeclared identifier
Error 17 error C2065: ‘vVerts’ : undeclared identifier
Error 18 error C2065: ‘vVerts’ : undeclared identifier
19 IntelliSense: identifier “vVerts” is undefined
20 IntelliSense: identifier “blockSize” is undefined
and used this code =
#include <GLTools.h>
#include <GLShaderManager.h>
#include <iostream>
#ifdef APPLE
#include <glut/glut.h>
#else
#define FREEGLUT_STATIC
#include <GL/glut.h>
#endif
GLfloat num = 0.0f;
GLBatch triangleBatch;
GLShaderManager shaderManager;
void SpecialKeys (int key, int x, int y){
GLfloat stepSize = 0.025f;
GLfloat blockx = vVerts[0];
GLfloat blocky = vVerts[7];
if(key == GLUT_KEY_UP)
blocky += stepSize;
if(key == GLUT_KEY_DOWN)
blocky -= stepSize;
if(key == GLUT_KEY_LEFT)
blockx -= stepSize;
if(key == GLUT_KEY_RIGHT)
blockx += stepSize;
if(blockx < -1.0f) blockx = -1.0f;
if(blockx > (1.0f - blockSize * 2)) blockx = 1.0f - blockSize * 2;;
if(blocky < -1.0f + blockSize * 2) blocky = -1.0f + blockSize * 2;
if(blocky > 1.0f) blocky = 1.0f;
vVerts[0] = blockx;
vVerts[1] = blocky - blockSize*2;
vVerts[3] = blockx + blockSize*2;
vVerts[4] = blocky - blockSize*2;
vVerts[6] = blockx + blockSize*2;
vVerts[7] = blocky;
vVerts[9] = blockx;
vVerts[10] = blocky;
glutPostRedisplay();
}
void ChangeSize(int w, int h)
{
glViewport(0, 0, w, h);
std::cout << std::endl <<" w = " << w << std::endl << " h = " << h << std::endl;
}
void SetupRC()
{
glClearColor(0.0f, 0.0f, 1.0f, 1.0f);
shaderManager.InitializeStockShaders();
glColor3f(0.0f, 1.0f, 1.0f);
GLfloat vVerts[] = { -0.5f, 0.0f, 1.0f,
0.5f, 0.0f, 1.0f,
0.0f, 0.5f, 1.0f };
triangleBatch.Begin(GL_TRIANGLE_FAN, 3);
triangleBatch.CopyVertexData3f(vVerts);
triangleBatch.End();
}
void RenderScene(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
GLfloat vRed[] = { 1.0f, 0.0f, 0.0f, 1.0f };
shaderManager.UseStockShader(GLT_SHADER_IDENTITY, vRed);
triangleBatch.Draw();
glutSwapBuffers();
}
int main(int argc, char* argv[])
{
gltSetWorkingDirectory(argv[0]);
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH | GLUT_STENCIL);
glutInitWindowSize(1920,1080);
glutCreateWindow("Triangle");
glutReshapeFunc(ChangeSize);
glutDisplayFunc(RenderScene);
glutSpecialFunc(SpecialKeys);
GLenum err = glewInit();
if (GLEW_OK != err) {
fprintf(stderr, "GLEW Error: %s
", glewGetErrorString(err));
return 1;
}
fprintf(stderr, “hello”);
std::cout << glGetError;
SetupRC();
glutMainLoop();
return 0;
}
Please help