|
|
|
|
@ -12,7 +12,7 @@ using glm::vec4;
|
|
|
|
|
|
|
|
|
|
// forward declarations
|
|
|
|
|
|
|
|
|
|
bool initGraphics(SDLHandles* handles); |
|
|
|
|
bool initGraphics(SDLHandles* handles, const char* title, uvec2 dims); |
|
|
|
|
|
|
|
|
|
LightsBuffer* initLights(RenderState* rs, u32 max_lights, vec4 ambient_color); |
|
|
|
|
|
|
|
|
|
@ -20,7 +20,9 @@ LightsBuffer* initLights(RenderState* rs, u32 max_lights, vec4 ambient_color);
|
|
|
|
|
// interface
|
|
|
|
|
|
|
|
|
|
RenderState* |
|
|
|
|
initRenderState(GLClearColor clear_col, |
|
|
|
|
initRenderState(const char* window_title, |
|
|
|
|
uvec2 window_dims, |
|
|
|
|
GLClearColor clear_col, |
|
|
|
|
vec4 ambient_color, |
|
|
|
|
u32 max_models, |
|
|
|
|
u32 max_textures, |
|
|
|
|
@ -46,7 +48,7 @@ initRenderState(GLClearColor clear_col,
|
|
|
|
|
rs->render_groups = ARENA_ALLOC(rs->rg_arena, RenderGroup, |
|
|
|
|
DEFAULT_RENDER_GROUP_COUNT); |
|
|
|
|
|
|
|
|
|
if (!initGraphics(&rs->handles)) { |
|
|
|
|
if (!initGraphics(&rs->handles, window_title, window_dims)) { |
|
|
|
|
LOGF(Error, "error initializing renderer\n"); |
|
|
|
|
return nullptr; |
|
|
|
|
} |
|
|
|
|
@ -267,14 +269,14 @@ getVertexAttribByType(ShaderProgram* shader, MeshBufferType buf_type)
|
|
|
|
|
// internal
|
|
|
|
|
|
|
|
|
|
bool |
|
|
|
|
initGraphics(SDLHandles* handles) |
|
|
|
|
initGraphics(SDLHandles* handles, const char* title, uvec2 dims) |
|
|
|
|
{ |
|
|
|
|
handles->window = SDL_CreateWindow( |
|
|
|
|
"shader_testing", |
|
|
|
|
title, |
|
|
|
|
SDL_WINDOWPOS_CENTERED_DISPLAY(0), |
|
|
|
|
SDL_WINDOWPOS_CENTERED_DISPLAY(0), |
|
|
|
|
1280, |
|
|
|
|
720, |
|
|
|
|
dims.x, |
|
|
|
|
dims.y, |
|
|
|
|
SDL_WINDOW_OPENGL|SDL_WINDOW_RESIZABLE); |
|
|
|
|
|
|
|
|
|
if (SDL_Init(SDL_INIT_VIDEO) != 0) { |
|
|
|
|
|