33463

Projection matrix from OpenGL to DirectX

Question:

I have an application which uses openGL and i have to port it to DirectX. To sum up my issue : How can I port a rotation matrix based on a right-handed coordinate system to a left-handed coordinate system ?

This is what i found on <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/bb204853%28v=vs.85%29.aspx" rel="nofollow" title="MSDN">MSDN</a>:

<ul><li>

Flip the order of triangle vertices so that the system traverses them clockwise from the front. In other words, if the vertices are v0, v1, v2, pass them to Direct3D as v0, v2, v1.

</li> <li>

Use the view matrix to scale world space by -1 in the z-direction. To do this, flip the sign of the _31, _32, _33, and _34 member of the D3DMATRIX structure that you use for your view matrix.

</li> </ul>

This works fine except I cannot flip easily my vertices because I got an 3D model from CATIA which is not a primitive, so I can't use it.

(I'm aware of row-major and column-major difference, it does not matter)

Do you know how I can port my rotation matrix from openGL to DirectX ?

Answer1:

Regarding the <strong>handedness</strong> of your underlying coordinate system and a given <strong>rotation</strong> transformation, the positive rotation in a right-handed coordinate system is determined by the right-hand rule and vice versa. So, if you have two coordinate systems with a different handedness by <strong>flipping the sign</strong> in front of the rotation angle you have adjusted the rotation matrix. You have ported your rotation matrix :)

Recommend

  • Testing if a linked list is equal to each other
  • Traverse directed edges recursively with OrientDB
  • Is there a way of querying or accessing the structure of a Z3 expression via the API
  • IJulia install - WARNING: Module BinDeps uuid did not match cache file
  • JavaFX apllication does not run with Selenium WebDriver
  • Shortest path in a grid
  • Colour specific node in igraph
  • iOS 8.3 - Metal, found nil while unwrapping an Optional Value
  • npm thinks node is out of date, but it isn't
  • Column Nullability/Optionality: NULL vs NOT NULL
  • stringify/parse edn in clojure/ClojureScript
  • Nginx rewrite equivalent to Apache RewriteRule that converts URL params into QueryString key/value p
  • Transpose table then set and rename index
  • How can I tell Phusion Passenger which python to use?
  • Using an enum contained in a Cloud Endpoint model on a Android client
  • help('modules') crashing? Not sure how to fix
  • lauch4j hello world program
  • How to check if a string contains any string of a column in MySQL and vice versa?
  • ConfigurationBuilder not working in azure function
  • CSS how to fix an element to scroll horizontally with the page but not vertically?
  • OpenGL - Object Transformations and VBOs
  • Uber API - requests endpoint cannot read read json
  • Can XOR be expressed using SKI combinators?
  • docx4j replace variable with html
  • PyQt4 application on Windows is crashing on exit
  • Unable to play media with vlc ocx
  • Embedded Google Maps in Rails not responsive
  • Watson Conversation - Why is the ANYTHING ELSE node not chosen
  • pickle.PicklingError: args[0] from __newobj__ args has the wrong class with hadoop python
  • Laravel 4 routing not working due to .htaccess file?
  • Using $compile in a directive triggers AngularJS infinite digest error
  • android google indoor map
  • Eclipse CDT error: Unable to compile
  • Using jQuery closest() method with class selector
  • Where to put my custom functions in Wordpress?
  • 0x202A in filename: Why?
  • Arrays break string types in Julia
  • PHP: When would you need the self:: keyword?
  • How does Linux kernel interrupt the application?
  • Does armcc optimizes non-volatile variables with -O0?