Jump to content


Photo

Using Direct3D or multiple views?


  • Please log in to reply
5 replies to this topic

#1 Captain_April

Captain_April

    GMC Member

  • Validating
  • 4 posts

Posted 09 March 2012 - 05:26 AM

Hi all,
I was wondering which would be the more efficient method of GUI creation:
1. having a view for game action and a view for the GUI with all object draw events testing for the right view before drawing?
2. Using d3d_set_projection_ortho(0,0,view_wport,view_hport,0) before drawing the GUI
3. Going through the GUI code and adding view_xview and view_yview to the draw coordinates of everything

I'm not wondering which is easier to code, but whether it's better to let GM call all draw events twice and have an early-exit when the event doesn't need to execute, call d3d_set_projection_ortho at the beginning and and of GUI drawing, or have a lot more addition in the draw events. My guess, and what I normally do, is that option 2 is the most effective because it involves code in the direct3D library instead of a lot more GML executing.

Any insight on the matter is much appreciated.

#2 BattleRifle BR55

BattleRifle BR55

    Moo

  • GMC Member
  • 8246 posts
  • Version:GM7

Posted 09 March 2012 - 06:07 AM

This doesn't belong in the Advanced forum.

The second option is the best because all you have to do is set up the ortho projection, and then you can do whatever you like with it without having to worry about view positions, angles, scaling, game interference, and all that.
  • 0

#3 Captain_April

Captain_April

    GMC Member

  • Validating
  • 4 posts

Posted 09 March 2012 - 06:22 AM

I figured it would fall under this category because it was about a finer point of the speed of GM's architecture--if using the d3d library to cut back on the amount of code that needs to be executed is faster than doing extra addition or making GM push into a draw event and then pop immediately out.

I'm not concerned with the ease of using any of the options or the number of things I can do with them. This is a pure speed of execution question that I was wondering if anyone knew the answer to.

Edited by Captain_April, 09 March 2012 - 06:29 AM.


#4 BattleRifle BR55

BattleRifle BR55

    Moo

  • GMC Member
  • 8246 posts
  • Version:GM7

Posted 09 March 2012 - 06:37 AM

It should be obvious that the ones with less draw calls would definitely be faster. As for whether you draw to the screen or in the "game world", the difference is negligible, and the only things to truly consider would be what I pointed out.
  • 0

#5 Captain_April

Captain_April

    GMC Member

  • Validating
  • 4 posts

Posted 09 March 2012 - 07:04 AM

It should be obvious that the ones with less draw calls would definitely be faster. As for whether you draw to the screen or in the "game world", the difference is negligible, and the only things to truly consider would be what I pointed out.


It should be obvious, and it is. That was what I initially assumed and normally do. But in the case of the project I'm working on now, with a rather extensive C++ backend that I'm writing, no differences are negligible and the other two options are still on the table. If anyone has any other insight into the matter it would be appreciated.

#6 BattleRifle BR55

BattleRifle BR55

    Moo

  • GMC Member
  • 8246 posts
  • Version:GM7

Posted 09 March 2012 - 07:14 AM

It more depends on what you're actually doing within these two options than whether which is faster. If you're drawing something in the bottom left corner and want it to stay there no matter what the view angle is, do you want to use trigonometry and image angles to keep it where it is, or draw it to the screen via an ortho projection and keep the code interpretation overhead to a minimum? Are you using a GM version older than 8 in which changing variable contents is slower, thus adding more overhead when changing the positions when doing the former?

You can either choose between doing more work than necessary, adding to GM's overhead and producing a result that may not look or run as cleanly, or simply relying on a render target change before drawing your stuff.

I don't really understand what input on the other options is going to add if you know your current way is good enough for you to be choosing it in the first place, not to mention that you've already answered your question in the OP with what I just went over.
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users