15
01/2012

Shape Designer

Written by arthur

Today I am going to show you one other tool I worked on for my physics engine. It's called ShapeDesigner, mainly because it helps to design shapes (really?!) or collision geometry for the engine. Well, I could have done it with triangulation from an image. But all geometry would have been made of triangles whereas circles save a lot of resources and increase accuracy.

shape designer

So here I am with this tool. It allows to load an image, and then we can draw all basics shapes (such as circle, triangle or quad), and export it in a compliant xml format for the physics engine.

<shape name="bloc_18.png">
  <triangle x1="0" y1="64" x2="0" y2="28" x3="55" y3="64" />
  <circle x="31" y="32" radius="31" />
  <triangle x1="55" y1="64" x2="62" y2="37" x3="0" y3="28" />
</shape>

You can also take a look at the code (it was made with visual studio 2010, in C#) if you want to fork it.

Classified in : Tools - Tags : iphone, opengl, C#, windows, atlas, packer - 2 comments

21
12/2011

Tool - Texture atlas maker

Written by arthur

I told you that I started iPhone development. After testing Unity3D and cocos2d, I decided that I will better write my own 2d engine with opengl-es. Maybe it's more extra-work, but I prefer truely understand what I am working with. Moreover I did a similar engine on Windows. But the downside was the performance, how to manage a lot of graphics on such limited hardware? (Yes, iPhone 3G, I am speaking of you.)
On windows I was loading one texture for one sprite. If I had 300 images in my application I would load 300 textures. Not very efficient, but it worked on nowadays computer. Of course it couldn’t work on iPhone. Plus, on iOS we can’t load texture that have not a power-of-two size. For example a 257x300 pixel wide image would require a space of 512x512 pixels in ram. That means a lot of wasted space.
One common approach is to pack all images in a big one, and then at the rendering compute the convenient UV mapping for each image. In doing that we get rid of glBindTexture and other opengl calls which can slow down the rendering.

texture packer atlas example

You are going to ask me why I develop windows tool for iPhone development, the answer is simple: I like the .Net Framework and C#, and tools are made to save time! And this tool helps for two things:
  • Textures packing
  • Animations maker
It works for animations too because the problem is the same(a lot of different graphics, but with limited space in ram).
If you are brave enough, you can try it by yourself in downloading the application here (it requires .Net Framework 4.0 though).

Classified in : Tools - Tags : iphone, opengl, C#, windows, atlas, packer - 1 comment