|
|
Hi Ian, I use OpenGL for rendering some graphics. This is useful especially for 3d objects. OpenGL do however not have routines for drawing complex polygons. It is possible to draw complex polygons using tessellation, but this approach also have its limitations. Also I would like to know which pixels are encapsulated by polygons since I want to treat these areas special.
I have tested a variety of codes/routines out there for drawing a complex polygon, but I find it difficult to compete with the routines implemented in fltk.
Currently I do : oscr = fl_create_offscreen(nx, ny); fl_begin_offscreen(oscr);
fl_rectf(0, 0, 100, 50); // for testing: draw some objects..
fl_read_image(pix, 0, 0, nx, ny, 0); fl_end_offscreen(); fl_delete_offscreen(oscr);
This is done repeatably (can be several times a second). nx and ny can be up to 3840.
In this way I get a pixmap which indicate which pixels are encapsulated be polygons. My concerns: Routines should be fast. Require as little memory as possible (a char-pix would do)
Does it make sense to implement this as done above ? Should oscr be a static variable, and only be recreated when nx,ny changes ? Is is possible to use a one-char pixmap in fl_read_image ?
Best regards Håvard
fredag 31. desember 2021 kl. 18:29:27 UTC+1 skrev Ian MacArthur:
On 30 Dec 2021, at 08:56, holm.haavard wrote:
>
>
> Hello,
>
> I want to implement my own version of fl_complex_polygon.
> I want to draw a concave polygon to a pixmap.
>
> To me it seems like fltk have efficient argorithms to do that. I have been looking around to find the code where this is implemented without any luck.
>
> Can any please give me a hint on how this is implemented in fltk / code ?
Håvard,
What is it you are trying to do?
You can pretty easily use the fltk drawing functions to draw concave polygons into an Fl_Image_Surface (or some other offscreen surface) and then use that for your pixmap.
I think others have understood your question as asking how the low-level drawing actually works at the OS level, but I’m not sure if that was what you were asking or not.
So... what are you trying to achieve, and we can see where we are...
Cheers.
ps: and a Happy New Year to all our readers (etc., at least for those following some variation on the Gregorian calendar scheme...)
--
You received this message because you are subscribed to the Google Groups "fltk.general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkgeneral+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/a7b331bc-3454-407f-ab4b-e9ed50bd7f20n%40googlegroups.com.
[ Direct Link to Message ] | |
|
| |