以下のコードを修正しました (3.2 OGL コンテキスト ビットは機能しないためコメント化されています - 上記のように空白の画面):
//c-libs
#include <stdlib.h>
//opengl
#include <OpenGL/gl3.h>
#include <OpenGL/gl.h>
#include <OpenGL/glu.h>
//glfw
#define GLFW_INCLUDE_GL3 /* don't drag in legacy GL headers. */
#define GLFW_NO_GLU /* don't drag in the old GLU lib - unless you must. */
#include <GL/glfw.h>
int init() {
//init glfw
if( !glfwInit() )
return -1;
//DOES NOT WORK
//set to version 3.2 & use core profile
//glfwOpenWindowHint(GLFW_OPENGL_VERSION_MAJOR, 3);
//glfwOpenWindowHint(GLFW_OPENGL_VERSION_MINOR, 2);
//glfwOpenWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
//glfwOpenWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
/* Create a windowed mode window and its OpenGL context */
if (!glfwOpenWindow(1000, 500, 5, 6, 5, 0, 0, 0, GLFW_WINDOW))
return -1;
glfwSetWindowTitle( "My Amazing Super Fantastic Window" );
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
float aspect_ratio = ((float)1000) / 500;
glFrustum(.5, -.5, -.5 * aspect_ratio, .5 * aspect_ratio, 1, 50);
glMatrixMode(GL_MODELVIEW);
return 1;
}
int main(int argc, char *argv[])
{
if( !init() )
return -1;
/* Loop until the user closes the window */
int running = GL_TRUE;
while (1)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
// reset view matrix
glLoadIdentity();
// move view back a bit
glTranslatef(0, 0, -30);
// by repeatedly rotating the view matrix during drawing, the
// squares end up in a circle
int i = 0, squares = 15;
float red = 1, blue = 1, green = 1;
for (; i < squares; ++i){
glRotatef(360.0/squares, 0, 0, 1);
glBegin(GL_QUADS); {
glColor3f(red, green, blue);
glVertex2i(1, 11);
glColor3f(red * .8, green * .8, blue * .8);
glVertex2i(-1, 11);
glColor3f(red * .5, green * .5, blue * .5);
glVertex2i(-1, 9);
glColor3f(red * .8, green * .8, blue * .8);
glVertex2i(1, 9);
} glEnd();
}
/* Swap front and back buffers and process events */
glfwSwapBuffers();
}
return 0;
}