Render Targets with Surfaces (GM 8.0)

A place for people with an interest in developing new shmups.
Post Reply
User avatar
BPzeBanshee
Posts: 4859
Joined: Sun Feb 08, 2009 3:59 am

Render Targets with Surfaces (GM 8.0)

Post by BPzeBanshee »

Cheers to eebrozgi for giving me the challenge.

http://www.mediafire.com/download/um9xl ... GICHAX.gmk

Image

I'll need to put out a V2 of this, there's a few things regarding alpha blending and some optimisations that I've since been able to do, but in short: this allows your 240x320 native game to make a duplicate render to a resizable rotatable surface, and then hide the actual window.

Unfortunately this isn't quite what n0rty had in mind considering the game's still running in the top-left corner (just hidden) meaning you're effectively running the display of the game twice, increasing performance requirements, rather than just picking your render and only rendering once. Why do I do it this way? GM sucks and Yoyogames and their forums aint gonna help.

Pros:
- TATE on the fly
- wallpaper backgrounds!
- alternate game layouts (Aero Flux, Trig Wars and GMOSSE layout all in one)

Cons:
- still need a game reboot if you want to change window size (a must for this)
- not everyone can use surfaces
- higher performance requirements
Last edited by BPzeBanshee on Thu Sep 19, 2013 12:35 am, edited 1 time in total.
User avatar
n0rtygames
Posts: 1001
Joined: Thu Mar 15, 2012 11:46 pm
Contact:

Re: Dark Magic with Surface Rendering (GM)

Post by n0rtygames »

Good job Bpze

and for those who attempt such dark magics, I'm going to point you here as a guide for how to retrospectively add such functionality without actually breaking your existing game if you've already written one.

http://shmups.system11.org/viewtopic.php?f=9&t=47272

There. Now there is literally zero reason for anyone ever to say to us "Tate is too much work"

MISSION FUCKING ACCOMPLISHED
facebook: Facebook
User avatar
Rozyrg
Posts: 918
Joined: Wed Feb 11, 2009 12:03 am
Location: Southeast USA

Re: Render Targets with Surfaces (GM 8.0)

Post by Rozyrg »

Ahhh, lovely! Great work, guys. :D

I might have more fun using it for demo type effects than anything else, though.
User avatar
BPzeBanshee
Posts: 4859
Joined: Sun Feb 08, 2009 3:59 am

Re: Render Targets with Surfaces (GM 8.0)

Post by BPzeBanshee »

Need some guys who have GM 8.0 Pro to test this GMK: http://www.mediafire.com/?7nqmbs8mwg0kbha

Run in Debug mode, look at the FPS display for a bit and hit space to cycle through the different modes. One draws plain text with standard font. The second draws with sprite-based fonts. The third does one draw of plain text, renders it to a surface and then draws the surface. The fourth does the same but with a sprite-based font.

Apparently doing it with surfaces like this and only updating when you need it gives better performance. The stats I'm getting call bullshit, suggesting that the cost of using a surface is greater than just drawing the text once per frame - but my GPU is weaker than my CPU, so my running theory is that folks with proper graphics cards will get the better performance with surfaces.
Post Reply