Paramater names for glext functions

Is it possible to add parameter names from typedefs to glext functions ? Currently, most of params are arg0-argn, because in glext.h, we have

GLAPI void APIENTRY glSecondaryColor3bEXT (GLbyte, GLbyte, GLbyte);
typedef void (APIENTRY * PFNGLSECONDARYCOLOR3BEXTPROC) (GLbyte red, GLbyte green, GLbyte blue);

and parameters names are defined only in typedef. Typedefs are already coupled to functions in GLEmitter, but it seems that they do not contain info about parameter types/names ?? It is a bit too big program to go through all of it now, so I though it will be faster to ask.
Are the names for typedef function arguments available anywhere ? If yes, where ? With this info I should be able to replace empty arg names in GLEmitter (only for GL interface, rest is not really important).

GlueGen does its best to emit proper names for arguments. It will emit the correct name if the args are named in the function prototype. E.g., the Java/JNI equivalents for

GLAPI void APIENTRY glSecondaryColor3bEXT (GLbyte, GLbyte, GLbyte);

Will use the arg0…argN names, but the emitted equivalents for

GLAPI void APIENTRY glSecondaryColor3bEXT (GLbyte red, GLbyte green, GLbyte blue);

The easiest and most correct way to get properly named functions emitted is to add the correct names to the prototypes in gl.h/glext.h/glxext.h/etc. The reason I didn’t do this the first time around was (besides the obvious gruntwork involved) because I wanted to make it easy to update JOGL when a new glext.h header was released at the extension registry page:

http://oss.sgi.com/projects/ogl-sample/registry/index.html

Unfortunately, though those are the “official” OpenGL headers, they don’t have argument names in them. It would be nice if someone updated those headers with the correct names and had the ARB re-post them.

Otherwise you’re welcome to insert the correct argument names into JOGL’s stub versions of the GL headers, and donate them back to the JOGL source tree.

-chris

I understand that. But parameter names for ext functions ARE there - just inside typedef entries, not inside function declaration.
Please look at example I have put above - glSecondaryColor3bEXT indeed does not have parameter names, but PFNGLSECONDARYCOLOR3BEXTPROC typedef has them.
Now, you are referencing typedef from generator anyway - unfortunately, it seems that parameter info for typedef is lost. I wanted to know if it is indeed this way, or maybe this info is available somewhere - in such case, we can discover missing parameter names from typedefs.

Oh, also, to answer your question about the typedef names-- you should be able to get the names of the arguments out of the function typedef. In each JavaEmitter (of which GLEmitter is a subclass) there is a ‘typedefDictionary’ variable. This variable is of type TypeDictionary, which maps a type name (String) to a Type object that corresponds to that name. In the case of function pointer typedefs, like

typedef void (APIENTRY * PFNGLSECONDARYCOLOR3BEXTPROC) (GLbyte red, GLbyte green, GLbyte blue);

a call of typedefDictionary.get(“PFNGLSECONDARYCOLOR3BEXTPROC”) should return a FunctionType object, which is a subclass of Type. You can query this object with getArgumentName(int) to get the name of each argument in the function.

You could easily modify GLEmitter to, when emitting the name of a function argument, query the function pointer typedef for the arg name in the case where both 1) the function is a gl extension function (i.e., needsProcAddressWrapper() returns true) and 2) the argument in the raw function symbol is unnamed (i.e., arg0).

If it helps, theres some code in GLEmitter.java in the function needsProcAddressWrapper(FunctionSymbol) that calculates the appropriate typedef name given the symbol corresponding to a gl extension function.

-chris

Thanks, I have managed to solve this with your help.

http://jogl.dev.java.net/issues/show_bug.cgi?id=13

http://nwn-j3d.sourceforge.net/jogl/functiontype.diff

http://nwn-j3d.sourceforge.net/jogl/glemitter.diff

http://nwn-j3d.sourceforge.net/jogl/addr.diff

I knew about typedef table, I was missing following trick
type.asPointer().getTargetType().asFunction();

I was trying to get paramaters on pointer type, instead of target type - with your hint that Type has subclasses (should be obvious, but…) I have done this in no time.

It seems to work for all functions. I think it is a real benefit, no more arg0-argN arguments in context help :slight_smile:

Edit: Unfortunately there is a need to rename ‘addr’ in native dispatcher funs, as it is conflicting with parameters in some wgl funs - addr.diff does it.