ENIGMA Forums

General fluff => General ENIGMA => Topic started by: TheExDeus on October 18, 2013, 03:02:24 PM

Title: GL3 matrices
Post by: TheExDeus on October 18, 2013, 03:02:24 PM
What would be the best matrix library to use for GL3 matrices (view matrix, model matrix and so on)? I see that there is glm.g-truc.net, but it's 1.6mb. Then there is VS*L http://www.lighthouse3d.com/very-simple-libs/vsml/ and it is smaller, but I think it has a lot more dependencies. GLM is a header only library on the other hand, so it is easier to include. Any other ideas? Technically we can write our own (have done this) or just use the code included here: http://www.lighthouse3d.com/cg-topics/code-samples/opengl-3-3-glsl-1-5-sample/ . Graphics really don't need all the fancy matrix math. It needs addition, multiplication and inversion and all of those functions can be optimized, because graphics only use 4x4 matrices.
This is a topic I actually mentioned earlier (when I actually wanted to remove all deprecated stuff from GL3). Now the idea is back and we need to start with a decision.

edit: Also found CML, http://cmldev.net/. Also seems to be include only, ~690kb.
Title: Re: GL3 matrices
Post by: Goombert on October 18, 2013, 04:24:00 PM
Harri, our new developer CoolBreeze/Rexhunter is already doing that, she sent a commit last night that actually fixed our client so the deprecated functions are no longer usable. I am writing device manager interfaces for the fixed function pipeline, as I committed earlier today for Direct3D9 as directed by the DX SDK manual because render states such as fog are not memorized between Begin/End scene calls and internal state blocks are shitty as fuck and a part of the ffp, I have to do the one for OpenGL before we can rewrite the ffp with GLSL. Basically this interface handles global batching, state management to minize not only bindings but other interference with the GPU such as shader and sampler changes, and of course, makes it real easy to replace the whole ffp.

So just hold off a bit on that Harri until I write OpenGL's device manager. Also, I am going to throw a similar system to your global 2D batcher into OpenGL 1 and it will use vertex arrays, everything will in OpenGL 1, that is why I changed it to 1.1, it makes it a lot easier to manage the data and have the graphics systems pretty similar, people with really old hardware always have at least Direct3D 9 support even back on XP anyways. But at any rate my device manager got unnecessary state changes to Direct3D 9.0 down to absolutely 0 in a few games I tested.

Also Harri if you could run that cubes demo from Studio I compiled and got fully working exactly the same now and tell me your performance in RAM and CPU usage as well as framerate, that would be awesome, so far people have been reporting the ENIGMA compiled versions running up to 100fps faster with anti-aliasing.
https://www.dropbox.com/s/1l32ipnapkvlene/CubesDemo.zip
Title: Re: GL3 matrices
Post by: TheExDeus on October 18, 2013, 05:53:28 PM
Alright then. Just wanted to create a water reflection demo, but noticed that I cannot use new GLSL because of lacking matrices. Will try to use GLSL1.1 anyway. And you say deprecated functions are not usable, but that means GL3 is broken now? Because we do use many deprecated functions there...

yoyocompiler.exe - 800-1300FPS, 13% CPU and 173mb ram.
opengl3.exe - It's vsynced to 60fps, 25% CPU and 80mb ram.
opengl1.exe - It's vsycned to 60fps, 25% CPU and 150mb ram.
direct3d9.exe - 930-1600FPS, 8% CPU and 89mb ram.

To turn off vsync in ENIGMA you must explicitly call set_synchronization(false). If you didn't do that, then it will cap to vsync.
Title: Re: GL3 matrices
Post by: Goombert on October 18, 2013, 08:48:16 PM
Harri, there is supposed to be a matrix constant in Studio, I don't remember what it is called.

http://docs.yoyogames.com/

Feel free to add it.

But yes thanks for running the demo, I will have them even higher performance when we rewrite the device managers I code to get rid of the FFP. And thanks for telling me about synch, I will be moving that into bridges to implement display_reset(aa, vsync); for OpenGL, but that should be off by default unless it is ticked in Global Game Settings. I think you have your graphics card forcing it on.
Title: Re: GL3 matrices
Post by: TheExDeus on October 19, 2013, 04:24:10 AM
It's gm_Matrices, and  I cannot add it until we actually use matrices for all the math.

Quote
but that should be off by default unless it is ticked in Global Game Settings. I think you have your graphics card forcing it on.
If you want vsync to be off by default, you should actually call that when the game starts. Maybe in graphics_init() or something.
Title: Re: GL3 matrices
Post by: The 11th plague of Egypt on October 19, 2013, 02:33:40 PM
Don't know if it can help.

Here's some fancy stuff for matrices in 3D graphics
http://lolengine.net/blog