1 일 이상이 소요되었지만 아직 이유를 파악하지 못했습니다. 우분투 9.10을 사용하여 C++에서 작동하는 간단한 OpenGL을 만들려고합니다.GLUT_SINGLE은 검은 색 화면을 표시합니다.
GLUT_SINGLE 매개 변수를 사용할 때마다 나에게 검은 색 화면이 나타납니다. 나는 나가기 위해 그 스크린 위에서 마우스를 무작위로 클릭해야했다. 이것은 너무 성가신 일입니다. 아마도 버그 일 수 있습니다. 아무도 도와 줄 수 있니? 나는 또한 우분투 9.10 사용하고
#include <GL/glut.h>
#include <GL/gl.h>
#include <GL/glu.h>
void myDisplay()
{
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_TRIANGLES);
glVertex3f(-0.5,-0.5,0.0);
glVertex3f(0.5,0.0,0.0);
glVertex3f(0.0,0.5,0.0);
glEnd();
glFlush();
glutSwapBuffers();
}
void myReshape(int a, int b)
{
}
void myMouse(int a, int b, int c, int d)
{
}
void myKeyboard(unsigned char c, int a, int b)
{
}
void myInit()
{
}
int main(int argc, char ** argv)
{
glutInit(&argc,argv); // initiaize the toolkit
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB); // set the display mode
glutInitWindowSize(640,480); // set window size
glutInitWindowPosition(0,0);
glutCreateWindow("first window");
glutDisplayFunc(myDisplay);
glutReshapeFunc(myReshape);
//glutMouseFunc(myMouse);
//glutKeyboardFunc(myKeyboard);
myInit();
glutMainLoop();
return 0;
}
싱글 버퍼링 된 윈도우에서'glSwapBuffers()'를 호출 할 필요가 없습니다. 그래도 효과가 없어야합니다. – Thomas
Win7 x64에서 저에게 잘 작동합니다. –