Вопрос

I have GLUT installed, this is the code that I am compiling with GCC:

#include <GL/glut.h>

void display()
{
    glClearColor(1.0,1.0,1.0,1.0);
    glClear(GL_COLOR_BUFFER_BIT);
    glFlush();
}

int main(int argc, char** argv)
{
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_RGB | GLUT_SINGLE);
    glutInitWindowSize(500,500);
    glutCreateWindow("test");
    glutDisplayFunc(display);
    glutMainLoop();
    return 0;
}

This is how I compile it:

gcc -Wall -o test -lGL -lGLU -lglut test.c

And I get no errors/warnings.

But when I execute it the window doesn't appear. In the panel below I see that there is an application alive named "test", but with no window. It freezes the shell for few seconds and then I press ctrl+c and kill it.

Это было полезно?

Решение

I've found the answer here:

http://ubuntuforums.org/showthread.php?t=1156705

I had to temporarily disable compiz to render the window.

metacity --replace &   # Disables compiz temporarily
./your_prog
compiz --replace &     # Enables compiz again
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top