Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (495)
Games in Android Showcase (114)
games submitted by our members
Games in WIP (563)
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 1272 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) {
       setIdentity();
       matrix.rotX(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 Member




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 Kernel


Medals: 164
Projects: 23
Exp: 18 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.

Kev

Offline crystalsquid

Junior Member




... 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  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Dwinin (29 views)
2014-09-12 09:08:26

Norakomi (57 views)
2014-09-10 13:57:51

TehJavaDev (79 views)
2014-09-10 06:39:09

Tekkerue (39 views)
2014-09-09 02:24:56

mitcheeb (59 views)
2014-09-08 06:06:29

BurntPizza (45 views)
2014-09-07 01:13:42

Longarmx (30 views)
2014-09-07 01:12:14

Longarmx (36 views)
2014-09-07 01:11:22

Longarmx (36 views)
2014-09-07 01:10:19

mitcheeb (40 views)
2014-09-04 23:08:59
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org 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‑gaming.org
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!