Java-Gaming.org    
Featured games (91)
games approved by the League of Dukes
Games in Showcase (579)
games submitted by our members
Games in WIP (500)
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 3200 times)
0 Members and 1 Guest are viewing this topic.
Offline abies

Senior Member





« Posted 2003-06-21 07: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 21: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:

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
Offline abies

Senior Member





« Reply #2 - Posted 2003-06-21 21: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 21: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 GLEmitter.java in the function needsProcAddressWrapper(FunctionSymbol) that calculates the appropriate typedef name given the symbol corresponding to a gl extension function.

-chris
Offline abies

Senior Member





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

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

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

xsi3rr4x (38 views)
2014-04-15 18:08:23

BurntPizza (34 views)
2014-04-15 03:46:01

UprightPath (50 views)
2014-04-14 17:39:50

UprightPath (32 views)
2014-04-14 17:35:47

Porlus (49 views)
2014-04-14 15:48:38

tom_mai78101 (71 views)
2014-04-10 04:04:31

BurntPizza (130 views)
2014-04-08 23:06:04

tom_mai78101 (230 views)
2014-04-05 13:34:39

trollwarrior1 (193 views)
2014-04-04 12:06:45

CJLetsGame (200 views)
2014-04-01 02:16:10
List of Learning Resources
by SHC
2014-04-18 03:17:39

List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30
java-gaming.org 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‑gaming.org
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!