Add some font test comments
This commit is contained in:
parent
da9b871626
commit
a8082b6885
@ -20,24 +20,41 @@
|
||||
|
||||
#include "graphics/shader.hpp"
|
||||
#include "ttt/screen_shader.hpp"
|
||||
#include "util/deferred.hpp"
|
||||
#include <tuple>
|
||||
#include <utility> //piecewise_construct
|
||||
|
||||
#include "engine/font.hpp"
|
||||
|
||||
screen_renderer::screen_renderer(gfx::resource_manager& res, int width, int height, gfx::texture& base_tex):
|
||||
m_vbo(s_vertices, sizeof(s_vertices), gfx::vbo::usage::STATIC_DRAW),
|
||||
m_texture(&base_tex),
|
||||
m_screen_width(width), m_screen_height(height)
|
||||
{
|
||||
if(res.has_shader("screen_shader")){
|
||||
m_screen_shader = res.get_shader("screen_shader");
|
||||
}else{
|
||||
m_screen_shader = res.emplace_shader("screen_shader", gfx::shader(screen_shader::vertex_shader_text, gfx::shader::type::VERTEX),
|
||||
gfx::shader(screen_shader::fragment_shader_text, gfx::shader::type::FRAGMENT)).first;
|
||||
}
|
||||
|
||||
m_screen_shader = res.emplace_shader("screen_shader", util::make_deferred<gfx::shader>(screen_shader::vertex_shader_text, gfx::shader::type::VERTEX),
|
||||
util::make_deferred<gfx::shader>(screen_shader::fragment_shader_text, gfx::shader::type::FRAGMENT)).first;
|
||||
|
||||
/* TODO TEMP
|
||||
egn::font_generator f("assets/Butler_Regular.otf");
|
||||
auto font = f.generate_atlas('A', 26, 0, 1024);
|
||||
m_texture = res.emplace_texture("font_atlas_test", font.release_atlas()).first;//util::deferred_function(fn, 256)).first;
|
||||
m_texture->set_filter(gfx::texture::minfilter::NEAREST, gfx::texture::magfilter::NEAREST);
|
||||
|
||||
for(size_t i = 0;i < 4;++i){
|
||||
auto& coords = font['A'].texture_coords[i];
|
||||
debug_print_warn("(%f, %f)\n", coords.x(), coords.y());
|
||||
}
|
||||
m_vbo.buffer(font['Z'].texture_coords[1], sizeof(GLfloat) * 2, offsetof(vertex, tex_coord) + (sizeof(vertex) * 0));
|
||||
m_vbo.buffer(font['Z'].texture_coords[0], sizeof(GLfloat) * 2, offsetof(vertex, tex_coord) + (sizeof(vertex) * 1));
|
||||
m_vbo.buffer(font['Z'].texture_coords[2], sizeof(GLfloat) * 2, offsetof(vertex, tex_coord) + (sizeof(vertex) * 2));
|
||||
m_vbo.buffer(font['Z'].texture_coords[2], sizeof(GLfloat) * 2, offsetof(vertex, tex_coord) + (sizeof(vertex) * 3));
|
||||
m_vbo.buffer(font['Z'].texture_coords[3], sizeof(GLfloat) * 2, offsetof(vertex, tex_coord) + (sizeof(vertex) * 4));
|
||||
m_vbo.buffer(font['Z'].texture_coords[1], sizeof(GLfloat) * 2, offsetof(vertex, tex_coord) + (sizeof(vertex) * 5));
|
||||
*/
|
||||
//attach a vbo to the vao and assign attribute specs
|
||||
m_vao.bind_buffer(m_vbo, 0, 0, sizeof(vertex));
|
||||
auto attrib = m_vao.get_attribute(0);
|
||||
m_vao.bind_buffer(m_vbo, 0, 0, sizeof(vertex));
|
||||
attrib.set_float_array(2, 0);
|
||||
attrib.associate_with(0);
|
||||
attrib.enable();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user