OpenGL nvoglv32.dll erreur

Mon programme compile bien, mais quand je le lance, il se bloque à glDrawArrays(GL_TRIANGLE_STRIP, 0, 4), disant:

Unhandled exception at 0x50D6C94E (nvoglv32.dll) in Chapter 2.exe: 0xC0000005: Access violation reading location 0x00000000.

Une page apparaît également que dit nvoglv32.apb n'est pas chargé. J'ai vérifié pour voir si les pointeurs et les valeurs qui me sont passé étaient correctes, et affirment ne pas ramasser quoi que ce soit.

Voici le code

Exemple.h

#include <windows.h>
#include "Example.h"
#include <iostream>
#include <gl\GLU.h>
#include <gl\glext.h>
#include "BufferUtilities.h"

bool Example::init()
{
    if (!start())
    {
        return false;
    }

    glEnable(GL_DEPTH_TEST);
    glClearColor(0.5f, 0.5f, 0.5f, 0.5f);

    GLfloat verticies[] = {
        -2.0f, -2.0f, -2.0f,
        2.0f, -2.0f, -2.0f,
        -2.0f, -2.0f, 2.0f,
        2.0f, -2.0f, 2.0f,
    };

    GLfloat colors[] = {
        1.0f, 0.0f, 0.0f,
        0.0f, 1.0f, 0.0f,
        0.0f, 0.0f, 1.0f,
        1.0f, 1.0f, 0.0f,
    };

    createArrayBuffer(verticies, &vertexBuffer, GL_STATIC_DRAW);
    createArrayBuffer(colors, &colorBuffer, GL_STATIC_DRAW);

    glEnableClientState(GL_COLOR_ARRAY);
    glEnableClientState(GL_VERTEX_ARRAY);

    return true;
}

void Example::render()
{
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glLoadIdentity();

    bindAndPoint(&colorBuffer, 3);

    bindAndPoint(&vertexBuffer, 3);

    glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}

BufferUtilities.h

#pragma once
#include <Windows.h>
#include <gl\GL.h>
#include <gl\GLU.h>
#include <gl\GLEXT.h>
#include <gl\wglext.h>
#include <iostream>
#include <assert.h>
#define BUFFER_OFFSET(i) ((char *)NULL+(i))
static PFNGLGENBUFFERSARBPROC glGenBuffers = NULL;
static PFNGLBINDBUFFERPROC glBindBuffer = NULL;
static PFNGLBUFFERDATAPROC glBufferData = NULL;
inline bool start()
{
glGenBuffers = (PFNGLGENBUFFERSARBPROC)wglGetProcAddress("glGenBuffers");
glBindBuffer = (PFNGLBINDBUFFERPROC)wglGetProcAddress("glBindBuffer");
glBufferData = (PFNGLBUFFERDATAPROC)wglGetProcAddress("glBufferData");  
if (!glGenBuffers|| !glBindBuffer || !glBufferData)
{
std::cerr << "Vertex buffer objects are not supported by your graphics card." << std::endl;
return false;
}
return true;
}
inline void createArrayBuffer(GLfloat *array, GLuint *buffer, GLenum usage)
{
assert(array != NULL);
assert(buffer != NULL);
assert(usage != NULL);
glGenBuffers(1, buffer);
glBindBuffer(GL_ARRAY_BUFFER, *buffer);
glBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat) * (sizeof(array) / sizeof(array[0])), &array[0], usage);
}
inline void bindAndPoint(GLuint *buffer, int size)
{
assert(buffer != NULL);
assert(size != NULL);
glBindBuffer(GL_ARRAY_BUFFER, *buffer);
glColorPointer(size, GL_FLOAT, 0, BUFFER_OFFSET(0));
}
  • Quel système d'exploitation utilisez-vous ceci? Comment avez-vous mis en place OpenGL en premier lieu? Edit: nevermind, vous êtes sur Windows à l'aide de GLU
InformationsquelleAutor Ghilliedrone | 2014-07-02