opengl stuff
Some checks failed
pyrite-dev/milsko/pipeline/head There was a failure building this commit

This commit is contained in:
Nishi 2026-04-28 13:18:59 +09:00
commit 095867ce70
2 changed files with 22 additions and 16 deletions

2
WatMakefile generated
View file

@ -1,7 +1,7 @@
CC = wcc386 -bt=nt -q -bd CC = wcc386 -bt=nt -q -bd
LD = wlink option quiet LD = wlink option quiet
CFLAGS = -i=include -i=external/libz/include -d_MILSKO -dUSE_GDI -dUSE_STB_TRUETYPE -dUSE_STB_IMAGE -dSTBI_NO_SIMD -dUSE_CLASSIC_THEME CFLAGS = -i=include -i=external/libz/include -d_MILSKO -dUSE_GDI -dUSE_STB_TRUETYPE -dUSE_STB_IMAGE -dSTBI_NO_SIMD
LDFLAGS = system nt_dll LDFLAGS = system nt_dll
all: src/Mw.dll all: src/Mw.dll
clean: .SYMBOLIC clean: .SYMBOLIC

View file

@ -129,15 +129,21 @@ static int wcreate(MwWidget handle) {
SetPixelFormat(o->dc, pf, &pfd); SetPixelFormat(o->dc, pf, &pfd);
o->lib = MwDynamicOpen("opengl32.dll"); o->lib = MwDynamicOpen("opengl32.dll");
if(!o->lib){
printf("Could not load OpenGL widget under WGL! " #x " missing.\n"); \
return 1;
}
o->wglCreateContext = #define WGL_FUNC(x) o->x = MwDynamicSymbol(o->lib, #x); \
(MWwglCreateContext)(void*)MwDynamicSymbol(o->lib, "wglCreateContext"); if(o->x == NULL){ \
o->wglMakeCurrent = printf("Could not load OpenGL widget under WGL! " #x " missing.\n"); \
(MWwglMakeCurrent)(void*)MwDynamicSymbol(o->lib, "wglMakeCurrent"); return 1; \
o->wglDeleteContext = }
(MWwglDeleteContext)(void*)MwDynamicSymbol(o->lib, "wglDeleteContext");
o->wglGetProcAddress = (MWwglGetProcAddress)(void*)MwDynamicSymbol( WGL_FUNC(wglCreateContext);
o->lib, "wglGetProcAddress"); WGL_FUNC(wglMakeCurrent);
WGL_FUNC(wglDeleteContext);
WGL_FUNC(wglGetProcAddress);
o->gl = o->wglCreateContext(o->dc); o->gl = o->wglCreateContext(o->dc);
} }
@ -269,19 +275,19 @@ static int wcreate(MwWidget handle) {
eglGetDisplay((EGLNativeDisplayType)handle->lowlevel->wayland.display); eglGetDisplay((EGLNativeDisplayType)handle->lowlevel->wayland.display);
if(display == EGL_NO_DISPLAY) { if(display == EGL_NO_DISPLAY) {
printf("ERROR: eglGetDisplay, %0X\n", eglGetError()); printf("ERROR: eglGetDisplay, %0X\n", eglGetError());
return MwFALSE; return 1;
} }
/* Initialize EGL */ /* Initialize EGL */
if(!eglInitialize(display, &majorVersion, &minorVersion)) { if(!eglInitialize(display, &majorVersion, &minorVersion)) {
printf("ERROR: eglInitialize, %0X\n", eglGetError()); printf("ERROR: eglInitialize, %0X\n", eglGetError());
return MwFALSE; return 1;
} }
/* Get configs */ /* Get configs */
if((eglGetConfigs(display, NULL, 0, &numConfigs) != EGL_TRUE) || if((eglGetConfigs(display, NULL, 0, &numConfigs) != EGL_TRUE) ||
(numConfigs == 0)) { (numConfigs == 0)) {
printf("ERROR: eglGetConfigs, %0X\n", eglGetError()); printf("ERROR: eglGetConfigs, %0X\n", eglGetError());
return MwFALSE; return 1;
} }
/* Choose config */ /* Choose config */
@ -289,7 +295,7 @@ static int wcreate(MwWidget handle) {
EGL_TRUE) || EGL_TRUE) ||
(numConfigs != 1)) { (numConfigs != 1)) {
printf("ERROR: eglChooseConfig, %0X\n", eglGetError()); printf("ERROR: eglChooseConfig, %0X\n", eglGetError());
return MwFALSE; return 1;
} }
o->egl_window_native = (EGLNativeWindowType)wl_egl_window_create( o->egl_window_native = (EGLNativeWindowType)wl_egl_window_create(
@ -297,7 +303,7 @@ static int wcreate(MwWidget handle) {
handle->lowlevel->wayland.ww, handle->lowlevel->wayland.wh); handle->lowlevel->wayland.ww, handle->lowlevel->wayland.wh);
if(!o->egl_window_native) { if(!o->egl_window_native) {
printf("ERROR: wl_egl_window_create, EGL_NO_SURFACE\n"); printf("ERROR: wl_egl_window_create, EGL_NO_SURFACE\n");
return MwFALSE; return 1;
} }
/* Create a surface */ /* Create a surface */
@ -305,7 +311,7 @@ static int wcreate(MwWidget handle) {
o->egl_window_native, NULL); o->egl_window_native, NULL);
if(surface == EGL_NO_SURFACE) { if(surface == EGL_NO_SURFACE) {
printf("ERROR: eglCreateWindowSurface, %0X\n", eglGetError()); printf("ERROR: eglCreateWindowSurface, %0X\n", eglGetError());
return MwFALSE; return 1;
} }
eglBindAPI(EGL_OPENGL_API); eglBindAPI(EGL_OPENGL_API);
@ -315,7 +321,7 @@ static int wcreate(MwWidget handle) {
contextAttribs); contextAttribs);
if(context == EGL_NO_CONTEXT) { if(context == EGL_NO_CONTEXT) {
printf("ERROR: eglCreateContext, %0X\n", eglGetError()); printf("ERROR: eglCreateContext, %0X\n", eglGetError());
return MwFALSE; return 1;
} }
if(!eglMakeCurrent(display, surface, surface, context)) { if(!eglMakeCurrent(display, surface, surface, context)) {