Easy GL2D

User projects written in or related to FreeBASIC.
relsoft
Posts: 1767
Joined: May 27, 2005 10:34
Location: Philippines
Contact:

Easy GL2D

Postby relsoft » Aug 16, 2010 8:47

Tired of FBGFX?
Want and easy to use OpenGL 2D rendering engine?

Well here it is...

Easy GL2D V 0.7
http://rel.betterwebber.com/junk.php?id=115

Description:
Easy GL2D is a very simple 2D OpenGL rendering engine.
It is made with two simple things in mind: Speed and ease of use.
Everything is function based so just about any programming
design pattern can be used in conjunction with easy GL2D.


Relminator(Richard Eric M. Lope) 08/19/2010 | 02/14/2012 | 09/30/2012
http://rel.phatcode.net/

*Use this with my texture packer and it would
be very easy to grab tiles from a tileset.

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



Features:

Easy to use
Very fast
No dependencies except FreeBASIC, OpenGL, GLU
OpenGL states(color, AA, blending, etc) can be applied to any primitive or sprite.
Full hardware
Able to support standard FBGFX BMPs in any bitdepth >= 8
Portable(even has a Nintendo DS port, actually the DS version is the first one I made so this is the port)

Limitations:
Full hardware
Author is lazy


* See the examples if you like it.

How to use:
1. You can use it as a "module"
* just include FBGL2D7.BI and link with FBGL2D7.bas
2. You can also use Easy GL2D as part of your source file
* just include FBGL2D7.BAS and FBGL2D7.BI then code away.


* See the reference in the /Docs section for more details


Code: Select all

Update ver 0.7 (BIG Change!)
   - Changed calling convention so that the CPP, DS and FB versions
      share the the same calls and convention
   - Cleaner and better stream-lined API
   - Font stuff
   - Lots of stuff I couldn't remember
   - Better docs (Doxygen and Chm)
   - No cast needed for using FB.Image sprites
   
Update ver 0.6
   - ALPHA mode
   - Forgot

Update ver 0.5

    Fixed:
      1. pixel inconsistency in sprite rendering
      2. Filled primitive stuff discrepancy
    Added:
      Vsynch
      Ellipse
      Made a version compatible with FB.IMAGE


This version by far is the easiest to use since you don't need to cast() fb.images. ie. You can use GL2D as you would FBGFX now.

Also has a sexier doc these days.

Image

Na_than's minigame I ported from QB to FB using gl2d.

Asteroidz!!!!
http://rel.betterwebber.com/junk.php?id=116

Textures and its corresponding BI files are made by my texture packer:
http://rel.betterwebber.com/junk.php?id=106


With this texture packer and easy GL2D, it's easier render HW than FBGFX SW.


Enjoy!
Last edited by relsoft on Oct 01, 2012 5:45, edited 7 times in total.
Lachie Dazdarian
Posts: 2326
Joined: May 31, 2005 9:59
Location: Croatia
Contact:

Postby Lachie Dazdarian » Aug 16, 2010 10:44

I wanted this for ages. Thanks a million, man!
angros47
Posts: 1425
Joined: Jun 21, 2005 19:04

Postby angros47 » Aug 16, 2010 11:38

You have beaten me on time!

I was thinking about something similar (maybe using the sprite engine from Basic4GL), and I was gathering informations about it: http://basic4gl.proboards.com/index.cgi?board=dllpc&action=display&thread=3283 , but you have been faster than me.

Well, thanks!

Anyway, FBGFX could always be useful, for example to draw on buffers (if you want to use procedurally generated sprites, for example)

