Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (757)
Games in Android Showcase (229)
games submitted by our members
Games in WIP (844)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Y not let Hardware do transformations?  (Read 2169 times)
0 Members and 1 Guest are viewing this topic.
Offline IchHauEuchAlleUm

Senior Newbie

Java games rock!

« Posted 2004-10-30 13:17:26 »

hi, y the hell, does Xith let the CPU do the matrix calculations and not openGL and the GFX-Card??
For example in the Class Transform3D:

private MatrixExt4f matrix = null;

public void rotX(float angle) {

MatrixExt4f is a subclass from Matrix4f from the package javax.vecmath.

One of the main advantages of today's GFX-Cards is that they do all the expensive calculations.
Pls, someone help me
Offline GKW

Senior Devvie

Revenge is mine!

« Reply #1 - Posted 2004-10-30 13:50:39 »

Your graphics card does this kind of transformation:

Matrix * Vector = transformed Vector

The time it would take to send the rotation command to the card and then sending the matrix back is probably much greater than the time it takes your cpu to do the same calculation.
Offline IchHauEuchAlleUm

Senior Newbie

Java games rock!

« Reply #2 - Posted 2004-10-30 16:05:32 »

u don't have to get the matrix back.
There r very effective calls in openGL directly for rotation, translation and scaling: glRotate, glTranslate and glScale. But theese commands r never used by Xith. Xith itself calculates a matrix and sends it to openGL by the much less efficient method glMultMatrix.
So, when I have to change (move, rotate) 100 objects in my scene the CPU has to do all the transformations, possibly hundreds.
Normally in openGL u walk through your scenegraph and call glRotate....
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline kevglass

« JGO Spiffy Duke »

Medals: 319
Projects: 25
Exp: 22 years

Coder, Trainee Pixel Artist, Game Reviewer

« Reply #3 - Posted 2004-10-30 16:42:04 »

I'm not sure but I suspect its partly to do with factoring in the JNI overhead..

You might consider posting this (or getting it moved) in the Xith forum, more likely to hit the right folks there.


Offline crystalsquid

Junior Devvie

... Boing ...

« Reply #4 - Posted 2004-10-30 16:55:49 »

The hardware does do transformations (generally vector * matrix) - but you cannot EVER get the results back. This is the problem.

All 3D libraries require matrix maths on the CPU for moving things around (model matrices) animation, logic, etc. For example, boned animation requires several layers of matrix construction & concatenation. The final world matrices can then be passed to the GPU but you can't get the GPU to do all that concatenation/construction as it does not have access to the main memory (where the animation data is stored) and  does not know what algorithms you are using.

The logic behind this is the weight of numbers. If you have 100 objects each of 1000 vertices, then you only need a few hundred matrix operations per frame. The GPU however needs to transform 100,000 vertices per frame - hence the dedicated hardware to do it. The 100 odd matric calcs for moving the things around is trivial to a modern CPU.

Yet another reason is the fact that graphics cards actually do the work whilst you are rendering the NEXT frame. By staggering the load, this ensures a single point of synchronisation between the two processors (decoupling of parralel processes). This means that the GPU does not have to wait around when the CPU is busy and vice versa. Because of this decoupling, if you asked for a matrix op, you would not get the results until next frame - well after you needed it.

Hope this helps,

- Dom
Pages: [1]
  ignore  |  Print  

EgonOlsen (77 views)
2018-06-10 19:43:48

EgonOlsen (57 views)
2018-06-10 19:43:44

EgonOlsen (77 views)
2018-06-10 19:43:20

DesertCoockie (259 views)
2018-05-13 18:23:11

nelsongames (157 views)
2018-04-24 18:15:36

nelsongames (156 views)
2018-04-24 18:14:32

ivj94 (897 views)
2018-03-24 14:47:39

ivj94 (161 views)
2018-03-24 14:46:31

ivj94 (810 views)
2018-03-24 14:43:53

Solater (174 views)
2018-03-17 05:04:08
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!