Hi everyone,
I'm rather new to Java and JOGL, and had a question about drawing a color onto a model. For example, I load a 3D model of a rod and then want to have the code draw and update a color gradient along the rod (say, for temperature). Or another scenario: I've got a model of a satellite, and as it spins and moves around a globe, I want the part of the satellite visible from a point on the globe to be colored. Is it possible to do this? Thanks for your time! |
Administrator
|
On 06/25/2013 08:26 PM, Sesquipedaliac [via jogamp] wrote:
> Hi everyone, > > I'm rather new to Java and JOGL, and had a question about drawing a color onto > a model. > > For example, I load a 3D model of a rod and then want to have the code draw > and update a color gradient along the rod (say, for temperature). > Or another scenario: I've got a model of a satellite, and as it spins and > moves around a globe, I want the part of the satellite visible from a point on > the globe to be colored. > > Is it possible to do this? > pls lookup some good OpenGL ES2 and/or OpenGL 3/4 core profile tutorials using the shader language (GLSL). I wouldn't waste time learning the old fixed function pipeline anymore. We have a few info in this regard in our wiki. Then .. you can also check our unit tests and demos as well, but AFAIK other OpenGL tutorials are more suitable. When you got a good idea about OpenGL itself, its pretty simple to use JOGL. Cheers, Sven signature.asc (911 bytes) Download Attachment |
This post was updated on .
In reply to this post by Sesquipedaliac
You may think of it in terms that the temperature data is part of your model. Its your codes job to prepare the model data and then feed JOGL and hence your OpenGL driver with this data. There is several ways to solve this, i would recommend you to split your model into two models, one static model containing the thermometer hull and another model containing only the rod. When you prepare data for the rod you may choose to do the gradient using the fragment shader of your GPU in order to create mathematically smooth gradients; If you prefer divide the rod into stacked slices and then paint each slice according to your temperature data. You then need to choose from writing your own 3D engine that can dynamically update the model or use an existing 3D engine. The purpose of JOGL is basically to allow the 3D engine to open an window and obtain an OpenGL surface and handle user input. Its the 3D engines task to update the model. Try solve this by using an 3d engine with an API suitable for the task of solving the underlying mathematical calculations needed to update the models. The task of making a part of a globe highlighted can easily be accomplish using the NASA WorldWind SDK. WorldWind is an API especially designed to do visual presentation on top of the globe. WorldWind is used internally by many satellite tracking software to ease generation of these kind of visuals. WorldWind 2.0 use JogAmp JOGL internally for the OpenGL binding. http://goworldwind.org/demos/ http://worldwind.arc.nasa.gov/java/index.html I recommend you to read a generic book on OpenGL with focus on using the programmable pipeline in order to get familiar with using modern OpenGL. The ideas from any OpenGL book can be applied when using JOGL since its the same API. http://www.arcsynthesis.org/gltut/ - Jason L. McKesson: Learning Modern 3D Graphics Programming - e-book Yes it is all possible, and you're welcome. Xerxes |
Administrator
|
It would be interesting to port these examples to JOGL 2. Someone started this work some months ago.
Julien Gouesse | Personal blog | Website
|
Free forum by Nabble | Edit this page |