RESOLVED: 2D geometry Libraries?

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Hiroo
Posts: 10
Joined: Sun Dec 28, 2014 6:59 am

RESOLVED: 2D geometry Libraries?

Post by Hiroo »

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
Last edited by Hiroo on Wed Jan 07, 2015 9:29 pm, edited 1 time in total.
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: 2D geometry Libraries?

Post by hendu »

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.
Hiroo
Posts: 10
Joined: Sun Dec 28, 2014 6:59 am

Re: 2D geometry Libraries?

Post by Hiroo »

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.

Code: Select all

 
        virtual ITexture* addRenderTargetTexture(const core::dimension2d<u32>& size,
                const io::path& name = "rt", const ECOLOR_FORMAT format = ECF_UNKNOWN) =0;
 
Then, obtain the memory block address using the ITexture method below...

Code: Select all

 
    virtual void* lock(E_TEXTURE_LOCK_MODE mode=ETLM_READ_WRITE, u32 mipmapLevel=0) = 0;
 
Then, use draw2DImage I mentioned earlier to blast the bloody mess on the screen.

Promising... I shall give it a try.
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: 2D geometry Libraries?

Post by hendu »

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
Hiroo
Posts: 10
Joined: Sun Dec 28, 2014 6:59 am

Re: 2D geometry Libraries?

Post by Hiroo »

Thank you. I think that make sense. I will give that a try.

Hiroo
Hiroo
Posts: 10
Joined: Sun Dec 28, 2014 6:59 am

Re: RESOLVED: 2D geometry Libraries?

Post by Hiroo »

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.
Post Reply