diff options
| author | navewindre <boneyaard@gmail.com> | 2025-09-10 12:25:00 +0200 |
|---|---|---|
| committer | navewindre <boneyaard@gmail.com> | 2025-09-10 12:25:00 +0200 |
| commit | 235926dadb686589f0b5480162c3ab929159e570 (patch) | |
| tree | 9fc482720a2bafabaca207befbc611d373d1c7ca /src/render/gl_2d_font.cpp | |
| parent | 8be4ca70798fafd57dba947edfb18d0de594013d (diff) | |
unfuck
Diffstat (limited to 'src/render/gl_2d_font.cpp')
| -rw-r--r-- | src/render/gl_2d_font.cpp | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/src/render/gl_2d_font.cpp b/src/render/gl_2d_font.cpp index a104124..329f0be 100644 --- a/src/render/gl_2d_font.cpp +++ b/src/render/gl_2d_font.cpp @@ -211,31 +211,23 @@ 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" ); - - if (position >= 0) { - glEnableVertexAttribArray( position ); - glVertexAttribPointer( position, 2, GL_FLOAT, 0, sizeof(VERTEX), &( (VERTEX*)nullptr)->pos ); - } - if (color >= 0) { - glEnableVertexAttribArray( color ); - glVertexAttribPointer( color, 4, GL_FLOAT, 0, sizeof(VERTEX), &( (VERTEX*)nullptr)->clr ); - } + glEnableVertexAttribArray( position ); + glVertexAttribPointer( position, 2, GL_FLOAT, 0, sizeof(VERTEX), &( (VERTEX*)nullptr)->pos ); - if (texcoord >= 0) { - glEnableVertexAttribArray( texcoord ); - glVertexAttribPointer( texcoord, 2, GL_FLOAT, 0, sizeof(VERTEX), &( (VERTEX*)nullptr)->uv ); - } + glEnableVertexAttribArray( color ); + glVertexAttribPointer( color, 4, GL_FLOAT, 0, sizeof(VERTEX), &( (VERTEX*)nullptr)->clr ); - if (sampler >= 0) { - glEnableVertexAttribArray( sampler ); - glVertexAttribPointer( sampler, 1, GL_UNSIGNED_BYTE, 1, sizeof(VERTEX), &( (VERTEX*)nullptr)->sampler ); - } + glEnableVertexAttribArray( texcoord ); + glVertexAttribPointer( texcoord, 2, GL_FLOAT, 0, sizeof(VERTEX), &( (VERTEX*)nullptr)->uv ); + + glEnableVertexAttribArray( sampler ); + glVertexAttribPointer( sampler, 1, GL_UNSIGNED_BYTE, 1, sizeof(VERTEX), &( (VERTEX*)nullptr)->sampler ); glActiveTexture( GL_TEXTURE0 ); glBindTexture( GL_TEXTURE_2D, font->atlas->id ); |
