So that i can load OBJ files and have them rendered in my openGL window. So far i've managed to:
- create an OpenGL context and window using glfw3
- created an executable (of test.cc, and its associated libraries and headers) which just outputs OBJ vertices as text in the terminal
I would like to visually render these vertices in my openGL window, so i guess this involves combining the two, but how is the question? I assuming my openGL context assimilates the obj importer, not the other way round, but where in the code would it go:
#include <GLFW/glfw3.h>
#include <GLUT/glut.h>
int main(void)
{
GLFWwindow* window;
/* Initialize the library */
if (!glfwInit())
return -1;
/* Create a windowed mode window and its OpenGL context */
window = glfwCreateWindow(640, 480, "Hello World", NULL, NULL);
if (!window)
{
glfwTerminate();
return -1;
}
/* Make the window's context current */
glfwMakeContextCurrent(window);
/* Loop until the user closes the window */
while (!glfwWindowShouldClose(window))
{
/* Render here */
/* clearing */
glClear(GL_COLOR_BUFFER_BIT);
/* Swap front and back buffers */
glfwSwapBuffers(window);
/* Poll for and process events */
glfwPollEvents();
}
glfwTerminate();
return 0;
}
or do I have to link to it externally?