added some opengl files TODO: fix up using glew as optional
This commit is contained in:
parent
c614c679a9
commit
d170a64a41
24 changed files with 164 additions and 93 deletions
|
|
@ -1,36 +0,0 @@
|
|||
#ifdef ARC_GLFW
|
||||
#include "arc/graphics/window.h"
|
||||
#include "arc/graphics/opengl/window.h"
|
||||
|
||||
#include "arc/std/errno.h"
|
||||
#include <GLFW/glfw3.h>
|
||||
#include <stdio.h>
|
||||
|
||||
void framebufferSizeCallback(GLFWwindow *window, int width, int height){
|
||||
glViewport(0, 0, width, height);
|
||||
}
|
||||
|
||||
void ARC_Window_Create(ARC_Window **window, ARC_WindowInfo *info){
|
||||
glfwInit();
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
|
||||
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
|
||||
glfwWindowHint(GLFW_FLOATING, GLFW_TRUE);
|
||||
|
||||
*window = (ARC_Window *) glfwCreateWindow(info->w, info->h, "learnopengl window", NULL, NULL);
|
||||
if(*window == NULL){
|
||||
printf("Failed to create GLFW window\n");
|
||||
glfwTerminate();
|
||||
arc_errno = ARC_ERRNO_NULL;
|
||||
}
|
||||
|
||||
glfwMakeContextCurrent((GLFWwindow *)*window);
|
||||
glViewport(0, 0, info->w, info->h);
|
||||
glfwSetFramebufferSizeCallback((GLFWwindow *)*window, framebufferSizeCallback);
|
||||
}
|
||||
|
||||
void ARC_Window_Destroy(ARC_Window *window){
|
||||
glfwTerminate();
|
||||
}
|
||||
|
||||
#endif //ARC_GLFW
|
||||
Loading…
Add table
Add a link
Reference in a new issue