Are there any recommended 2D shape drawing libraries? I have seen "MagicLibrary" in the forums but it appears to focus heavily on the sprite and effects rather than working with geometry.
I am looking for efficient libraries that does things like weighed lines (wider than 1 pixel), patterned lines (dotted, dashed, etc), circles, ellipses, and arc segments, filled shapes and polygons, etc.
Are there any that is recommended?
Thanks.
Hiroo
RESOLVED: 2D geometry Libraries?
RESOLVED: 2D geometry Libraries?
Last edited by Hiroo on Wed Jan 07, 2015 9:29 pm, edited 1 time in total.
Re: 2D geometry Libraries?
Try looking for general sw drawing, and you'll find ones like Cairo, AGG, Skia, others. Using a sw surface you'll need to copy to get it into a texture, but no doubt it's easier than finding a GL library that does those.
Re: 2D geometry Libraries?
Interesting suggestion. Indeed, AGG does seem like it may offer a very good promise. I also see that in 06.2DGraphics sample, the example demonstrates the use of draw2DImage() call that seems to do exactly what I need to overlay an in-memory RGBA image onto the rendering surface. If I can use AGG to render to the memory buffer that is held by ITexture, I will be able to overlay the 2D rendering over 3D image.
I suspect this is the way to create the image buffer.
Then, obtain the memory block address using the ITexture method below...
Then, use draw2DImage I mentioned earlier to blast the bloody mess on the screen.
Promising... I shall give it a try.
I suspect this is the way to create the image buffer.
Code: Select all
virtual ITexture* addRenderTargetTexture(const core::dimension2d<u32>& size,
const io::path& name = "rt", const ECOLOR_FORMAT format = ECF_UNKNOWN) =0;
Code: Select all
virtual void* lock(E_TEXTURE_LOCK_MODE mode=ETLM_READ_WRITE, u32 mipmapLevel=0) = 0;
Promising... I shall give it a try.
Re: 2D geometry Libraries?
No, RTTs are not the type you should use. A normal texture is better as it has mipmaps.
Also, you can't really render directly to the CPU mem block; it's advised to use a copy.
1. addTexture with the desired dimensions
2. Render to AGG's native sw surface
3. lock() the texture, memcpy (assuming same format), unlock(), render with draw2DImage or another way
4. Goto 2
Also, you can't really render directly to the CPU mem block; it's advised to use a copy.
1. addTexture with the desired dimensions
2. Render to AGG's native sw surface
3. lock() the texture, memcpy (assuming same format), unlock(), render with draw2DImage or another way
4. Goto 2
Re: 2D geometry Libraries?
Thank you. I think that make sense. I will give that a try.
Hiroo
Hiroo
Re: RESOLVED: 2D geometry Libraries?
And just like that. Works great with AGG. The great thing I discovered about AGG is that it is essentially .h and .cpp file that you pull into your code. No DLLs, libs, or other binary component.
On the other hand, it appears not to be maintained recently as the last release was 8 years ago. Looks powerful enough to do what I need done.
On the other hand, it appears not to be maintained recently as the last release was 8 years ago. Looks powerful enough to do what I need done.