GP32X.com - GP32 GP2X Pandora The Wiz - open source entertainment: Gles2D, An Opengl(Es) Cross Platform 2D Library - GP32X.com - GP32 GP2X Pandora The Wiz - open source entertainment

Jump to content

  • (6 Pages)
  • +
  • 1
  • 2
  • 3
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

Gles2D, An Opengl(Es) Cross Platform 2D Library

#1 User is offline   Cpasjuste

  • GP32 Hardcore
  • PipPipPipPip
  • Group: GP32 Hardcore
  • Posts: 260
  • Joined: 20-April 07

Posted 17 September 2009 - 01:40 PM

Hi !

I'm working for some time now on a 2D library for the pandora, which is now cross platform so we can build and run code on an i386 linux with an openGL based card.

I'm actually releasing the first official release, only the i386 binary for now, so people can try it, report back problem's and begin some cool games :)

You'll have to run linux and compile SDL 1.3 to use it ( svn checkout http://svn.libsdl.org/trunk/SDL ).

The header files are not really commented for now, but you can take a look at the exemples in the archive, i think they are pretty easy to understand.


Download : http://mydedibox.fr/...id=17&Itemid=29
Source Code : http://github.com/Cpasjuste/libGLES2D

GLES2D is a cross platform library in developement. It use openGL(ES) for 2D rendering.
It actually run on the pandora gaming console, and on any linux distributions.
To run it on linux distribution, you'll need an openGL card and 
compile sdl 1.3 (svn checkout http://svn.libsdl.org/trunk/SDL)

Currently supported feature :

- Simple function to init the screen.
- Load and draw textures with ease.
- Load and draw sprites with ease.
- Load ttf and bitmap fonts with ease (need to be optimised).
- Scale, rotate, blend textures, fonts and sprites.
- Load and draw tile based map (only map made with mappy is currently supported : http://www.tilemap.co.uk/mappy.php )
- Simple texture, sprite and tile map collision detection.
- Handle PC/PANDORA keyboard and gamepad.
- Handle PANDORA touchscreen.



Build 20090919 :

- Added better collision detection for textures and sprites, including pixel perfect detection and pixel color perfect detection.
- Added examples for collision detection.
- Texture structure changes : texture->w is now the actual drawing width and texture->wsrc is the original width.

Download : http://mydedibox.fr/...id=18&Itemid=29

Posted Image

This post has been edited by Cpasjuste: 09 October 2009 - 12:53 PM


#2 User is offline   Lozrus

  • GP32 User
  • PipPipPip
  • View blog
  • Group: Members
  • Posts: 46
  • Joined: 09-November 05
  • Location:High Wycombe, UK

Posted 17 September 2009 - 02:00 PM

Nice, this seems to be exactly what I need :)
Your samples are very clear and readable, I'll try to use it at the weekend and give some feedback.

#3 User is offline   mindlord

  • Notices Two Things
  • PipPipPipPipPipPip
  • View blog
  • Group: GP32 Hardcore
  • Posts: 1,172
  • Joined: 10-March 06
  • Gender:Male
  • Location:In a cave.
  • Interests:Sharp Pointy Objects, and World Domination

Posted 17 September 2009 - 02:12 PM

Fantastic! Thanks Cpasjuste. Libraries like are just the ticket to spawn hordes of high-quality homebrew. I'll check it out as soon as I get a break from work.

#4 User is offline   JyCet

  • GP Mania
  • PipPipPipPipPip
  • Group: GP32 Hardcore
  • Posts: 464
  • Joined: 23-February 04
  • Location:France

Posted 17 September 2009 - 04:48 PM

excellent !

#5 User is offline   dsh

  • GP32 User
  • PipPipPip
  • Group: Members
  • Posts: 51
  • Joined: 23-April 08
  • Gender:Male
  • Location:Cracow, Poland

Posted 17 September 2009 - 05:28 PM

Cool, that's exactly what I need for the opengl es backend for the d-man project or isn't it?

#6 User is offline   HealyHQ

  • GP32 User
  • PipPipPip
  • Group: Members
  • Posts: 89
  • Joined: 12-September 09
  • Gender:Male
  • Location:KY - USA
  • Interests:Video Games, Homebrew, and Game Development.

Posted 17 September 2009 - 05:50 PM

So you're saying, for example, if a game is made using this library, it will run on both the PC as well as the Pandora? That's awesome! This will be such a big help to many developers!

#7 User is online   PokeParadox

  • Founder of Pirate Games - Penjin Coder
  • PipPipPipPipPipPip
  • View blog
  • Group: GP32 Hardcore
  • Posts: 3,627
  • Joined: 08-December 05
  • Gender:Male
  • Location:UK
  • Interests:Homebrew and Emulation!

Posted 17 September 2009 - 05:54 PM

Sounds great! :) I will have to take a peak. :)

#8 User is offline   Multiplex

  • GP32 Hardcore
  • PipPipPipPip
  • Group: Members
  • Posts: 187
  • Joined: 20-August 08

Posted 17 September 2009 - 07:21 PM

Interesting. It looks pretty nice and clean. You may want to be explicit about it being C.

Some points that tripped me up initially:
  • You set a texture's coordinates for collision detection by calling the draw function?
  • The map and its position is global state? It's not entirely clear to me what state it contains.
  • (Sorry, spelling nitpicks;) I'd expect it to be 'TileMap', not 'TilesMap'. And 'exemples' would more commonly be spelled 'examples'.

Do you intend to release the source at some time? Any particular licence in mind?

#9 User is online   Alex.

  • Raskolnikovfan
  • Icon
  • View blog
  • Group: GP Guru
  • Posts: 4,549
  • Joined: 24-August 05
  • Gender:Male

