diff options
| author | navewindre <boneyaard@gmail.com> | 2025-11-28 14:41:22 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-11-28 14:41:22 +0100 |
| commit | 9c05c795d7b59c5ab94fb769f315c712b37df0cd (patch) | |
| tree | 16cccf8cbb88703de798066a06f94013f89a8a5a /src/render/gl_2d_font.cpp | |
| parent | f8b92ce3aa08b1445c9f956d8166830946562d12 (diff) | |
| parent | 3e094f20d4dda90e0356aba3f0abc4b7c7015844 (diff) | |
Merge pull request #1 from navewindre/windows-compat
Windows compat
Diffstat (limited to 'src/render/gl_2d_font.cpp')
| -rw-r--r-- | src/render/gl_2d_font.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/render/gl_2d_font.cpp b/src/render/gl_2d_font.cpp index 1dc498b..10ae71a 100644 --- a/src/render/gl_2d_font.cpp +++ b/src/render/gl_2d_font.cpp @@ -210,22 +210,27 @@ void gl_font_draw( GL_FONT* font, GL_SHADER_PROGRAM* shader, VEC2 origin, const glBindBuffer( GL_ARRAY_BUFFER, shader->gl->vbuffer ); glBufferData( GL_ARRAY_BUFFER, sizeof(VERTEX) * 6 * len, vertices, GL_STATIC_DRAW ); + I32 position = glGetAttribLocation( shader->id, "in_pos" ); + I32 color = glGetAttribLocation( shader->id, "in_clr" ); + I32 texcoord = glGetAttribLocation( shader->id, "in_texcoord" ); + I32 sampler = glGetAttribLocation( shader->id, "in_sampler" ); + glEnableVertexAttribArray( position ); glVertexAttribPointer( position, 2, GL_FLOAT, 0, sizeof(VERTEX), &( (VERTEX*)nullptr)->pos ); - I32 color = glGetAttribLocation( shader->id, "in_clr" ); glEnableVertexAttribArray( color ); glVertexAttribPointer( color, 4, GL_FLOAT, 0, sizeof(VERTEX), &( (VERTEX*)nullptr)->clr ); - I32 texcoord = glGetAttribLocation( shader->id, "in_texcoord" ); glEnableVertexAttribArray( texcoord ); glVertexAttribPointer( texcoord, 2, GL_FLOAT, 0, sizeof(VERTEX), &( (VERTEX*)nullptr)->uv ); - I32 sampler = glGetAttribLocation( shader->id, "in_sampler" ); glEnableVertexAttribArray( sampler ); glVertexAttribPointer( sampler, 1, GL_UNSIGNED_BYTE, 1, sizeof(VERTEX), &( (VERTEX*)nullptr)->sampler ); + glActiveTexture( GL_TEXTURE0 ); + glBindTexture( GL_TEXTURE_2D, font->atlas->id ); + glBindBuffer( GL_ARRAY_BUFFER, 0 ); glActiveTexture( GL_TEXTURE0 ); @@ -234,7 +239,7 @@ void gl_font_draw( GL_FONT* font, GL_SHADER_PROGRAM* shader, VEC2 origin, const glDrawElements( GL_TRIANGLES, len * 6, GL_UNSIGNED_SHORT, indices ); glBindTexture( GL_TEXTURE_2D, 0 ); - + free( vertices ); free( indices ); free( coords ); |
