Now rendering fonts separately from the scene render.
This commit is contained in:
parent
b244c903a6
commit
3231f747a9
5 changed files with 21 additions and 10 deletions
|
|
@ -119,8 +119,18 @@ void update(GLFWwindow* window, Scene& scene) {
|
|||
scene.update();
|
||||
}
|
||||
|
||||
void render(GLFWwindow* window, Scene& scene) {
|
||||
void render(GLFWwindow* window, Scene& scene, Text& text) {
|
||||
scene.render(window);
|
||||
float scale = 0.5f;
|
||||
|
||||
float X_height = text.characters['X'].size.y * scale + 0.5f;
|
||||
float y = 0.0f;
|
||||
|
||||
for(int i = 0; i < 100; i++) {
|
||||
y += X_height;
|
||||
text.render(std::format("y={}", y), 25.0f, y, scale, glm::vec3(1.0, 0.0f, 0.0f));
|
||||
}
|
||||
|
||||
glfwSwapBuffers(window);
|
||||
}
|
||||
|
||||
|
|
@ -134,12 +144,13 @@ int main() {
|
|||
|
||||
auto window = create_window();
|
||||
auto scene = setup();
|
||||
Text text;
|
||||
|
||||
glfwSetWindowUserPointer(window, &scene);
|
||||
|
||||
while(!glfwWindowShouldClose(window)) {
|
||||
update(window, scene);
|
||||
render(window, scene);
|
||||
render(window, scene, text);
|
||||
}
|
||||
|
||||
quit(window, scene);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue