Dark Bit Factory & Gravity

PROGRAMMING => Freebasic => Topic started by: relsoft on August 27, 2010

Title: Easy GL2D
Post by: relsoft on August 27, 2010
Maybe useful to some of you....

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

Well here it is...

Easy GL2D
(Source and images)
http://rel.betterwebber.com/junk.php?id=115


Code: [Select]
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


Code: [Select]
**Everything is the same as the standard mode except that:

*******1. all calls to "byref image as Tglsprite" has been changed to
          "byval spr as image ptr"

*******2. Calling the sprite routines needs casting
          ie.
          PUT (310,30), images(81)
   
          becomes:

          gl2d.sprite(310,30,cast(gl2d.image ptr, images(81)))

            * no way to go around this as of the moment as we cannot undef stuff
              inside namespaces

*******3. init_sprites() changed prototypes (a lot simpler now)

*******4. Added load_image_to_HW(byval spr as image ptr)
          * Loads an FB.image to texture
          * See example file
 


There are now two versions.  The standard(old one) and the FB.IMAGE compatible one.

Difference are noted above.

Also by making it FB.Image compatible I was able to make use of Mysoft's pixel-perfect collision routine.

So we collide via sofware and at the same time, rendering via hardware.  Check out the example exes.

(http://rel.betterwebber.com/images/screenies/easygl2d.png)

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

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


UPDATE: V. 0.3

Code: [Select]
1. Fixed the bind-texture lineglow bug(Now faster than ever)
2. sprite_scale()
3. sprite_rotate_scale()
4. sprite_stretch()
5. sprite_stretch_h()
6. readme and docs
7. demo update

Features:

Code: [Select]
1. Function based so it's gonna be useful for just about anyone.
2. Uses standard FB calls
3. No external dependencies (uses GL/GLU and FB only)
4. Loads BMPs supported by FB's BSAVE/BLOAD
5. Adds transparency for non-alpha BMPs
6. Freaking easy to use
7. Full hardware usage
Limitations:

Code: [Select]
1. Full hardware usage
2. OpenGL limited


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!
Title: Re: Easy GL2D
Post by: Hotshot on August 27, 2010
I like the Reflections, Sprites Zooming, Sprites Rotations  :)

Very good..... :kewl:
Title: Re: Easy GL2D
Post by: nzo on September 03, 2010
This looks really cool... once I can get the examples to compile.. :)
Title: Re: Easy GL2D
Post by: relsoft on September 04, 2010
Thanks for trying it out guys.

Nzo: It uses FB 0.21. 

The easiest way to compile it is to add this lines at the top of the examples:
Code: [Select]
#include once "gl2d.bi"
#include once "gl2d.bas"
[code]

The test just included "gl2d.bi" since I used "gl2d.bas" as a module.





 
Title: Re: Easy GL2D
Post by: Hotshot on September 08, 2011
This should be Sticky topic because it is good Framework for people who are new to freebasic :)
Title: Re: Easy GL2D
Post by: Shockwave on September 15, 2011
Have you used it Hotshot?

Rels stuff is really good!
Title: Re: Easy GL2D
Post by: Hotshot on September 27, 2011
Quote
Have you used it Hotshot?

Yeah, I have checked it and good stuff :)