Author Topic: Easy GL2D  (Read 5694 times)

0 Members and 1 Guest are viewing this topic.

Offline relsoft

  • DBF Aficionado
  • ******
  • Posts: 3303
  • Karma: 47
    • View Profile
Easy GL2D
« 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.



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!
Challenge Trophies Won:

Offline Hotshot

  • DBF Aficionado
  • ******
  • Posts: 2114
  • Karma: 91
    • View Profile
Re: Easy GL2D
« Reply #1 on: August 27, 2010 »
I like the Reflections, Sprites Zooming, Sprites Rotations  :)

Very good..... :kewl:

Offline nzo

  • Atari ST
  • ***
  • Posts: 126
  • Karma: 68
    • View Profile
    • Amiga Remakes in DHTML
Re: Easy GL2D
« Reply #2 on: September 03, 2010 »
This looks really cool... once I can get the examples to compile.. :)

Offline relsoft

  • DBF Aficionado
  • ******
  • Posts: 3303
  • Karma: 47
    • View Profile
Re: Easy GL2D
« Reply #3 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.





 
Challenge Trophies Won:

Offline Hotshot

  • DBF Aficionado
  • ******
  • Posts: 2114
  • Karma: 91
    • View Profile
Re: Easy GL2D
« Reply #4 on: September 08, 2011 »
This should be Sticky topic because it is good Framework for people who are new to freebasic :)

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17397
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: Easy GL2D
« Reply #5 on: September 15, 2011 »
Have you used it Hotshot?

Rels stuff is really good!
Shockwave ^ Codigos
Challenge Trophies Won:

Offline Hotshot

  • DBF Aficionado
  • ******
  • Posts: 2114
  • Karma: 91
    • View Profile
Re: Easy GL2D
« Reply #6 on: September 27, 2011 »
Quote
Have you used it Hotshot?

Yeah, I have checked it and good stuff :)