View unanswered posts | View active topics It is currently Tue Dec 11, 2018 5:30 pm



Reply to topic  [ 57 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6  Next
 Easy GL2D 

Should libgl2d be integrated into libnds? viewtopic.php?p=6893#p6893
Yes, integrate it immediately if not sooner. 41%  41%  [ 41 ]
No, let's have this as a separate library and work towards middleware. 19%  19%  [ 19 ]
Let's do both - integrate it as is and build an abstraction layer on top. 17%  17%  [ 17 ]
I'm good with whatever is decided. 24%  24%  [ 24 ]
Total votes : 101

 Easy GL2D 
Author Message

Joined: Sun Apr 11, 2010 10:43 am
Posts: 82
Update 04/02/2011
    Added gl[Get/Set]ActiveTexture() for Stencil FX (See Sprites example)
    Added uoff and voff to glSpriteOnQuad for more FX
    Changed Sprite Examples


Sat Apr 02, 2011 3:49 am
Profile

Joined: Sat Jul 16, 2011 8:27 pm
Posts: 3
Hey relminator,

I really love your Easy GL2D library. I'd been floundering around with the 2D engine for a few weeks and then found your library and haven't looked back.

I'm at an impasse with collision checking in a game I'm trying to make. Can you recommend a way to do it? After looking around the Internet for ideas, my initial plan was to do rough collision checking by looking at sprites' bounding boxes and then following up, if necessary, with precise, per-pixel checking within the bounding boxes' rectangle of intersection. The problem is I have no idea how to check if a pixel is "on" in Easy GL2D! Can you think of a way to do it, or a workaround? Any help would be appreciated. Thanks a lot.


Sat Jul 16, 2011 11:06 pm
Profile

Joined: Sun Apr 11, 2010 10:43 am
Posts: 82
Hi. sorry for the late reply. Been kinda busy these days. ;*(

Yeah AABB is very fast and I would stick to it if it can do what you want.

I've used only AABBs on this game and I did fine:

http://rel.phatcode.net/index.php?actio ... Impakto-DS


For a more geometrically friendly collision detection you can use SAT.

http://rel.phatcode.net/junk.php?id=109

I would not use pixel by pixel collisions on the DS as it's very slow even after clipping and cropping collision bounds via AABB.


Thu Sep 01, 2011 1:43 am
Profile

Joined: Sat Jul 16, 2011 8:27 pm
Posts: 3
I looked into SAT a little bit. I tried to do myself with someone else's fixed-point arithmetic library but ran into problems, so I'm excited to see how your implementation works. I settled on treating an object's bounding box as a convex hull and doing an inclusion test on each of the vertices of the other object's bounding box, and it works perfectly. However, I can imaging it slowing down for a busy game with lots of bounding boxes, so perhaps I'll try your SAT method.

Thanks for the help!


Thu Sep 01, 2011 2:24 am
Profile

Joined: Sat Feb 26, 2011 7:15 pm
Posts: 3
Hi,
I've used gl2d for the sdl 1.3 port, which has saved me alot of time. I'd like to integrate it into sdl as well as fix an issue I'm facing. However your code doesn't have a licence. SDL is using the zlib licence (http://hg.libsdl.org/SDL/file/tip/COPYING). Could you consider allowing me to use your code there, or licence gl2d with a zlib compatible licence ?


Sat Dec 10, 2011 4:09 am
Profile

Joined: Sun Apr 11, 2010 10:43 am
Posts: 82
defer wrote:
Hi,
I've used gl2d for the sdl 1.3 port, which has saved me alot of time. I'd like to integrate it into sdl as well as fix an issue I'm facing. However your code doesn't have a licence. SDL is using the zlib licence (http://hg.libsdl.org/SDL/file/tip/COPYING). Could you consider allowing me to use your code there, or licence gl2d with a zlib compatible licence ?


Sure, just use it in anyway you like.
;*)


Fri Jan 27, 2012 8:53 am
Profile

Joined: Sun Apr 17, 2011 8:10 pm
Posts: 43
do all sprites have to be power of 2?
what about sprites that are NOT power of 2 on a texture that IS power of 2?

also I would like to alter the gl2d source so I can parent one sprite to another, so I would have to remove some calls to glLoadidentity

as gl2d is included as a .a file how would I do this


Wed Sep 12, 2012 2:52 pm
Profile

Joined: Thu Jul 02, 2009 1:19 pm
Posts: 352
sprites do not need to be a power of 2, but the textures used to hold the sprite frames do need to be power of 2. look at the spritres example, this is how it is setup. The lib source is in the download - the distributable_source directory. instead of referencing the lib in your makefile just copy the files in the gl2d source and include directories to your project's source and include directories. then you can change whatever you like.


Wed Sep 12, 2012 4:27 pm
Profile

Joined: Sun Apr 17, 2011 8:10 pm
Posts: 43
thanks for the help on sprites,

I realized the texturedquad function is all you need to do do funky stuff like parenting etc. as long as xtranslatef32 is copied from gl2d.c as its inline


Wed Sep 12, 2012 6:46 pm
Profile

Joined: Sun Apr 11, 2010 10:43 am
Posts: 82
Yep, what elhobbs said. By parenting you mean...

Code:
Parent
    transform
        Child
           transform
              Grandchild


Or something like that?

Just do something like this:


Code:

void DrawTentacle( s32 angle, int Segments, glImage *spr )
{

   int i;
   glPushMatrix();
   
      for( i = 0; i < Segments; i++ )
      {
         glTranslate3f32( 7, 0, 0 );
         glRotateZi( angle );
         glSpriteRotate( 0, 0, 0, GL_FLIP_NONE, spr );
      }

   glPopMatrix( 1 );
   
   
}


Then call it like:
Code:
// Start 2D mode
      glBegin2D();

         
         // Draw our enemies
         glSpriteRotate(    x, y, Frame*30 * 3, GL_FLIP_NONE, &Enemies[81]);
         
         
         glPushMatrix();
            glLoadIdentity();
            glTranslate3f32( 128, 96, 0 );   // center of the tentakill
            glRotateZi( Frame * 280);        // rotation of the tentakill
         
            s32 angle = (sinLerp(-Frame*40));   // angle of the first tentacle
            glPushMatrix();                  // relative draw tentacle
               DrawTentacle( angle, 8, &Bullets[Frame/4 & 3] );
            glPopMatrix( 1 );
            
            
            angle = (sinLerp(-Frame*60));
            glRotateZi(BRAD_PI/2);            // quarter turn for next tentacle
            glPushMatrix();
               DrawTentacle( angle, 8, &Bullets[Frame/4 & 3] );
            glPopMatrix( 1 );
            
            angle = (sinLerp(-Frame*40));
            glRotateZi(BRAD_PI/2);
            glPushMatrix();
               DrawTentacle( angle, 8, &Bullets[Frame/4 & 3] );
            glPopMatrix( 1 );
            
            angle = (sinLerp(-Frame*60));
            glRotateZi(BRAD_PI/2);
            glPushMatrix();
               DrawTentacle( angle, 8, &Bullets[Frame/4 & 3] );
            glPopMatrix( 1 );
            
         glPopMatrix( 1 );
         
         // draw the center of tentacle
         glSpriteRotate(    128, 96, Frame*180 * 3, GL_FLIP_NONE, &Enemies[1]);

            
      glEnd2D();

      


Thu Sep 13, 2012 10:36 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 57 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6  Next

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
  Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software.
Get devkitPro at SourceForge.net. Fast, secure and Free Open Source software downloads