我在glut_demo.exe中获得了#0x; 0x10005655(glut32.dll)的未处理异常:0xC0000005:访问冲突读取位置0x00000020。"

时间:2015-04-19 15:58:53

标签: opengl visual-studio-2013 glut

当我在visual studio 2013中运行我的项目时,我收到此错误。 “glut_demo.exe中0x10005655(glut32.dll)的未处理异常:0xC0000005:访问冲突读取位置0x00000020。”

代码就在这里:

#include<GL\glut.h>


const GLsizei windowWidth = 500;
const GLsizei windowHeight = 500;

GLvoid drawScene(GLvoid)
{
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();




    glFlush();

    //this line is modified in diff window interfaces.
    glutSwapBuffers();

}

GLvoid timerLoop(int value)
{

    glutPostOverlayRedisplay();

    glutTimerFunc(1, timerLoop, 0);
}

int main(int argc, char *argv[])
{
    // initialize glut
    glutInit(&argc, argv);

    glutInitDisplayMode(GLUT_DOUBLE);

    int windowID = glutCreateWindow("OpenGL CUBE demo");

    glutReshapeWindow(windowWidth, windowHeight);

    glutDisplayFunc(drawScene);

    glutTimerFunc(1, timerLoop, 0);

    glutMainLoop();

    //it never reacheas here.
    return 0;
}

0 个答案:

没有答案