xFrednet
xFrednet

Reputation: 33

glewinit() failes with glewExperimental=GL_TRUE;

i use this bit of code:

#include <glew.h>
#include <freeglut.h>

#include <iostream>


void DisplayManager::createWindow(int argv, char** argc) {
    glutInit(&argv, argc);

    std::cout << "GLEW Version : " << GLEW_VERSION << std::endl;
    glewExperimental = TRUE;
    if (glewInit() != GLEW_OK) {
        std::cout << "glewInit failed, aborting." << std::endl;
    }

    glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA);

    glutInitWindowPosition(windowX, windowY);
    glutInitWindowSize(width, height);
    glutCreateWindow(title);

    glutDisplayFunc(displayFunktion);

    glClearColor(1.0f, 0.0f, 1.0f, 1.0f);
    std::cout << "created Window" << std::endl;
}

the console Output is:

GLEW Version: 1

glewInit failed, aborting.

created Window

as far as i know i have installed glew correctly, glut is also working fine.

Upvotes: 1

Views: 2195

Answers (1)

Xirema
Xirema

Reputation: 20396

GLEW cannot be initialized until you have a valid context current in the OpenGL state. In practical terms, this usually means you have to wait to call it until after the window has been created.

Upvotes: 4

Related Questions