tags:

views:

22

answers:

1

Hi

I have the following program

void allocVars(){
    m_window = new GLWindow(); //glGenTexture() is called //CRASH!
    m_window->Init(m_cam.w, m_cam.h, "Window Name"); 

}
void glInit()
{
    glutReshapeFunc(reshape);
    glutIdleFunc(idle);
    glutKeyboardFunc(keyboard);
    glutMouseFunc(mouse);
    glutDisplayFunc(display);

    glBlendFunc(GL_SRC_ALPHA, GL_ONE); //CRASH!
}

int main(int argc, char **argv)
{
    glutInit(&argc, argv);

    glInit(); // CRASH HERE
    camInit(); //ok
    allocVars(); // CRASH HERE

    trackingInit();

    glutMainLoop();


    return 0;

}

Acccording to other posts, in order to make gl calls I have to have a valid openGL context first. (For strange reasons in Windows it works even if the context is not valid yet.) That is why I move everything after glutInit and glInit functions but this application always crashes in gl functions like glGenTextures() inside of allocVars(); in GLWindow(); or in glBlendFunc() inside of glInit()

I wonder what am I missing here and/or how can I check I have a valid opengl context?

Thanks in advance

A: 

answer is in the comments ↑

nacho4d
thanks genpfault
nacho4d