Hi All,
maybe I´m about to demontsrate my stupidty (again).
I want to do "off-off-screen" rendering with GRX, huh, what?? Let me explain.
It all works almost fine for one time: I do:
GrSetDriver("memory gw 640 gh 400 nc 256"); GrSetMode(GR_default_graphics); GrContext* root = GrCurrentContext(); GrSetContext ( root ); root = GrSaveContext( NULL );
/* doing lots of drawing */ /* ... */ /* after a while, probing what has been drawn,(double-loop x,y): */ c = (*GrCurrentFrameDriver()->readpixel)((GrFrame *)(&(root)->gc_frame), ((x)), ((y)) ); /* => leads to all what is fine. */
This all works fine for one level of offscreen-drawing.
Now for the bisquit:
Beyond that, I would like to generate another GrContext out of the blue,
make some drawings on it, off-off-screen, so to speak, and later do something like the following: GrImage img_local = GrImageFromContext(ImageGrContext_out_of_the_blue); GrImageDisplay(x, y, img_local); to smash this image onto my root-GrContext.
The bisquit is this "ImageGrContext_out_of_the_blue": When not in offscreen mode (that is, having said GrSetDriver("xwin...")), it all works great when doing: ImageGrContext_out_of_the_blue = GrCreateContext(width,height,NULL,NULL); Mainly because GrCoreFrameMode() (GrDriverInfo->sdriver.rmode) leads to something usable (??).
But when being in offscreen-mode, GrCoreFrameMode() yields NULL. This might be alright, but GrCreateFrameContext() depends on a valid mode, thus returning NULL for the whole function, and blocking all what should follow.
Later I tried to spoof this function with ImageGrContext_out_of_the_blue = GrCreateFrameContext(19, ....); (19 is the mode I need, it seems), but this leads to SigSegv. later somewhere in the system.
Many thanks in advance. greetings, Joe.
-- Joachim Euchner, Prozessrechnerverbund-Zentrale Sekr.: MA 073, FSP-PV, Technische Universitaet Berlin Str. d. 17. Juni 136, 10623 Berlin, Deutschland Phone: [(+49|0)30]-314-21701 Fax: ..-21114 Email: joe@prz.tu-berlin.de www: www.prz.tu-berlin.de/~joe "We're going up the river about 75 klicks above the Do Lung bridge."
Why don't you use GrCreateContext?
e.g.
/* GrSetDriver("memory gw 640 gh 400 nc 256"); */ GrSetMode(GR_default_graphics); GrContext* mem1 = GrCreateContext(640,400,NULL,NULL); GrContext* mem2 = GrCreateContext(640,400,NULL,NULL);
GrSetContext(mem1); ... GrSetContext(mem2); ...
GrDestroyContext(mem1); GrDestroyContext(mem2);
Maybe GrCreateFrameContext(GR_FrameRAM8,640,400,NULL,NULL); will do it without even switching to graphics-mode. You try and report!
Marcus
Hi Marcus,
thanx for the quick response!
Why don't you use GrCreateContext?
well, that was my first choice as well. But when looking at grx20.h, line 493, you´ll see:
#define GrCreateContext(w,h,m,c) (GrCreateFrameContext(GrCoreFrameMode(),w,h,m,c))
so I decided to use GrCreateFrameContext directly. You´ll see why.
Maybe GrCreateFrameContext(GR_FrameRAM8,640,400,NULL,NULL); will do it without even switching to graphics-mode.
You try and report!
yup. Thanx, the "GR_FRameRAM8" is much more elegant than a mere "19", naturally. With this entry (the more or the less elegant one) it is possible to generate a correct GrContext at all. That´s why I use GrCreateFrameContext. But the story did not end now. Now I analysed at what "later" stage I get this before mentioned SigSegv.
Its thrown somewhere in the usage of: GrImageDisplay
GrImage* img_local = GrImageFromContext(mem_context); GrImageDisplay(x,y, GrImage* img_local);
Maybe I could use a GrBitBlt() for isometric mappings now, but I will also have to use the scaling capabilities, so this question must be solved sooner or later anyways.
Maybe a small DDD-graph will help.
greetings, Joe.