Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>OpenGL doesn't really work well with large numbers (like anything over 10.0f, just the way it is designed). It would be better to convert your coordinates to be between -1 and 1 (i.e. normalize) than to try and make openGL use coordinates of 50f or 290f.</p> <p>The reason the coordinates are normalized to between -1 and 1 is because model coordinates are only supposed to be relative to each other and not indicative of their actual dimensions in a specific game/app. The model could be used in many different games/apps with different coordinate systems, so you want all the model coordinates to be in some normalized standard form, so the programmer can then interpret in their own way.</p> <p>To normalize, you loop through all your coordinates and find the value furthest from 0 i.e. </p> <pre><code>float maxValueX = 0; float maxValueY = 0; float maxValueZ = 0; // find the max value of x, y and z for(int i=0;i&lt;coordinates.length'i++){ maxValueX = Math.max(Math.abs(coordinates[i].getX()), maxValueX); maxValueY = Math.max(Math.abs(coordinates[i].getY()), maxValueY); maxValueZ = Math.max(Math.abs(coordinates[i].getZ()), maxValueZ); } // convert all the coordinates to be between -1 and 1 for(int i=0;i&lt;coordinates.length'i++){ Vector3f coordinate = coordinates[i]; coordinate.setX(coordinate.getX() / maxValueX); coordinate.setY(coordinate.getY() / maxValueY); coordinate.setZ(coordinate.getZ() / maxValueZ); } </code></pre> <p>You only need to do this once. Assuming you are storing your data in a file, you can write a little utility program that does the above to the file and save it, rather than doing it every time you load the data into your app</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload