opengl_x11

Playing with OpenGL
git clone git://bsandro.tech/opengl_x11
Log | Files | Refs | README | LICENSE

commit 71eb5d10c9e4e0b1b1237534b1f82cca01a2b3e5
parent cf43653b6fb397f55bff8958d8590afeaf688ad7
Author: bsandro <email@bsandro.tech>
Date:   Fri, 21 Nov 2025 01:39:20 +0200

cubes are 800x600

Diffstat:
Mcube.c | 5++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/cube.c b/cube.c @@ -56,7 +56,6 @@ static const GLchar *fragmentSrc = R"( #version 420 uniform double iTime; uniform sampler2D ourTex; -//uniform mat4 trans; out vec4 outColor; in vec2 texCoord; void main() { @@ -155,7 +154,7 @@ int main(int argc, char *argv[]) { Colormap cmap = XCreateColormap(dpy, root, vi->visual, AllocNone); swa.colormap = cmap; swa.event_mask = ExposureMask | KeyPressMask; - win = XCreateWindow(dpy, root, 0, 0, 500, 500, 0, vi->depth, InputOutput, vi->visual, CWColormap | CWEventMask, &swa); + win = XCreateWindow(dpy, root, 0, 0, 800, 600, 0, vi->depth, InputOutput, vi->visual, CWColormap | CWEventMask, &swa); XMapWindow(dpy, win); XStoreName(dpy, win, "OPENGL"); GLXContext ctx = glXCreateContext(dpy, vi, NULL, GL_TRUE); @@ -266,7 +265,7 @@ int main(int argc, char *argv[]) { glm_mat4_identity(view); glm_translate(view, (vec3){0.f, 0.f, -3.f}); mat4 projection; - glm_perspective(glm_rad(45.f), 800.f/600.f, 0.1f, 100.f, projection); + glm_perspective(glm_rad(45.f), 4.f/3.f, 0.1f, 100.f, projection); glm_mat4_print(model, stdout); glm_mat4_print(view, stdout);