Loading...
Searching...
No Matches
renderer.c
Go to the documentation of this file.
#ifdef ARC_GLFW_WINDOW
#include "arc/graphics/renderer.h"
#include "renderer.h"
// #ifdef ARC_GLEW
#define GLEW_STATIC
#include <GL/glew.h>
// #endif // ARC_GLEW
#include <GLFW/glfw3.h>
#include "arc/graphics/window.h"
#include "arc/std/errno.h"
#include <stdlib.h>
void ARC_Renderer_CreateWithEngineData(ARC_Renderer **renderer, ARC_EngineData *data){
if(!info){
arc_errno = ARC_ERRNO_NULL;
ARC_DEBUG_ERR("ARC_Renderer_Create(**renderer, NULL)");
return;
}
// #ifdef ARC_GLEW
*renderer = (ARC_Renderer *)malloc(sizeof(ARC_Renderer));
(*renderer)->window = (GLFWwindow *)data->window;
glewExperimental = GL_TRUE;
if(glewInit() != GLEW_OK){
ARC_DEBUG_ERR("ARC_Renderer_Create(**renderer, info), GLEW failed to init");
glfwTerminate();
arc_errno = ARC_ERRNO_INIT;
}
// #endif // ARC_GLEW
glClearColor(0.23f, 0.38f, 0.47f, 1.0f);
}
void ARC_Renderer_Destroy(ARC_Renderer *renderer){
free(renderer);
}
void ARC_Renderer_Clear(ARC_Renderer *renderer){
glClear(GL_COLOR_BUFFER_BIT);
}
void ARC_Renderer_Render(ARC_Renderer *renderer){
// #ifdef ARC_GLEW
glfwSwapBuffers(renderer->window);
// #endif // ARC_GLEW
}
#endif //ARC_SDL
errno.h
arc_errno
int32_t arc_errno
Definition errno.c:5
ARC_ERRNO_INIT
#define ARC_ERRNO_INIT
Definition errno.h:11
ARC_ERRNO_NULL
#define ARC_ERRNO_NULL
Definition errno.h:6
renderer.h
ARC_Renderer
struct ARC_RendererType ARC_Renderer
Definition renderer.h:16
ARC_Renderer_CreateWithEngineData
void ARC_Renderer_CreateWithEngineData(ARC_Renderer **renderer, ARC_EngineData *data)
creates ARC_Renderer type with ARC_EngineData
Definition renderer.c:10
ARC_Renderer_Clear
void ARC_Renderer_Clear(ARC_Renderer *renderer)
Definition renderer.c:32
ARC_Renderer_Destroy
void ARC_Renderer_Destroy(ARC_Renderer *renderer)
destroys ARC_Renderer type
Definition renderer.c:28
ARC_Renderer_Render
void ARC_Renderer_Render(ARC_Renderer *renderer)
renders the renderer
Definition renderer.c:39
window.h
renderer.h
ARC_EngineData
Definition engine.h:17
ARC_EngineData::window
ARC_Window * window
Definition engine.h:18