mirror of
https://github.com/IllusionMan1212/cudoku.git
synced 2026-10-24 02:12:25 +00:00
square board and properly fit inside window
This commit is contained in:
@@ -3,10 +3,10 @@
|
||||
#include "shader.h"
|
||||
|
||||
static const float quad_vertices[] = {
|
||||
-0.5f, 1.0f, 0.0f, // top left
|
||||
0.5f, 1.0f, 0.0f, // top right
|
||||
-0.5f, -1.0f, 0.0f, // bottom left
|
||||
0.5f, -1.0f, 0.0f, // bottom right
|
||||
-1.0f, 1.0f, 0.0f, // top left
|
||||
1.0f, 1.0f, 0.0f, // top right
|
||||
-1.0f, -1.0f, 0.0f, // bottom left
|
||||
1.0f, -1.0f, 0.0f, // bottom right
|
||||
};
|
||||
|
||||
static const int quad_indices[] = {
|
||||
@@ -34,9 +34,18 @@ unsigned int prepare_bg_rect() {
|
||||
return vao;
|
||||
}
|
||||
|
||||
void draw_bg_rect(Shader shader, unsigned int vao) {
|
||||
void draw_bg_rect(Shader shader, unsigned int vao, float x_scale, float y_scale) {
|
||||
use_shader(shader);
|
||||
|
||||
float mat[4][4] = {
|
||||
{x_scale, 0, 0, 0},
|
||||
{0, y_scale, 0, 0},
|
||||
{0, 0, 1, 0},
|
||||
{0, 0, 0, 1},
|
||||
};
|
||||
|
||||
set_mat4(shader, "transform", (float *)mat);
|
||||
|
||||
glBindVertexArray(vao);
|
||||
glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user