summaryrefslogtreecommitdiff
path: root/src/render/gl_2d.cpp
diff options
context:
space:
mode:
authornavewindre <boneyaard@gmail.com>2025-11-27 17:19:02 +0100
committernavewindre <boneyaard@gmail.com>2025-11-27 17:21:48 +0100
commite3de3ba5162f7ddd5005911124d4333e140fd984 (patch)
treeefb2d3851940ba1b70f0105611cddb17344e7e32 /src/render/gl_2d.cpp
parent5c8bbc3bc618068af1f7d6f2829c4346570c2ab9 (diff)
bunch o stuff
Diffstat (limited to 'src/render/gl_2d.cpp')
-rw-r--r--src/render/gl_2d.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/render/gl_2d.cpp b/src/render/gl_2d.cpp
index 1803eb5..78af1da 100644
--- a/src/render/gl_2d.cpp
+++ b/src/render/gl_2d.cpp
@@ -104,25 +104,33 @@ void gl_2d_textured_frect( GL_SHADER_PROGRAM* gl2d, VEC2 origin, VEC2 dim, GL_TE
glBindBuffer( GL_ARRAY_BUFFER, gl2d->gl->vbuffer );
glBufferData( GL_ARRAY_BUFFER, sizeof(vertices), &vertices[0], GL_DYNAMIC_DRAW );
+
I32 position = glGetAttribLocation( gl2d->id, "in_pos" );
+ I32 color = glGetAttribLocation( gl2d->id, "in_col" );
+ I32 texcoord = glGetAttribLocation( gl2d->id, "in_texcoord" );
+ I32 sampler = glGetAttribLocation( gl2d->id, "in_sampler" );
+
glEnableVertexAttribArray( position );
glVertexAttribPointer( position, 2, GL_FLOAT, 0, sizeof(VERTEX), 0 );
- I32 color = glGetAttribLocation( gl2d->id, "in_col" );
+
glEnableVertexAttribArray( color );
glVertexAttribPointer( color, 4, GL_FLOAT, 0, sizeof(VERTEX), &( (VERTEX*)nullptr)->clr );
- I32 texcoord = glGetAttribLocation( gl2d->id, "in_texcoord" );
+
glEnableVertexAttribArray( texcoord );
glVertexAttribPointer( texcoord, 2, GL_FLOAT, 0, sizeof(VERTEX), &( (VERTEX*)nullptr)->uv );
- I32 sampler = glGetAttribLocation( gl2d->id, "in_sampler" );
+
glEnableVertexAttribArray( sampler );
glVertexAttribPointer( sampler, 1, GL_UNSIGNED_BYTE, 1, sizeof(VERTEX), &( (VERTEX*)nullptr)->sampler );
+ glActiveTexture( GL_TEXTURE0 );
+ glBindTexture( GL_TEXTURE_2D, texture->id );
+
glBindBuffer( GL_ARRAY_BUFFER, 0 );
glActiveTexture( GL_TEXTURE0 );
glBindTexture( GL_TEXTURE_2D, texture->id );
- glUniform1f( glGetUniformLocation( gl2d->id, "in_time" ), u_time() );
+ // glUniform1f( glGetUniformLocation( gl2d->id, "in_time" ), u_time() );
glDrawElements( GL_TRIANGLE_STRIP, 4, GL_UNSIGNED_SHORT, order );
glBindTexture( GL_TEXTURE_2D, 0 );