This repository has been archived on 2022-05-21. You can view files and clone it, but cannot push or open issues or pull requests.
LEFTONE/core/loshader/hud_text.c
falsycat 80b3b82332 [RELEASE] u22-v04
This version is submitted for U22 final presentation. (squashed 158 commits)
2021-02-07 00:00:00 +00:00

43 lines
1.2 KiB
C

#include "./hud_text.h"
#include <assert.h>
#include "util/gleasy/program.h"
#include "util/gleasy/texture.h"
#include "util/glyphas/drawer.h"
#include "./text.h"
#include "./uniblock.h"
/* resources */
#include "core/loshader/anysrc/header.shader.h"
#include "core/loshader/anysrc/hud_text.vshader.h"
#include "core/loshader/anysrc/hud_text.fshader.h"
#define UNIFORM_ALPHA_ 1 /* 0 is used by the super class */
void loshader_hud_text_drawer_initialize(
loshader_hud_text_drawer_t* drawer,
const loshader_uniblock_t* uniblock,
gleasy_texture_2d_t tex) {
assert(drawer != NULL);
assert(uniblock != NULL);
assert(tex != 0);
const gleasy_program_t prog = gleasy_program_new(
loshader_header_shader_, sizeof(loshader_header_shader_),
loshader_hud_text_vshader_, sizeof(loshader_hud_text_vshader_),
loshader_hud_text_fshader_, sizeof(loshader_hud_text_fshader_));
loshader_text_drawer_initialize(&drawer->super, prog, uniblock, tex);
}
void loshader_hud_text_drawer_draw(const loshader_hud_text_drawer_t* drawer) {
assert(drawer != NULL);
glUseProgram(drawer->super.prog);
glUniform1f(UNIFORM_ALPHA_, drawer->alpha);
loshader_text_drawer_draw_without_use_program(&drawer->super);
}