Really Newbie Puzzled by glTranslate

(reposted as a new thread because I noticed the “how to get started with jogl” thread was kind of old)

Greetings. As a novice to OpenGL, I humbly come with a bit of confusion in my mind.

The example (“how to get started with jogl”) worked pretty well for me. Then I went to NeHe’s tutorial and I thought I’d include bits of that in this example, and sure enough, coloured triangles and quads were soon spinning on my window. But not everything went ok.

The three points of this thread:

  1. The usual proportion for windows is 4:3 and so is the one proposed in this example, at 512x384. But that kind of flattens the proportions of the objects, so how does one decouple the dimensions of the window from the ones of the drawing space?

2)NeHe uses a glTranslatef(float,float,float) line to translate (duh) stuff on the drawing space, but if I can’t seem to make it work for the Z axis. Take the example in this thread exactly as it is and put a gl.glTranslatef(x,y,z) line before the glcolor. Changes to x and y will show up, but changes to z will be erratic. Between -1.0 and 1.0, it won’t change at all, and any other value will make the triangle disappear. Is this something that requires more than the simple inits performed in this example, or is it something jogl-related?

(ok, I had forgotten the 3rd point)

  1. Have the GL-types been implemented in jogl, or should one use standard java types?

Thanks for your time in advance.

Hmm yeah well. It’s hard to tell exactly what your problem is, but it seems you’re missing some kind of perspective transformation in the example you use.

I have some really simple examples in true 3D at http://www.furi.dk/java

You’ll have to use the demobox to view them and the source is tucked away inside the jars but they will show you what you need to know.

Thank you, will do. I already downloaded the webstarted version of your demobox, anyway. :wink:

[edit: Yes, it was a matter of perspective, coupled with inexperience. At some point I had both failed to properly init perspective settings and tried to compensate by altering proportions, which had led to invisible and/or misplaced objects. Well, learning one stumble at a time. ^^;]

immano, you might my OpenGL starter
page at http://www.waterlogic.com.sg/opengl
useful to you. It lists links to the most
popular resources to learning OpenGL.

.rex