Hello,
i am new at Open GL and dont know where’s the problem.
I see alsways a black screen. Here is my code (C++):
My System: Virtual Box with Ubuntu inside.
#include <ctype.h>
#include <GL/gl.h>
#include <GL/glut.h>
#include <GL/glx.h>
void display (void)
{
glClearColor (0.0, 0.0, 0.0, 0.0);
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity;
glTranslatef(-1.5, 0,-6);
glBegin(GL_TRIANGLES);
glVertex3f(-1,-1, 0);
glVertex3f( 1,-1, 0);
glVertex3f( 0, 1, 0);
glEnd;
glutSwapBuffers();
}
void keyboard (unsigned char key, int x, int y)
{
if(tolower(key)=='q') exit(0);
}
int main (int argc, char **argv)
{
Display *dpy;
int major, minor;
dpy = XOpenDisplay(NULL);
glXQueryVersion(dpy, &major, &minor);
glutInit(&argc, argv);
glutInitWindowSize(512,512);
glutInitDisplayMode(GLUT_RGB|GLUT_ALPHA|GLUT_DEPTH |GLUT_DOUBLE);
glutCreateWindow("Beispiel: Fenster");
glutDisplayFunc(display);
glutKeyboardFunc(keyboard);
glutMainLoop();
return 0;
}
Thanks for help.