Reputation: 97
Whenever build and run this piece of code in Xcode 5, with of the respective library computer display bugs out. It is hard to se but you can see that the window is appearing with the triangle.
Not sure if this makes a difference but I am running on OSX 1.9.2
#include <iostream>
#include <OpenGL/gl.h>
#include <OpenAL/al.h>
#include <OpenAL/alc.h>
#include <GLUT/glut.h>
int windowwitch= 1280;
int wndowhight=800;
using namespace std;
void display();
int main(int argc, char ** argv){
glutInit(&argc, argv);
glutInitWindowPosition(0, 0);
glutInitWindowSize(windowwitch, wndowhight);
glutInitDisplayMode(GL_RGBA12 | GLUT_DOUBLE |GLUT_DEPTH);
glutCreateWindow("Alex's Game!!");
glutDisplayFunc(display);
//Main loop
glutMainLoop();
return 0;
}
void display(){
glClear(GL_COLOR_BUFFER_BIT| GL_DEPTH_BITS);
glLoadIdentity();
glBegin(GL_TRIANGLES);
glVertex2f(-2, -2);
glVertex2f(0, 1);
glVertex2f(1,-1);
glEnd();
glutSwapBuffers();
}
Upvotes: 1
Views: 171
Reputation: 52113
glutInitDisplayMode(GL_RGBA12 | GLUT_DOUBLE |GLUT_DEPTH);
^^^^^^^^^
GL_RGBA12
is not a valid argument for glutInitDisplayMode()
.
Use GLUT_RGBA
or GLUT_RGB
instead.
glClear(GL_COLOR_BUFFER_BIT| GL_DEPTH_BITS);
^^^^^^^^^^^^^
GL_DEPTH_BITS
is not a valid argument for glClear()
.
Use GL_DEPTH_BUFFER_BIT
instead.
Upvotes: 1