17#ifndef __gui_opengl_font_h__
18#define __gui_opengl_font_h__
35 void initGL (
bool with_shadow =
true);
39 void start (
int width,
int height,
float red,
float green,
float blue)
const {
41 gl::Disable (gl::DEPTH_TEST);
42 gl::DepthMask (gl::FALSE_);
43 gl::Enable (gl::BLEND);
44 gl::BlendEquation (gl::FUNC_ADD);
45 gl::BlendFunc (gl::SRC_ALPHA, gl::ONE_MINUS_SRC_ALPHA);
47 gl::Uniform1f (gl::GetUniformLocation (
program,
"scale_x"), 2.0 / width);
48 gl::Uniform1f (gl::GetUniformLocation (
program,
"scale_y"), 2.0 / height);
49 gl::Uniform1f (gl::GetUniformLocation (
program,
"red"), red);
50 gl::Uniform1f (gl::GetUniformLocation (
program,
"green"), green);
51 gl::Uniform1f (gl::GetUniformLocation (
program,
"blue"), blue);
56 gl::DepthMask (gl::TRUE_);
57 gl::Disable (gl::BLEND);
60 void render (
const std::string& text,
int x,
int y)
const;
GL::VertexArrayObject vertex_array_object
GL::VertexBuffer vertex_buffer[2]
float font_tex_width[256]
void initGL(bool with_shadow=true)
void render(const std::string &text, int x, int y) const
void start(int width, int height, float red, float green, float blue) const
GL::Shader::Program program
const QFontMetrics metric