summaryrefslogtreecommitdiff
path: root/code/gl_graphics.h
diff options
context:
space:
mode:
authortalha <talha@talhaamir.xyz>2023-08-30 22:58:18 +0500
committertalha <talha@talhaamir.xyz>2023-08-30 22:58:18 +0500
commit66e84eabf70a11d91abbbe8777b1746573a51bae (patch)
tree3cca9403bde6a97889353b439ec84af5c661d988 /code/gl_graphics.h
parentd980dcd2b66e4879989ce18291d044d5a4ffc902 (diff)
Refactored files:
- moved memory arenas to memory files - replaced r32 and r64 with f32 and f64 - prefixing internal libs with amr_
Diffstat (limited to 'code/gl_graphics.h')
-rw-r--r--code/gl_graphics.h29
1 files changed, 22 insertions, 7 deletions
diff --git a/code/gl_graphics.h b/code/gl_graphics.h
index d97d062..4f52035 100644
--- a/code/gl_graphics.h
+++ b/code/gl_graphics.h
@@ -1,18 +1,33 @@
#ifndef GL_GRAPHICS_H
#define GL_GRAPHICS_H
+typedef struct BufferO {
+ u32 VAO; // Vertex Array Object
+ u32 VBO; // Vertex Buffer Object
+ u32 EBO; // Element Buffer Object
+ u32 TexO; // Texture Buffer Object
+ u32 *TexArray; // Tex Object Array
+} BufferO;
+
+typedef struct Texture2D {
+ i32 width;
+ i32 height;
+ i32 nrChannels;
+ unsigned char* data;
+} Texture2D;
+
void LoadUniformInt(u32 SP, const char *Unifrom, i32 Val);
-void LoadUniformFloat(u32 SP, const char *Uniform, r32 Val);
+void LoadUniformFloat(u32 SP, const char *Uniform, f32 Val);
void LoadUniformVec3(u32 SP, const char *Unifrom, Vec3 Val);
void LoadUniformMat4(u32 SP, const char *Uniform, Mat4 Val);
u32 CreateVertexShader(const char *VertexShaderSource);
u32 CreateFragmentShader(const char *FragmentShaderSource);
u32 CreateShaderProgram(unsigned int VertexShader, unsigned int FragmentShader);
-u32 CreateTriangle(r32 vertices[], i32 sz);
+u32 CreateTriangle(f32 vertices[], i32 sz);
void DrawTriangle(u32 VAO);
-u32 CreateRectangle(r32 vertices[], i32 v_sz, u32 indices[], i32 i_sz);
+u32 CreateRectangle(f32 vertices[], i32 v_sz, u32 indices[], i32 i_sz);
/**
* @note: the texture functions for rectangle are more obtuse and less clear
* they don't make as much sense. And they dont just create something.
@@ -21,13 +36,13 @@ u32 CreateRectangle(r32 vertices[], i32 v_sz, u32 indices[], i32 i_sz);
*
* @todo: I need to probably add the examples to my utils file as notes
* */
-BufferO CreateRectangleTextured(r32 vertices[], i32 v_sz, u32 indices[], i32 i_sz, u32 attr);
-void MakeRectangleTextured(BufferO *bo, r32 vertices[], i32 v_sz, u32 indices[], i32 i_sz, u32 attr);
+BufferO CreateRectangleTextured(f32 vertices[], i32 v_sz, u32 indices[], i32 i_sz, u32 attr);
+void MakeRectangleTextured(BufferO *bo, f32 vertices[], i32 v_sz, u32 indices[], i32 i_sz, u32 attr);
void DrawRectangle(u32 VAO);
void DrawRectangleTextured(u32 VAO, u32 TexO);
-BufferO CreateCube(r32 vertices[], i32 v_sz);
-BufferO CreateCubeTextured(r32 vertices[], i32 v_sz);
+BufferO CreateCube(f32 vertices[], i32 v_sz);
+BufferO CreateCubeTextured(f32 vertices[], i32 v_sz);
void DrawCube(u32 VAO);
GLint GetColorAttrib(u32 nrChannels);