Hello Guest

Can someone give me a code sample that renders 2 cubes at different Z-axis?

  • 1 Replies
  • 3403 Views
*

Peilot

Since I've had trouble rendering on Z-axis, I would like to see how you do it!

*

Offline bobjob

  • ****
  • 394
  • LWJGL: WOW SO GOOD
have you tried having a look at the LWJGL Demos?

to draw a cube at a different z level.

Either create 2 cubes with different z values (not what you want), or simply translate the mesh then re draw it.

notice the model translate method in the code:
Code: [Select]
model
.identity()
.translate(
-15.0f + xx * 3.0f,
-15.0f + yy * 3.0f,
0.0f) // <-- change this value here to effect the position on the z-axis
.rotateAffineXYZ(
time + xx * 0.21f,
time + yy * 0.37f,
0.0f)

keep in mind that the example demo sets the limit of the depth range to 0.1 - 100 if your second cube is positioned outside of this range from the camera view it will not display
« Last Edit: January 25, 2017, 05:08:53 by bobjob »