added node alignment and text color
This commit is contained in:
@@ -65,11 +65,11 @@ void App::init()
|
||||
static const char* shader_font_f =
|
||||
"#version 150\n"
|
||||
"uniform sampler2D tex;"
|
||||
"uniform vec4 col;"
|
||||
"in vec2 uv;"
|
||||
"out vec4 frag;"
|
||||
"void main(){"
|
||||
//" frag = vec4(1,0,0,1);"
|
||||
" frag = texture(tex, uv);"
|
||||
" frag = vec4(texture(tex, uv).r * col.rgb, col.a);"
|
||||
"}";
|
||||
|
||||
#ifdef _WIN32
|
||||
@@ -99,7 +99,8 @@ void App::init()
|
||||
const char* ttf = "/Library/Fonts/Arial.ttf";
|
||||
#endif
|
||||
FontManager::init();
|
||||
FontManager::load(kFont::Arial_11, ttf);
|
||||
FontManager::load(kFont::Arial_11, ttf, 13);
|
||||
FontManager::load(kFont::Arial_30, ttf, 30);
|
||||
|
||||
layout.load("data/layout.xml");
|
||||
//layout["main"].update(width, height);
|
||||
@@ -114,10 +115,6 @@ void App::init()
|
||||
if (!tex.load("data/uvs.jpg"))
|
||||
printf("error loading image\n");
|
||||
|
||||
text.create();
|
||||
text.update(kFont::Arial_11, "hello font");
|
||||
plane.create<1>(400, 400);
|
||||
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glPointSize(5);
|
||||
@@ -168,10 +165,6 @@ void App::update(float dt)
|
||||
glm::mat4 proj = glm::ortho(0.f, width, height, 0.f, -1.f, 1.f);
|
||||
glm::mat4 tran = glm::translate(glm::vec3(200, 200, 0));
|
||||
|
||||
ShaderManager::use(kShader::Font);
|
||||
ShaderManager::u_int(kShaderUniform::Tex, 0);
|
||||
ShaderManager::u_mat4(kShaderUniform::MVP, proj * tran);
|
||||
text.draw();
|
||||
/*
|
||||
static int i = 0;
|
||||
i = (i + 1) % 32;
|
||||
|
||||
Reference in New Issue
Block a user