I’m new to opengl and trying to solve this issue from last 5 hours but no luck. I checked gl.h header file and it does not declare glClearBufferfv()
. I don’t know why.
#include <GLFW/glfw3.h>
#include <GL/gl.h>
#include <iostream>
int main(void)
{
GLFWwindow* window;
/* Initialize the library */
if (!glfwInit()){
std::cerr<<"Error initializing glfw";
return -1;
}
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
/* Create a windowed mode window and its OpenGL context */
window = glfwCreateWindow(640, 480, "Hello World", NULL, NULL);
if (!window)
{
glfwTerminate();
return -1;
}
std::cout<<GL_VERSION;
/* Make the window's context current */
glfwMakeContextCurrent(window);
//color for clearing
const GLint color[] = {1,0,0,1};
/* Loop until the user closes the window */
while (!glfwWindowShouldClose(window))
{
/* Render here */
glClear(GL_COLOR_BUFFER_BIT);
glClearBufferfv(GL_COLOR,0,color);
/* Swap front and back buffers */
glfwSwapBuffers(window);
/* Poll for and process events */
glfwPollEvents();
}
glfwTerminate();
return 0;
}
here is my makefile:
window: window.cpp
g++ window1.cpp -lGL -lglfw -o window1.out
I wrote a program using glClearColor(1,0,0,1) and glClear(GL_COLOR_BUFFER_BIT); that works but don’t know why when using glClearBufferfv I get error.
Thanks. If any other details are required let me know.
FYI, I’m using Ubuntu. As I said gl.h doesnt have declaration of glClearBufferfv I want to know how can I upgrade/update those headers to have the declaration.