summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/include/engine/core/platform.h2
-rw-r--r--src/core/src/loop.c6
-rw-r--r--src/rendering/src/gl.c31
-rw-r--r--src/resources/include/engine/resources.h2
4 files changed, 34 insertions, 7 deletions
diff --git a/src/core/include/engine/core/platform.h b/src/core/include/engine/core/platform.h
index 3d965b7..e0d2419 100644
--- a/src/core/include/engine/core/platform.h
+++ b/src/core/include/engine/core/platform.h
@@ -47,8 +47,6 @@ typedef struct Platform {
usize bindings_sz;
usize bindings_len;
- struct RenderObject *testobject;
-
binding_t bindings_global[NUM_GLOBAL_BINDINGS];
} Platform;
diff --git a/src/core/src/loop.c b/src/core/src/loop.c
index 635eea4..3974c78 100644
--- a/src/core/src/loop.c
+++ b/src/core/src/loop.c
@@ -395,8 +395,6 @@ i32 engine_run(Platform* p, StateType initial_state, void* state_arg) {
f64 last_fps_measurement = get_time();
/* Main loop */
- //INFO("Program: %d", p->testobject->shaderprogram);
- //GladGLContext *gl = p->window->context;
do {
const f64 now = get_time();
const f64 dt = now - time;
@@ -457,9 +455,7 @@ i32 engine_run(Platform* p, StateType initial_state, void* state_arg) {
(get_time() - state_init_time) * 1000.0);
}
} else {
-//#ifdef BENCHMARK
-// profile_num_drawcalls += drawcall_len;
-//#endif
+
render_begin(p->window);
diff --git a/src/rendering/src/gl.c b/src/rendering/src/gl.c
index b66aef8..390e42b 100644
--- a/src/rendering/src/gl.c
+++ b/src/rendering/src/gl.c
@@ -115,3 +115,34 @@ GLuint LoadShaders(
return ProgramID;
}
+
+/* Prototype it for now, */
+GLuint LoadShaders(
+ const GladGLContext* gl,
+ const char * vertex_file_path,
+ const char * fragment_file_path);
+
+RenderObject RenderObject_new() {
+ GladGLContext *gl = GLOBAL_PLATFORM->window->context;
+ RenderObject o;
+
+ static const float quad[8] = {
+ 0.f, 0.f,
+ 1.f, 0.f,
+ 1.f, 1.f,
+ 0.f, 1.f,
+ };
+
+ // TODO: implement index buffer!
+
+ gl->GenVertexArrays(1, &(o.vao));
+ gl->BindVertexArray(o.vao);
+
+ gl->GenBuffers(1, &(o.vbo));
+ gl->BindBuffer(GL_ARRAY_BUFFER, o.vbo);
+ gl->BufferData(GL_ARRAY_BUFFER, sizeof(quad), quad, GL_STATIC_DRAW);
+
+ o.shader.program = LoadShaders(gl, "shader.vertexshader", "shader.fragmentshader");
+
+ return o;
+}
diff --git a/src/resources/include/engine/resources.h b/src/resources/include/engine/resources.h
index 32e68ac..2659ed9 100644
--- a/src/resources/include/engine/resources.h
+++ b/src/resources/include/engine/resources.h
@@ -71,6 +71,8 @@ struct Resources {
// But with the new way:
// usize assets_len;
// asset_t assets*;
+ Shader* shaders;
+ usize shaders_len;
};
#define Resource_FontDefinition(_path, _fontsize) \