Also, by linking stb_Image (http://www.freebasic.net/forum/viewtopic.php?p=133021#133021) you should be able to load other formats, too.

And, with few improvements, your background routines could become a powerful tile engine.

Congratulations!
relsoft
Posts: 1767
Joined: May 27, 2005 10:34
Location: Philippines
Contact:

Postby relsoft » Aug 16, 2010 12:30

I didn't know you guys wanted 2d HW lib. I thought HGE solved it.

I only made this because someone asked me to write a tutorial on it for Back2Basic.

This is just a bare-bones implementation for my tutorial. Anyone is free to use or modify it as they see fit.

I may add some stuff for this while writing my tute though. However, I'll limit it to just BMPs for clarity's sake.

EDIT:

Mysoft at IRC noted a little screensync bug in the example...

Code: Select all

<Mysoft> "do : loop until timer - time_start >= (1/60)"
<Mysoft> don't do this @_@
<Mysoft> this isnt a DS ;p
<Mysoft> also FLIP will already screensync if you have the option turned ON, in the card
<Mysoft> so screensync would cause double vsync if you have vsync option ON
Lachie Dazdarian
Posts: 2326
Joined: May 31, 2005 9:59
Location: Croatia
Contact:

Postby Lachie Dazdarian » Aug 16, 2010 12:45

HGE is too OOPish. We were all dying for hardware accelerated FBGFX-like lib.
relsoft
Posts: 1767
Joined: May 27, 2005 10:34
Location: Philippines
Contact:

Postby relsoft » Aug 16, 2010 13:02

Lachie Dazdarian wrote:HGE is too OOPish. We were all dying for hardware accelerated FBGFX-like lib.


Oops. Never actually looked at HGE.

BTW, Mysoft was right.

Rem the frames limiter and screensync and see your fps jump.

LOL
Landeel
Posts: 676
Joined: Jan 25, 2007 10:32
Location: Brazil
Contact:

Postby Landeel » Aug 16, 2010 14:12

Hahah, this is awesome.
I am developing something similar too...
h4tt3n
Posts: 676
Joined: Oct 22, 2005 21:12
Location: Denmark

Postby h4tt3n » Aug 16, 2010 14:32

Great, I was just going to make something similar. Looking forward to reading the source.
angros47
Posts: 1425
Joined: Jun 21, 2005 19:04

Postby angros47 » Aug 16, 2010 15:16

@relsoft
Please, replace the include lines with:

Code: Select all

#include once "fbgfx.bi"
#include once "GL/gl.bi"
#include once "GL/glu.bi"   

So, your program will run on linux, too.
relsoft
Posts: 1767
Joined: May 27, 2005 10:34
Location: Philippines
Contact:

Postby relsoft » Aug 16, 2010 15:40

Hahahahaha! Forgot that.

I'll probably add some glowlines stuff and some basic primitives and that would be it.

Collision detection via SAT would be perfect for this too.
Lachie Dazdarian
Posts: 2326
Joined: May 31, 2005 9:59
Location: Croatia
Contact:

Postby Lachie Dazdarian » Aug 16, 2010 20:02

Yeah, forgot to ask about that. No primitives yet? We really need OpenGL LINE, CIRCLE and PSET.

Hope you'll add that soon.
h4tt3n
Posts: 676
Joined: Oct 22, 2005 21:12
Location: Denmark

Postby h4tt3n » Aug 16, 2010 21:01

Some time back I made a really fast opengl draw rotated ellipse function, which could be added...
relsoft
Posts: 1767
Joined: May 27, 2005 10:34
Location: Philippines
Contact:

Postby relsoft » Aug 16, 2010 23:04

h4tt3n wrote:Some time back I made a really fast opengl draw rotated ellipse function, which could be added...


Cool!!! Post away and I'll add it.
;*)
relsoft
Posts: 1767
Joined: May 27, 2005 10:34
Location: Philippines
Contact:

Postby relsoft » Aug 17, 2010 6:50

Update!!!

Added:

Code: Select all

1. Primitives
2. Glowlines
3. Gradient primitives


Same link in first post.

*did not implement a circle primitive as I am waiting for h4tt3n's ellipse routine.
Galeon
Posts: 563
Joined: Apr 08, 2009 5:30
Location: Philippines
Contact:

Postby Galeon » Aug 17, 2010 7:57

Kamusta?

Return to “Projects”

Who is online

Users browsing this forum: No registered users and 2 guests