pouët.net

Go to bottom

Matrix conventions / multiplication order

category: code [glöplog]
I think the information sort of got to my brain now, thanks for sharing spike. In any way, before i have to take care of such issues, I'd have to write an application that is worth being ported at first!
added on the 2013-09-05 09:14:58 by nystep nystep
In the era of shaders it is no longer relevant.
D3D10+ and new versions of OpenGL (ES) have removed any fixed-function matrix functionality anyway, so it is entirely up to you what type of matrices you use.
In the end you just pass arrays of floats to the shaders, and the shader languages are capable of handling matrices either way.

So even if you want to do an engine that is cross-API, you don't necessarily have to have two separate codepaths for matrix math.
added on the 2013-09-05 11:02:03 by Scali Scali
so in the era of javascript it is no longer relevant to understand how a CPU works? great :)
added on the 2013-09-05 12:09:30 by arm1n arm1n
now it's just getting sad

1. scali: there's more to life than gpu based rendering (but you're right, though)
2. spike: stop being dumb
added on the 2013-09-05 12:13:27 by superplek superplek
Quote:

flure: i want to see you taking the projection matrix from glm and stick it straight inside D3D and it works fine.. :)


You can tell glm if you're using a row major order or column major order system. I never used it though, as I'm only OpenGL.
Anyway, using glm (or anything else, glm is only an example) for everything and fixing only the perspective matrix (which is kind of a hack, by the way) should do the trick quite easily.
added on the 2013-09-05 15:03:33 by flure flure
There's more difference between D3D and GL (and other hardware/APIs) projection matrices than a simple transpose; eg. the range and even the direction of post-projection Z, the exact screen pixel offset, etc. That's the one part that needs to be platform dependent. Best to just have per-platform setup routines for orthographic and projective matrices that do the right thing.
added on the 2013-09-05 15:24:08 by kb_ kb_
Quote:
added on the 2013-09-05 12:09:30 by spike spike

now it's just getting sad

1. scali: there's more to life than gpu based rendering (but you're right, though)


There is? Like what? Amigas? 286s? C64?... :P
added on the 2013-09-05 15:34:22 by Scali Scali
Quote:
Best to just have per-platform setup routines for orthographic and projective matrices that do the right thing.


Better idea than what I used to do. But OK, that was porting ;)
added on the 2013-09-05 16:25:57 by superplek superplek
Quote:
the exact screen pixel offset


Yes, the pixel:texel mapping was also changed from D3D9 to D3D10.
Iirc D3D10+ uses the same mapping as OpenGL now (1:1, rather than shifted by half a unit).
added on the 2013-09-05 16:26:49 by Scali Scali
that's the first thing that struck me too, kb still in d3d9-land? :)

oh look at this "i know i know" thread derailment.
added on the 2013-09-05 18:39:31 by superplek superplek

login

Go to top