Iw2D, IwGx, or IwGL?

Home / Forums / Marmalade Archive / Iw2D / Iw2D, IwGx, or IwGL?
4 replies [Last post]
by: UltimateWalrus
Status: Offline
Joined: 2012-05-07
Points: 40

Hello,

I was wondering if somebody could help me decide what API to use for my game. I'm still not totally familiar with them so I thought somebody more experienced might be able to nudge me in the right direction.

I want to make a simple 2D game with Marmalade. My first instinct would be to use Iw2D, since it seems to simplify a lot of things and would probably make coding the game a bit quicker (which is a plus, since I'm on sort of a tight deadline). However, there are a couple of special concerns with the game that make me wonder if I should avoid using Iw2D.

First, my game will need to be able to draw textured primitives on the screen (not just textured quads), because there are objects that can stretch and deform in real time. I don't see any primitive-drawing functions in Iw2D, so this made me think maybe I should be using IwGx.

My second concern is that the game uses a pixel-art style. I don't like it when pixellated sprites are used at a higher resolution, so I would need to emulate a lower-resolution display, as well as be able to turn off antialiasing (and instead use nearest-neighbor filtering). I would assume this means drawing the whole game to a lower-resolution render texture, then drawing that texture big enough to fill the screen. However I don't see functionality for render textures in IwGx... would I have to use IwGL framebuffers?

I'm not sure if interspersing the different APIs is something that would normally be done, but if it is, would it make sense to use Iw2D for normal sprites, IwGx for deformable ones, and setting the whole thing up with IwGL calls? Or do you think I should use one API exclusively?

Thanks a lot,
Sebastian

by: bluescrn
Status: Offline
Joined: 2011-02-26
Points: 7810
There isn't really a perfect

There isn't really a perfect option.

IwGL: The most flexible, but the most work. Only works on GL ES platforms.
IwGX: More cross-platform. But fixed point, which can be quite a paint.
Iw2D: Might help get people started, but not the most flexible option.

Iw2D and IwGX should mix fine, as Iw2D is just a layer on top of IwGX. (But I've never used Iw2D personally, so I can't guarantee this!)

If you know what you're doing, you *can* mix IwGX and OpenGL ES calls. As IwGX is also just making OpenGL ES calls. Not sure I'd recommend it, though - there's a few renderstate issues that You'll have to watch out for. If you go down that path, you might be better off with pure IwGL/GLES.

If you can't do render-to-texure with IwGX, maybe it's possible to create+bind an FBO with GL ES, and get Iw2D to render into it. But by the time you've done that (which may or may not work), you could probably be rendering your own polygons with IwGL...

Personally, I'm an IwGL user, and I've written my own little framework and tools pipeline on top of Marmalade.

Be aware that IwGX is due a big update, when Marmalade 6.1 lauches - this should give us a full floating-point version of IwGX, and will probably make IwGX the best option for most people, unless they really need functionality that they can only get by going to GL ES directly.

by: Kegger
Status: Offline
Joined: 2010-03-15
Points: 7990
I mix IwGx & Iw2D (3D & 2D)

I mix IwGx & Iw2D (3D & 2D) with great results on just about every device. This also gives me access to all font control thru Iw2D.
Yes IwGX is int based, but my stuff is all float and it mixes well enough.
As bluescren mentioned - IwGX is about to be 'floated' - so that possible problem should dissapear.

by: DGuy
Status: Offline
Joined: 2011-04-06
Points: 4210
Hi,

Hi,

I've mixed Iw2D & IwGx in my first two Marmalade apps without issue: Iw2D did most of the rendering, but I used IwGX to dynamically create & render an texture too complex to re-generate each frame (Iw2D also allows off-screen rendering BTW.)

I'd plan to move just to IwGx, for the flexibility it offers and the conceptually simplicity of using just one API to do all rendering.

As to off-screen rendering using IwGx, see the 2nd reply in the below thread for how it's done:

https://www.madewithmarmalade.com/devnet/forum/draw-screen-libgd

-Guy

by: UltimateWalrus
Status: Offline
Joined: 2012-05-07
Points: 40
Thank you very much bluescrn,

Thank you very much bluescrn, Kegger, and DGuy for the helpful advice. I've decided to try mixing Iw2D and IwGx and it's working well so far. The fixed point numbers have proven to be quite a pain in the butt, but I think I can live with them as I did some GBA programming and I'm at least familiar with them (at least the Marmalade simulator actually lets me know when there's an overflow, haha).

DGuy, your code sample was incredibly helpful and I got it working how I wanted in IwGx. Offscreen rendering seems to slow down the Debug build a little bit, but Release mode still runs just fine. I even managed to turn off antialiasing with CIwMaterial::SetFiltering(false), so the pixels look nice and crisp.

Thank you all very much!
---Sebastian

Latest Posts

Latest Comments

Top Contributors

  • Chris D : 27,010
  • MonRoyals : 26,970
  • Salman : 26,720
  • Jez Hammond : 20,130
  • pjan : 11,150
  • gjw : 10,350
  • Paolo Oliverio : 9,640
  • Beaker_2 : 8,390
  • Kite : 8,210
  • bluescrn : 7,810