GLUT

This is supposed to make a cube, and then color the cube, and color the background, the background gets colored, but the cube is no where to be seen, and there are 0 errors.


#ifdef __APPLE__
#include <GLUT/glut.h>
#else
#include <GL/glut.h>
#endif

#include <stdlib.h>



void KeyUp(int key, int x, int y){



}

void cube(void){
glColor4f(1.0, 0.0, 0.0, 0.2);
glutSolidCube(4);
glColor4f(0.0, 1.0, 0.0, 0.5);
}

void display(void){
glClearColor(1.0f,0.0f,0.0f,1.0);
glClear(GL_COLOR_BUFFER_BIT);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glLoadIdentity();
cube();
glutSwapBuffers();
}

int main(int argc, char **argv) {

glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA);
glutInitWindowPosition(100,100);
glutInitWindowSize(320,320);
glutCreateWindow("Dimension");
glutDisplayFunc(display);

glLoadIdentity();

glutSpecialFunc(KeyUp);

glutMainLoop();

return 0;
}
Your pen is the same color as your paper
Your drawing is too big
Topic archived. No new replies allowed.