glGetMaterialfv woes

Hi all, sorry to introduce myself to the forums with a help request.
I’ve been producing a basic scene graph for a graphics project and whilst attempting to make nodes to represent Materials i’ve needed to store the properties of previous materials within the tree for reapplication when heading back past each material for a new traversal.

After a quick peruse of the API, glGetMaterialfv seems the ideal method for grabbing current material settings. The problem is, i can’t find any examples of it’s usage and i’ve not had much luck getting it to work so far.

I’ve tried using the floatBuffer technique but have had no joy getting workable values from a direct view to a byteBuffer.
The glGetMaterialfv(int face, int pname, float[] params, int params_offset) is an enigma to me also :frowning:

Can anyone give me a quick example of the technique in action?
Many thanks in advance!

Something like


float val = new float[4];
gl.glGetMaterialfv(GL.GL_FRONT, GL.GL_DIFFUSE, val, 0);
// val now contains the diffuse color

I was sure it would work like this but for some bizarre reason it can’t find the method that accepts (int, int, float[], int).
It may be my compiler but i’ve had no luck.

You’re probably looking at the current javadoc but using an older jogl.jar. I would recommend deleting all copies of jogl.jar and libjogl.so/jogl.dll/libjogl.jnilib from your machine and upgrade to the current nightly build.

this could well be true. However, i’ve just been through all my files updating them to use the new jogl.rar, binaries etc and the programs now refuse to find any JOGL elements. A problem for another day!

Thanks for the help though, i suspect that if i can get the newest version running the problem will be sorted.
My incompetence knows no bounds :slight_smile:

Check the JOGL User’s Guide for some instructions on how to get JOGL set up for development.

I’ve followed the guide but for some reason, as soon as i copy over the new JOGL.jar, all programs cease to acknowledge JOGL.
When i run :

System.loadLibrary("jogl");

The program runs fine, but any implementation of JOGL methods refuse to be found.

The new version of jogl.jar is incompatible with the 1.1.1 release. Sorry but your programs need to be updated for the new APIs. The good news is that the new JOGL implementation is more robust than before and that the APIs should not change in a backward-incompatible way again.

If you have old programs which you can’t recompile for one reason or another you can download the 1.1.1 release and set your CLASSPATH/PATH appropriately before running the older programs.

aha, that’s grand. Thanks for all the help, on with the tree!