This commit is contained in:
Nishi 2025-12-19 03:08:40 +09:00
commit 58de3bbbeb
Signed by: nishi
GPG key ID: 27EF69B208EB9343

View file

@ -3,6 +3,25 @@
MwWidget root, window, opengl;
static void resize(MwWidget handle, void* user, void* client){
int ww = MwGetInteger(window, MwNwidth);
int wh = MwGetInteger(window, MwNheight);
MwVaApply(opengl,
MwNwidth, ww,
MwNheight, wh,
NULL);
glViewport(0, 0, ww, wh);
}
static void tick(MwWidget handle, void* user, void* client){
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
MwOpenGLSwapBuffer(opengl);
}
static void* gl_load(const char* name){
return MwOpenGLGetProcAddress(opengl, name);
}
int main(){
@ -20,7 +39,12 @@ int main(){
MwOpenGLMakeCurrent(opengl);
gladLoadGLLoader(gl_load);
resize(window, NULL, NULL);
MwAddUserHandler(window, MwNresizeHandler, resize, NULL);
MwAddUserHandler(root, MwNtickHandler, tick, NULL);
MwLoop(root);
}