Rendering deformed hill using jogl primitives?

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Rendering deformed hill using jogl primitives?

falcon_intel
Hello
Can anyone guide me how to draw a deformed hill using jogl primitives? I can use for drawing it triangles and quads or triangle strips, but I have no idea what parameters to give in order to draw it. Can someone guide me please?
Reply | Threaded
Open this post in threaded view
|

Re: Rendering deformed hill using jogl primitives?

gouessej
Administrator
Hi

Isn't your deformed hill composed of triangles?
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Rendering deformed hill using jogl primitives?

falcon_intel
Hi, yes it is also ok. But I don't have any idea the vertex order etc any advise please?
Reply | Threaded
Open this post in threaded view
|

Re: Rendering deformed hill using jogl primitives?

jmaasing
JOGL is a pretty low-level API, almost direct calls to OpenGL wich is a quite hard API to use. Maybe you will have better progress using a games framework that usually have code for doing operations like displaying a height-field.
Personally I like jMonekyEngine (http://jmonkeyengine.org/) or Ardor3D (https://github.com/gouessej/Ardor3D).
Even if you do not use those libraries you can look at their source code to learn how they do for displaying a height field.
Reply | Threaded
Open this post in threaded view
|

Re: Rendering deformed hill using jogl primitives?

falcon_intel
I have to use only jogl
Reply | Threaded
Open this post in threaded view
|

Re: Rendering deformed hill using jogl primitives?

gouessej
Administrator
In reply to this post by falcon_intel
Given the 3 vertices of a triangle, computing the surface normal will tell you in which direction the triangle is facing (clockwise or counter clockwise) and the initial value of glFrontFace is GL_CCW. If you don't enable the back face culling (GL_CULL_FACE), both faces will be visible.

You can use the example of code I posted on Wikipedia if you want:
https://gist.github.com/gouessej/3420e2b6f632efdddf98

Then, compute the triangles and replace the quads by your triangles. After that, replace the code using immediate mode (glBegin(), glEnd(), ...) by some code using the retained mode (VBOs). You can look at the project jogl-demos, especially the examples in the OpenGL Red Book ported to JOGL.

Edit.: Your triangles must be in the view frustum to be visible. Carefully set the projection matrix and the model-view matrix.
Julien Gouesse | Personal blog | Website