finally compiling and running, text still needs rework
This commit is contained in:
@ -1,8 +1,7 @@
|
||||
#include "twn_gl_15_rendering_c.h"
|
||||
#include "twn_rendering_c.h"
|
||||
#include "townengine/util.h"
|
||||
#include "townengine/config.h"
|
||||
#include "townengine/context.h"
|
||||
#include "twn_util.h"
|
||||
#include "twn_config.h"
|
||||
#include "twn_engine_context_c.h"
|
||||
#include "twn_text_c.h"
|
||||
|
||||
#include <glad/glad.h>
|
||||
@ -206,6 +205,7 @@ void use_texture_mode(enum texture_mode mode) {
|
||||
|
||||
vertex_buffer_builder build_vertex_buffer(vertex_buffer buffer, size_t bytes) {
|
||||
glBindBuffer(GL_ARRAY_BUFFER, buffer);
|
||||
glBufferData(GL_ARRAY_BUFFER, bytes, NULL, GL_STREAM_DRAW);
|
||||
void *mapping = glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY);
|
||||
if (!mapping)
|
||||
CRY("build_vertex_buffer", "Error mapping a vertex array buffer");
|
||||
@ -231,17 +231,19 @@ bool push_to_vertex_buffer_builder(vertex_buffer_builder *builder,
|
||||
return false;
|
||||
}
|
||||
|
||||
builder->mapping = (void *)((uintptr_t)builder->mapping + size);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void finally_render_sprites(const struct primitive_2d primitives[],
|
||||
const struct sprite_batch batch,
|
||||
const vertex_buffer vertex_buffer)
|
||||
const vertex_buffer buffer)
|
||||
{
|
||||
/* TODO: maybe do, dunno */
|
||||
// glBindBuffer(GL_VERTEX_ARRAY, vertex_buffer);
|
||||
(void)vertex_buffer;
|
||||
(void)buffer;
|
||||
|
||||
GLsizei off;
|
||||
GLsizei voff;
|
||||
@ -360,13 +362,13 @@ bool push_sprite_payload_to_vertex_buffer_builder(struct sprite_batch batch,
|
||||
|
||||
void finally_draw_uncolored_space_traingle_batch(const struct mesh_batch *batch,
|
||||
const t_texture_key texture_key,
|
||||
const vertex_buffer vertex_buffer)
|
||||
const vertex_buffer buffer)
|
||||
{
|
||||
const size_t primitives_len = arrlenu(batch->primitives);
|
||||
|
||||
textures_bind(&ctx.texture_cache, texture_key);
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, vertex_buffer);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, buffer);
|
||||
|
||||
/* vertex specification*/
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
@ -399,7 +401,9 @@ bool push_text_payload_to_vertex_buffer_builder(struct font_data const *font_dat
|
||||
stbtt_aligned_quad quad)
|
||||
{
|
||||
(void)font_data;
|
||||
(void)builder;
|
||||
|
||||
/* TODO: use vertex arrays */
|
||||
glTexCoord2f(quad.s0, quad.t0);
|
||||
glVertex2f(quad.x0, quad.y0);
|
||||
glTexCoord2f(quad.s1, quad.t0);
|
||||
@ -408,6 +412,8 @@ bool push_text_payload_to_vertex_buffer_builder(struct font_data const *font_dat
|
||||
glVertex2f(quad.x1, quad.y1);
|
||||
glTexCoord2f(quad.s0, quad.t1);
|
||||
glVertex2f(quad.x0, quad.y1);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -416,6 +422,9 @@ void finally_draw_text(struct font_data const *font_data,
|
||||
t_color color,
|
||||
vertex_buffer buffer)
|
||||
{
|
||||
(void)len;
|
||||
(void)buffer;
|
||||
|
||||
use_texture_mode(TEXTURE_MODE_GHOSTLY);
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, font_data->texture);
|
||||
|
Reference in New Issue
Block a user