Easy GL2D

Got something cool to help make the toolchains better? Post it here.

Should libgl2d be integrated into libnds? http://devkitpro.org/viewtopic.php?p=6893#p6893

Yes, integrate it immediately if not sooner.
41
41%
No, let's have this as a separate library and work towards middleware.
19
19%
Let's do both - integrate it as is and build an abstraction layer on top.
17
17%
I'm good with whatever is decided.
24
24%
 
Total votes: 101

slenkar
Posts: 43
Joined: Sun Apr 17, 2011 8:10 pm

Re: Easy GL2D

Post by slenkar » Thu Sep 13, 2012 3:40 pm

yep, im using that technique to animate human characters

On other platforms Im used to drawing for example, the torso, then saving its matrix values e.g.(1,0,0,1,50,40)

Then when I am ready to draw a limb I load the torso's matrix (glLoadMatrix) and rotate and translate for each limb.

Maybe I could use Push and PopMatrix instead.(like your tentacle example)

glSpriteOnQuad seems to be the best command because an arm for example has to have its origin or 'handle' at the shoulder so it rotates from the shoulder.
glSpriteOnQuad could also be used to draw isometric tiles, the diamond shaped ones, from a square texture.

slenkar
Posts: 43
Joined: Sun Apr 17, 2011 8:10 pm

Re: Easy GL2D

Post by slenkar » Thu Sep 13, 2012 4:16 pm

by the way how do you set magenta as the clear color?

I can only see GL_TEXTURE_COLOR0_TRANSPARENT which uses black
the texture packer uses magenta

I tried deleting GL_TEXTURE_COLOR0_TRANSPARENT from the source and put -gT #FF00FF into the GRIT file but it didnt help

slenkar
Posts: 43
Joined: Sun Apr 17, 2011 8:10 pm

Re: Easy GL2D

Post by slenkar » Thu Sep 13, 2012 7:13 pm

even if I set my png's background to 0,0,0 black and put the GL_TEXTURE_COLOR0_TRANSPARENT enum back into the sourcecode black is still not transparent

elhobbs
Posts: 353
Joined: Thu Jul 02, 2009 1:19 pm

Re: Easy GL2D

Post by elhobbs » Thu Sep 13, 2012 7:25 pm

GL_TEXTURE_COLOR0_TRANSPARENT indicates that paletted textures that specify index 0 in the image data should be transparent for that pixel - in other words it ignores the color value at index 0 in the palette and does not draw the pixels that reference this palette index.

slenkar
Posts: 43
Joined: Sun Apr 17, 2011 8:10 pm

Re: Easy GL2D

Post by slenkar » Thu Sep 13, 2012 8:28 pm

aha ok, so how do I, get magenta to be transparent

or how do I get magenta to be the first color in the palette?

elhobbs
Posts: 353
Joined: Thu Jul 02, 2009 1:19 pm

Re: Easy GL2D

Post by elhobbs » Thu Sep 13, 2012 8:41 pm

I am not really a grit expert, but

Code: Select all

-gT FF00FF
should do it

slenkar
Posts: 43
Joined: Sun Apr 17, 2011 8:10 pm

Re: Easy GL2D

Post by slenkar » Thu Sep 13, 2012 9:18 pm

it worked! thanks,
I turned my bitmap into an indexed image used magenta as the background and added the flag and this time it worked,

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests