10.03.2019 - Round 1 results of our "A Love Letter For FreeBASIC" game dev competition have been published. Please be sure to check the results thread: http://games.freebasic.net/forum/index.php?topic=629.0. Don't forget that the competition is continuing with a round 2, lasting till 29th of April, 300 USD first prize. Stay tuned!

Author Topic: 2D with OpenGL  (Read 6351 times)

ecxjoe

  • Novice
  • ***
  • Posts: 78
    • View Profile
    • Delta Code
2D with OpenGL
« on: January 26, 2011, 06:05:10 PM »
Are there any tutorials on this subject for Freebasic? Thanks.

Brick Break

  • Forum Sage
  • *****
  • Posts: 405
    • View Profile
Re: 2D with OpenGL
« Reply #1 on: January 26, 2011, 10:47:58 PM »
Are there any tutorials on this subject for Freebasic? Thanks.
No, there are not. Why the hell would you want to do this? Destroy everything we've worked for? OpenGL is for 3D games, and even then not all of them. I dread the day that we have to use OpenGL to make a game.

Mitchell

  • Forum Howler
  • ****
  • Posts: 197
  • Rockin Geek
    • View Profile
    • Email
Re: 2D with OpenGL
« Reply #2 on: January 26, 2011, 11:27:57 PM »
Not that I'm aware of, but if you're familiar with OpenGL as it is, you can look up the tutorials in C and see how to modify them there. IIRC, you mostly call the functions differently. Like glVertex3f(x, y, z) becomes glVertex2f(x, y), but it's been a long long time since I meddled with that stuff.

@Brick: If you are using OpenGL in your normal game, there's no switching back to FB's vanilla graphics (which means things like line(), pset(), and print don't work). So 2d graphics like menus and HUDs require OpenGL's 2d capabilities. Which are pretty similar to OpenGL's 3d function calls. Again, it's been a long time since I dealt with this stuff, so I may be slightly off on the details.
Never underestimate the destructive powers of somebody doing something new without having any clue of how to do it. :P

KristopherWindsor

  • Forum Sage
  • *****
  • Posts: 363
  • The Thirsty Smiley
    • View Profile
    • Reddit/r/pics
    • Email
Re: 2D with OpenGL
« Reply #3 on: January 26, 2011, 11:28:24 PM »
I didn't make a tutorial, but I have done this before:
http://www.freebasic.net/forum/viewtopic.php?t=10607

Also, Brick Break doesn't know what he's talking about.
The performance with a decent graphics card is /way/ better than you'll ever see in FBGFX.

Lachie Dazdarian

  • Double dipper
  • Administrator
  • Forum Sage
  • *****
  • Posts: 1308
    • Yahoo Instant Messenger - lachie13
    • View Profile
    • The Maker Of Stuff
    • Email
Re: 2D with OpenGL
« Reply #4 on: January 27, 2011, 12:04:47 AM »
Did you guys forget about relsoft's Easy GL2D?

http://www.freebasic.net/forum/viewtopic.php?t=16222

It's basically a FBGFX-like frontend for OpenGL. Hardware accelerated 2D gfx with all the user-friendliness of FBGFX.

You can find some tuts on it in Back to Basic #2: http://imortisoft.no-ip.org/b2b/?Issue_%232:Basic_2D_Rendering_in_OpenGL_using_Easy_GL2D%3A_Part_1

I'm making a game in Easy GL2D as a matter of fact.

"Things like Basic and Free Basic provide much-needed therapy and a return to sanity and a correct appreciation of people. The arrogant folk really hate a word like 'Basic' - fine, and good riddance." ~ pragmatist

Brick Break

  • Forum Sage
  • *****
  • Posts: 405
    • View Profile
Re: 2D with OpenGL
« Reply #5 on: January 27, 2011, 05:18:39 PM »
The performance with a decent graphics card is /way/ better than you'll ever see in FBGFX.

That's because FBGFX doesn't have a decent triangle function. A better library would be better.

I have researched this, and standard software rendering is better than any integrated graphics, however most software rendering libraries suck because either

a) They operate on a lower level than the operating system
or b) they don't have anybody backing them up (big companies)

Also, don't speak about me in the third person.

EDIT: deleted rant
« Last Edit: January 27, 2011, 05:46:23 PM by Brick Break »

ecxjoe

  • Novice
  • ***
  • Posts: 78
    • View Profile
    • Delta Code
Re: 2D with OpenGL
« Reply #6 on: January 27, 2011, 08:01:34 PM »
Thanks for you help everybody!

My reasoning for this is to scale graphics onto the current desktop resolution rather than changing the resolution; switching to and back from 320x240 and 640x480 isn't a friendly experience for a lot of people...flickery, slow, messes up the icons and even resizes other open windows down. Ok, so really that's a Windows OS problem, but I don't know of another solution. So for optimum performance I want to use OpenGL.

Brick Break

  • Forum Sage
  • *****
  • Posts: 405
    • View Profile
Re: 2D with OpenGL
« Reply #7 on: January 28, 2011, 01:09:40 AM »
Thanks for you help everybody!

My reasoning for this is to scale graphics onto the current desktop resolution rather than changing the resolution; switching to and back from 320x240 and 640x480 isn't a friendly experience for a lot of people...flickery, slow, messes up the icons and even resizes other open windows down. Ok, so really that's a Windows OS problem, but I don't know of another solution. So for optimum performance I want to use OpenGL.
Oh, that? Well, I'd say you should have designed it for 640x480 in the first place. If Windows wants to glitch out on you, that's its problem.