LWJGL Forum

Please login or register.

Login with username, password and session length

Author Topic: Can someone give me a code sample that renders 2 cubes at different Z-axis?  (Read 183 times)

Peilot

  • Newbie
  • *
  • Offline Offline
  • Posts: 9

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

bobjob

  • Prolific Timewaster
  • ****
  • Offline Offline
  • Posts: 380
  • 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
Logged