-------- Original Message -------- Asunto: Re: Compile GRX with Mingw Fecha: Sat, 21 Apr 2001 00:23:45 +0200 De: Mariano Alvarez Fernandez malfer@teleline.es A: Waldemar Schultz schultzma@mathematik.tu-muenchen.de Referencias: 3AD0ECA1.41D6E0E0@teleline.es 3AD159B8.8DCB55E2@ma.tum.de 3AD1F992.66ECF8B2@teleline.es 3AD2D051.848190B0@ma.tum.de 3AD34CA2.40EB6285@teleline.es 3AD4177E.7CB788BA@ma.tum.de 3AD492B5.F7F1DF08@teleline.es 3ADEDA70.EA6F4C32@ma.tum.de
Waldemar Schultz escribió:
when compiling MINGW/GRX/BGI programs I have noticed that if you use setwritemode(XOR_PUT) once, setwritemode(COPY_PUT) does not switch back to normal write mod but stays in xor-mode. This effect does not occur in DJGPP/GRX/BGI environment. Does anyone know a workaround ?
No, sorry. It may be a bug (there are lots in the Win32 port at the moment). Can you provide a small test case? (I have never used the grx bgi interface).
No, sorry. It may be a bug (there are lots in the Win32 port at the moment). Can you provide a small test case? (I have never used the grx bgi interface).
It's not in the bgi-interface, it's just a bug in GRX-Win32. Example code:
MINGW>gcc -c grxbug.c -g -O3 -W -Wall -Ic:\djgpp\contrib\grx24\include MINGW>gcc grxbug.o -o grxbug.exe c:\djgpp\contrib\grx24\lib\win32\libgrx20.a -mwindows -mconsole
grxbug.c:
#include <stdio.h> #include <stdlib.h> #include <conio.h> #include <grx20.h> #include <grxkeys.h>
#ifdef __WIN32__ int GRXMain() //int argc, char **argv) #else int main() //int argc, char **argv) #endif { GrMouseEvent ev; int i; GrColor *ega; int x,y; char s[2];
GrSetDriver("VESA gw 800 gh 600 nc 256"); GrSetMode(GR_default_graphics); GrMouseInit(); GrClearScreen(GrWhite()); ega=GrAllocEgaColors(); y=20;x=200; //This should paint a series of 'dots' and 'bars' in XOR colors for(i=0;i<16;i++) { GrLine(x,y,x+200,y,GrXOR|ega[i]); GrLine(x,y+1,x+200,y+1,GrXOR|ega[i]); GrLine(x,y-1,x+200,y-1,GrXOR|ega[i]); GrPlot(x-10,y,GrXOR|ega[i]); GrPlot(x-10,y+1,GrXOR|ega[i]); GrPlot(x-10,y-1,GrXOR|ega[i]); GrPlot(x-11,y,GrXOR|ega[i]); GrPlot(x-11,y+1,GrXOR|ega[i]); GrPlot(x-11,y-1,GrXOR|ega[i]); GrPlot(x-12,y,GrXOR|ega[i]); GrPlot(x-12,y+1,GrXOR|ega[i]); GrPlot(x-12,y-1,GrXOR|ega[i]); y+=20; } for(i=0;i<16;i++) { GrLine(0,0,0,0,ega[i]);//comment this line (kindof dirty workaround) } GrMouseDisplayCursor(); do { GrMouseGetEvent(GR_M_EVENT,&ev); } while(!(ev.flags&GR_M_KEYPRESS));
exit(EXIT_SUCCESS); }
If you comment out the marked line the bug with XOR becomes obvious. But even with that 'dirty workaround' enabled you will see some strange effect when you move the cursor slowly over the graphics: some pixels change their color when under the arrow, others don't. And please note that the colors from the GrPlot() calls ar not equal to those from GrLine() calls, as they should.
Perhaps somebody knows a way how to approach that problem. Thanks.
Hi Waldemar
GrSetDriver("VESA gw 800 gh 600 nc 256"); GrSetMode(GR_default_graphics);
First, this is not correct, the Win32 port does not have a VESA driver. Best use this that is OK for all platforms:
GrSetMode(GR_width_height_bpp_graphics,800,600,8 ); // for 8bpp GrSetMode(GR_width_height_bpp_graphics,800,600,24 ); // for 24bpp
But this is not the problem. The problem is a known bug in the 8bpp win32 driver, it operates with colors instead index colors to make the xor-operations. The problem is big, is a design error. But the 24 bpp driver works OK with your test.
Greetings, M.Alvarez
Hi Mariano Alvarez:
GrSetMode(GR_width_height_bpp_graphics,800,600,8 ); // for 8bpp GrSetMode(GR_width_height_bpp_graphics,800,600,24 ); // for 24bpp
But this is not the problem. The problem is a known bug in the 8bpp win32 driver, it operates with colors instead index colors to make the xor-operations. The problem is big, is a design error. But the 24 bpp driver works OK with your test.
Thanks for claryfying this. But - not that I want to insist on that topic - please note that the output of GrPlot() is in error even for the 24bpp. Bye.