wow
This commit is contained in:
parent
a4f8c8a975
commit
58de3bbbeb
1 changed files with 24 additions and 0 deletions
|
|
@ -3,6 +3,25 @@
|
||||||
MwWidget root, window, opengl;
|
MwWidget root, window, opengl;
|
||||||
|
|
||||||
static void resize(MwWidget handle, void* user, void* client){
|
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(){
|
int main(){
|
||||||
|
|
@ -20,7 +39,12 @@ int main(){
|
||||||
|
|
||||||
MwOpenGLMakeCurrent(opengl);
|
MwOpenGLMakeCurrent(opengl);
|
||||||
|
|
||||||
|
gladLoadGLLoader(gl_load);
|
||||||
|
|
||||||
|
resize(window, NULL, NULL);
|
||||||
|
|
||||||
MwAddUserHandler(window, MwNresizeHandler, resize, NULL);
|
MwAddUserHandler(window, MwNresizeHandler, resize, NULL);
|
||||||
|
MwAddUserHandler(root, MwNtickHandler, tick, NULL);
|
||||||
|
|
||||||
MwLoop(root);
|
MwLoop(root);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue