#include #include "GL/glew.h" #include "GL/glu.h" #include "GLFW/glfw3.h" #include GLuint errorCode; void error(int error, const char* description) { printf("%i, %s\n", error, description); } void draw() { int i; glGetIntegerv(GL_DRAW_BUFFER0, &i); printf("%i\n", i); //1029 on xubuntu 13.10 GLfloat red[] = {1.0f, 0.0f, 0.0f, 1.0f}; glClearBufferfv(GL_COLOR, i, red); errorCode = glGetError(); if(errorCode != GL_NO_ERROR) printf("%i, %s\n", errorCode, gluErrorString(errorCode)); } int main() { glewExperimental = true; if(glfwInit() == -1) return -1; glfwSetErrorCallback(error); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); glfwWindowHint(GLFW_RESIZABLE, GL_FALSE); GLFWwindow* window = glfwCreateWindow(800, 600, "OpenGL", NULL, NULL); if(!window) { printf("Window Creation Failed"); return -1; } glfwMakeContextCurrent(window); glewInit(); while(!glfwWindowShouldClose(window)) { glfwSwapBuffers(window); glfwPollEvents(); if(glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS) glfwSetWindowShouldClose(window, GL_TRUE); draw(); } glfwTerminate(); }