From 4fa0b665e428d89d9d5a4b48ff255b781f53833f Mon Sep 17 00:00:00 2001 From: Jafar Al-Gharaibeh Date: Thu, 25 Apr 2024 23:13:26 -0500 Subject: [PATCH] runtime: fix CopyArea when used with 3D windows/textures Signed-off-by: Jafar Al-Gharaibeh --- src/runtime/fwindow.r | 22 ++++++++++------------ src/runtime/ropengl.ri | 2 +- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/src/runtime/fwindow.r b/src/runtime/fwindow.r index 451a5ff73..54a11c7ca 100644 --- a/src/runtime/fwindow.r +++ b/src/runtime/fwindow.r @@ -526,20 +526,19 @@ function{0,1} CopyArea(argv[argc]) /* w,w2,x,y,width,height,x2,y2 */ */ #ifdef Graphics3D - if (w->context->rendermode == UGL3D) { - if (argc>warg && is:record(argv[warg])) { - /* set a boolean flag, use a texture */ - dest_is_texture=1; - /* Get the Window from Texture record */ - w2 = BlkD(BlkD(argv[warg],Record)->fields[3],File)->fd.wb; - /* Pull out the texture handler */ - dest_texhandle = IntVal(BlkD(argv[warg],Record)->fields[2]); - /* get the context from the window binding */ - warg++; + if (argc>warg && is:record(argv[warg])) { + /* set a boolean flag, use a texture */ + dest_is_texture=1; + /* Get the Window from Texture record */ + w2 = BlkD(BlkD(argv[warg],Record)->fields[3],File)->fd.wb; + /* Pull out the texture handler */ + dest_texhandle = IntVal(BlkD(argv[warg],Record)->fields[2]); + /* get the context from the window binding */ + warg++; } if (argc-warg<4) /* should have at least 4 int values */ - runerr(146); + runerr(146); /* * This is the: "w2 is a destination texture" case. @@ -580,7 +579,6 @@ function{0,1} CopyArea(argv[argc]) /* w,w2,x,y,width,height,x2,y2 */ } ReturnWindow; } - } #endif /* Graphics3D */ /* diff --git a/src/runtime/ropengl.ri b/src/runtime/ropengl.ri index 81aab4088..15453c17d 100644 --- a/src/runtime/ropengl.ri +++ b/src/runtime/ropengl.ri @@ -3238,7 +3238,7 @@ int setselectionmode(wbp w, char* s) #endif /* MSWindows */ #define TEXUPDATE(win, wc, texhand, tex, wd, ht) \ - if (wc->buffermode) { \ + if (wc->buffermode == UGL_BUFFERED) { \ wc->curtexture = texhand; \ MakeCurrent(wc->display->stex[texhand].w); \ glBindTexture(GL_TEXTURE_2D, wc->display->stex[texhand].texName); \