Posted 17 September 2009 - 07:32 PM

An Opengl card, you say? Man I need a new laptop, even a netbook would do at this point :D

The game in that screenshot looks very nice, is it something you're working on?

#10 User is offline   Cpasjuste

  • GP32 Hardcore
  • PipPipPipPip
  • Group: GP32 Hardcore
  • Posts: 260
  • Joined: 20-April 07

Posted 18 September 2009 - 07:28 AM

View PostHealyHQ, on 17 September 2009 - 07:50 PM, said:

So you're saying, for example, if a game is made using this library, it will run on both the PC as well as the Pandora? That's awesome! This will be such a big help to many developers!


Yes, that's it !


View PostMultiplex, on 17 September 2009 - 09:21 PM, said:

Interesting. It looks pretty nice and clean. You may want to be explicit about it being C.

Some points that tripped me up initially:
  • You set a texture's coordinates for collision detection by calling the draw function?
  • The map and its position is global state? It's not entirely clear to me what state it contains.
  • (Sorry, spelling nitpicks;) I'd expect it to be 'TileMap', not 'TilesMap'. And 'exemples' would more commonly be spelled 'examples'.

Do you intend to release the source at some time? Any particular licence in mind?



I'm not sure to understand your first question but here is how it work :

There is no saved textures coordinates, i just use "glTranslatef" every time we draw one to set the texture at the right place, and i hold the texture destination (for collision and for everything we might need) in the texture structure.

For exemple for this code:

GLES2D_Texture *mytexture = GLES2D_LoadTexture( "cool.png", RGBA8888 );
GLES2D_DrawTextureSimple( mytexture, 100, 110 );


"mytexture->x" : would return 100
"mytexture->y" : would return 110
"mytexture->scaled_w" : would return the with of the texture when it was drawn, i mean not the original texture(image) width.
"mytexture->scaled_h" : same as before but for height.
"mytexture->w" : would return the original texture width (original loaded image width);
"mytexture->h" : same as before but for height.

I think i should swap the pointer's name "->w" and "->h" for the scaled width/height since it may be more used.

I'm not sure to understand your second question too :P

For the third one, thanks ! As you can see, my english is far from being perfect :)

Else i'm not planning to release the sources for now, but if you need any help on anything i'll be more than happy to do it.

View PostAlex., on 17 September 2009 - 09:32 PM, said:

An Opengl card, you say? Man I need a new laptop, even a netbook would do at this point :D

The game in that screenshot looks very nice, is it something you're working on?


The screenshot is just the sprite example, but it's very basic and with some bugs left :P


Note that there is for sure a lot of bugs left, but i'll try to improve the library as much as i can.
See you !

#11 User is offline   Lozrus

  • GP32 User
  • PipPipPip
  • View blog
  • Group: Members
  • Posts: 46
  • Joined: 09-November 05
  • Location:High Wycombe, UK

Posted 18 September 2009 - 08:48 AM

View PostCpasjuste, on 18 September 2009 - 08:28 AM, said:

Else i'm not planning to release the sources for now, but if you need any help on anything i'll be more than happy to do it.

If you aren't planning to release the source, do you intend to make a Windows binary at some point? I like the option to develop with Visual Studio, but more importantly (if my games are any good) I'd like to be able to release a Windows build. Anyway, I'm looking forward to having a go with this at the weekend.

#12 User is online   PokeParadox

  • Founder of Pirate Games - Penjin Coder
  • PipPipPipPipPipPip
  • View blog
  • Group: GP32 Hardcore
  • Posts: 3,627
  • Joined: 08-December 05
  • Gender:Male
  • Location:UK
  • Interests:Homebrew and Emulation!

Posted 18 September 2009 - 10:50 AM

View PostCpasjuste, on 18 September 2009 - 08:28 AM, said:

Else i'm not planning to release the sources for now, but if you need any help on anything i'll be more than happy to do it.

I actually wouldn't mind some general pointers in drawing stuff using GLES if you have some time to spare (and don't mind). I've been putting off writing the GLES(2) backend for Penjin...

#13 User is offline   B-ZaR

  • A Cube
  • PipPipPipPipPipPip
  • Group: GP32 Hardcore
  • Posts: 1,217
  • Joined: 22-September 08
  • Gender:Male
  • Location:Finland

Posted 18 September 2009 - 11:48 AM

View PostPokeParadox, on 18 September 2009 - 01:50 PM, said:

View PostCpasjuste, on 18 September 2009 - 08:28 AM, said:

Else i'm not planning to release the sources for now, but if you need any help on anything i'll be more than happy to do it.

I actually wouldn't mind some general pointers in drawing stuff using GLES if you have some time to spare (and don't mind). I've been putting off writing the GLES(2) backend for Penjin...

How about just using cpasjuste's library?

#14 User is offline   JayFoxRox

  • NO DELAYS, NO MILK!
  • PipPipPipPipPipPip
  • View blog
  • Group: GP32 Hardcore
  • Posts: 675
  • Joined: 03-August 08
  • Gender:Male
  • Location:Hanover, Germany

Posted 18 September 2009 - 01:06 PM

You should split hardware functions from game related functions and put the hardware stuff into a pandora.h with logic and good function names.
But that might only be me.

#15 User is offline   HaCo

  • GP32 User
  • PipPipPip
  • Group: Members
  • Posts: 47
  • Joined: 03-March 09

Posted 18 September 2009 - 03:15 PM

I would like to test this on my Win machine. I have SDL running. Could you create a Win build please?

  • (6 Pages)
  • +
  • 1
  • 2
  • 3
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic