Witam, czytam książkę "OpenGL księga eksperta wydanie 5" z racji tego, że już wcześniej łyknąłem podstawowych podstaw OpenGLa, to początkowe programy są dla mnie zrozumiałe, lecz problem jest w tym, że w książce jest przedstawiony nowy standard i klasa GLBatch sprawia mi zawód już w momencie wywołania konstruktora. Może ktoś wie w czym tkwi problem?
#include <GLTools.h>
#include <GLShaderManager.h>
#ifdef __APPLE__
#include <glut/glut.h>
#else
#define FREEGLUT_STATIC
#include <GL\glut.h>
#endif
GLBatch triangleBatch;
GLShaderManager shaderManager;
void ChangeSize(int w, int h)
{
glViewport(0, 0, w, h);
}
void SetupRC()
{
glClearColor(0.0f , 0.0f, 1.0f, 1.0f);
shaderManager.InitializeStockShaders();
GLfloat vVerts[] = { -0.5f, 0.0f, 0.0f,
0.5f, 0.0f, 0.0f,
0.0f, 0.5f, 0.0f };
triangleBatch.Begin(GL_TRIANGLES, 3);
//triangleBatch.CopyVertexData3f(vVerts);
triangleBatch.End();
}
void RenderScene()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
GLfloat vRed[] = { 1.0f, 0.0f, 0.0f, 0.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(800, 600);
glutCreateWindow("Trójkąt");
glutReshapeFunc(ChangeSize);
glutDisplayFunc(RenderScene);
GLenum err = glewInit();
if(GLEW_OK != err)
{
fprintf(stderr, "Błąd GLEW: %s\n", glewGetErrorString(err));
return 1;
}
SetupRC();
glutMainLoop();
return 0;
}
Kompilator wypluwa takie notki:
'opengl.exe': Loaded 'C:\Documents and Settings\MJay\Moje dokumenty\Visual Studio 2010\Projects\opengl\Debug\opengl.exe', Symbols loaded.
'opengl.exe': Loaded 'C:\WINDOWS\system32\ntdll.dll', Cannot find or open the PDB file
'opengl.exe': Loaded 'C:\WINDOWS\system32\kernel32.dll', Cannot find or open the PDB file
'opengl.exe': Loaded 'C:\WINDOWS\system32\opengl32.dll', Cannot find or open the PDB file
'opengl.exe': Loaded 'C:\WINDOWS\system32\msvcrt.dll', Cannot find or open the PDB file
'opengl.exe': Loaded 'C:\WINDOWS\system32\advapi32.dll', Cannot find or open the PDB file
'opengl.exe': Loaded 'C:\WINDOWS\system32\rpcrt4.dll', Cannot find or open the PDB file
'opengl.exe': Loaded 'C:\WINDOWS\system32\secur32.dll', Cannot find or open the PDB file
'opengl.exe': Loaded 'C:\WINDOWS\system32\gdi32.dll', Cannot find or open the PDB file
'opengl.exe': Loaded 'C:\WINDOWS\system32\user32.dll', Cannot find or open the PDB file
'opengl.exe': Loaded 'C:\WINDOWS\system32\glu32.dll', Cannot find or open the PDB file
'opengl.exe': Loaded 'C:\WINDOWS\system32\ddraw.dll', Cannot find or open the PDB file
'opengl.exe': Loaded 'C:\WINDOWS\system32\dciman32.dll', Cannot find or open the PDB file
'opengl.exe': Loaded 'C:\WINDOWS\system32\winmm.dll', Cannot find or open the PDB file
'opengl.exe': Loaded 'C:\WINDOWS\system32\msvcr100d.dll', Symbols loaded.
'opengl.exe': Loaded 'C:\WINDOWS\system32\imm32.dll', Cannot find or open the PDB file
'opengl.exe': Loaded 'C:\WINDOWS\system32\msctf.dll', Cannot find or open the PDB file
'opengl.exe': Loaded 'C:\WINDOWS\system32\version.dll', Cannot find or open the PDB file
'opengl.exe': Unloaded 'C:\WINDOWS\system32\version.dll'
'opengl.exe': Loaded 'C:\WINDOWS\system32\msctfime.ime', Cannot find or open the PDB file
'opengl.exe': Loaded 'C:\WINDOWS\system32\ole32.dll', Cannot find or open the PDB file
'opengl.exe': Loaded 'C:\WINDOWS\system32\nvoglnt.dll', Cannot find or open the PDB file
The thread 'Win32 Thread' (0x884) has exited with code 0 (0x0).
The thread 'Win32 Thread' (0x1c0) has exited with code 0 (0x0).
The thread 'Win32 Thread' (0x5a0) has exited with code 0 (0x0).
'opengl.exe': Loaded 'C:\WINDOWS\system32\mcd32.dll', Cannot find or open the PDB file
'opengl.exe': Unloaded 'C:\WINDOWS\system32\mcd32.dll'
First-chance exception at 0x00000000 in opengl.exe: 0xC0000005: Access violation reading location 0x00000000.
Unhandled exception at 0x00000000 in opengl.exe: 0xC0000005: Access violation reading location 0x00000000.
The program '[4716] opengl.exe: Native' has exited with code 0 (0x0).
a problem wyskakuje mi w pliku GLBatch.cpp przy funkcji pogrubionej
#ifndef OPENGL_ES
glGenVertexArrays(1, &vertexArrayObject);
**glBindVertexArray(vertexArrayObject);**
#endif
konstruktor GLBatch wglada nastepujaco:
GLBatch::GLBatch(void): nNumTextureUnits(0), nNumVerts(0), pVerts(NULL), pNormals(NULL), pColors(NULL), pTexCoords(NULL), uiVertexArray(0),
uiNormalArray(0), uiColorArray(0), **vertexArrayObject(0)**, bBatchDone(false), nVertsBuilding(0), uiTextureCoordArray(NULL)
{
}