Skip to content

Commit

Permalink
Merge pull request #440 from Jafaral/fix-texture
Browse files Browse the repository at this point in the history
runtime: fix CopyArea when used with 3D windows/textures
  • Loading branch information
Jafaral authored Apr 28, 2024
2 parents 7515f39 + 4fa0b66 commit 76750c3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
22 changes: 10 additions & 12 deletions src/runtime/fwindow.r
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -580,7 +579,6 @@ function{0,1} CopyArea(argv[argc]) /* w,w2,x,y,width,height,x2,y2 */
}
ReturnWindow;
}
}
#endif /* Graphics3D */
/*
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/ropengl.ri
Original file line number Diff line number Diff line change
Expand Up @@ -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); \
Expand Down

0 comments on commit 76750c3

Please sign in to comment.