Matrix stacks in OGL and in D3D

Started by
2 comments, last by kill 23 years, 5 months ago
Ok, I can''t get an answer to this anywhere. You know how in OGL you have a matrix stack implemented in it? Does OGL use T&L card capabilities to perform matrix operations? D3D doesn''t have this stack, so I have to implement it myself, and my code in software will be way slower then OGL on T&L cards. Right?
Advertisement
quote:
Does OGL use T&L card capabilities to perform matrix operations?

Yes. If your video card is non-hardware T&L then the matrix ops. will be done by the cpu.

quote:
D3D doesn''t have this stack, so I have to implement it myself, and my code in software will be way slower then OGL on T&L cards. Right?

Use d3dx utility library matrix stack. You send non-transformed and unlit vertices to the T&L hardware aware video card. You can also transform and not lit your vertices or transform and lit your own vertices and send them to the HW T&L aware card but the cpu will do all the transforms and lighting while the gpu will not thus your game will run slower on HW T&L cards. Hope this helps



I understand that processing vertices is done on the board if it supports T&L. But what about the matrix operations that are done on higher level, object level. Not processing verteces, but matrix operations. Are they done on T&L cards? Also, do you think D3DX library utilizes T&L cards to perform these operations?

Thanks.
You mean like matrix multiplication using d3dx libs? In that case, I think the MS wrote those operations in assembly using MMX or SIMD or AMD special cpu instructions. You can download Intel optimized matrix ops. from intel website if you don't want to use d3dx ones. I haven't used intel's so I don't know how fast they are. In HW T&L cards the transforms are done in hardware. You send your vertices to the card using DrawIndexedPrimitive() and other calls and you set a world, view and projection matrices of the 3D state machine. The HW T&L card then grabs the 4x4 matrix that you specified in the state machine and multiplies all the vertices by it, this is done in hardware. The untransformed vertices and matrices travel across the agp bus and end up in a vertex cache on the video card. In non HW T&L all the matrix operations are done on the cpu side and you send transformed vertices to the video card. On a 2D video card, cpu does the transforms as well as clipping, filling of primitives, z buffering all done by the software pipeline running on cpu utilizing simd, mmx or amd graphic cpu instructions then the software pipe draws pixels on the back buffer. Hope I answered your question otherwise just post away and will help next time

P.S. All the collision detection code using cross and dot products can be done with the d3dx library but the ops. will be done by the cpu and not the video card. Only the 3 matrices that you place on the 3 separate matrix stacks(world, view and projection) will be multiplied with your vertices after you have decomposed your 3D world objects into triangles. Of course, before this you do culling of the geometry using bsp trees, frustum culling, octrees, etc. to eliminate objects from collision tests and eliminate sending vertices of these objects to the video card.

Edited by - JD on October 24, 2000 10:52:08 PM

Edited by - JD on October 24, 2000 10:55:36 PM

This topic is closed to new replies.

Advertisement