Hi !
Featured games (84)
games approved by the League of Dukes
Games in Showcase (602)
Games in Android Showcase (171)
games submitted by our members
Games in WIP (650)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Paramater names for glext functions  (Read 3568 times)
0 Members and 1 Guest are viewing this topic.
Offline abies

Senior Devvie

« Posted 2003-06-21 05:55:13 »

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).

Artur Biesiadowski
Offline ckline

Senior Newbie

« Reply #1 - Posted 2003-06-21 19:18:18 »

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:

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.

Offline abies

Senior Devvie

« Reply #2 - Posted 2003-06-21 19:30:13 »

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.

Artur Biesiadowski
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline ckline

Senior Newbie

« Reply #3 - Posted 2003-06-21 19:32:32 »

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 in the function needsProcAddressWrapper(FunctionSymbol) that calculates the appropriate typedef name given the symbol corresponding to a gl extension function.

Offline abies

Senior Devvie

« Reply #4 - Posted 2003-06-21 20:05:57 »

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

I knew about typedef table, I was missing following trick

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 Smiley

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.

Artur Biesiadowski
Pages: [1]
  ignore  |  Print  
You cannot reply to this message, because it is very, very old.

Jesse (16 views)
2015-07-29 04:35:27

Riven (37 views)
2015-07-27 16:38:00

Riven (18 views)
2015-07-27 15:35:20

Riven (21 views)
2015-07-27 12:26:13

Riven (12 views)
2015-07-27 12:23:39

BurntPizza (30 views)
2015-07-25 00:14:37

BurntPizza (42 views)
2015-07-24 22:06:39

BurntPizza (24 views)
2015-07-24 06:06:53

NoxInc (31 views)
2015-07-22 22:16:53

NoxInc (18 views)
2015-07-22 22:13:39
List of Learning Resources
by gouessej
2015-07-09 11:29:36

How Do I Expand My Game?
by bashfrog
2015-06-14 11:34:43

List of Learning Resources
by PocketCrafter7
2015-05-31 05:37:30

Intersection Methods
by Roquen
2015-05-29 08:19:33

List of Learning Resources
by SilverTiger
2015-05-05 10:20:32

How to: JGO Wiki
by Mac70
2015-02-17 20:56:16

2D Dynamic Lighting
by ThePixelPony
2015-01-01 20:25:42

How do I start Java Game Development?
by gouessej
2014-12-27 19:41:21 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!