Using Direct3D or multiple views?
Posted 09 March 2012 - 05:26 AM
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.
Posted 09 March 2012 - 06:07 AM
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.
Posted 09 March 2012 - 06:22 AM
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.
Posted 09 March 2012 - 06:37 AM
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.
Posted 09 March 2012 - 07:14 AM
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 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users