shaddam_IV : RTFM übern00b ! (sorry ;D I couldn’t resist)
Quoted from OpenGL 1.5 specs (GL command syntax, page 7) :
“The declarations shown in this document apply to ANSI C. Languages such as C++ and Ada that allow passing of argument type information admit simpler declarations and fewer entry points.”
I don’t know how you read it, but it seems that GL API is not carved in stone. Depending on the language capabilities you can produce a simplified binding which ease developers work without breaking the specs. IMO the bloated aspect of the C version is mostly due to language shortcomings.
Now there are pros and cons, and an oversimplified API would achieve the opposite of the desired effect. When googling around for Java/OpenGL bindings I found YAJOGLB (http://home.earthlink.net/~rzeh/YAJOGLB/doc/YAJOGLB.html), which use gl.vertex syntax. Here is an excerpt from the PlainCube demo :
public void paint(GeometryViewer viewer, GL gl, GLU glu) {
gl.pushMatrix();
gl.rotate(30.0f, 1.0f, 1.0f, 1.0f);
gl.material(FRONT_AND_BACK, AMBIENT_AND_DIFFUSE, material);
gl.begin(QUADS);
gl.normal( 0.0F, 0.0F, 1.0F);
gl.vertex( 0.5F, 0.5F, 0.5F); gl.vertex(-0.5F, 0.5F, 0.5F);
gl.vertex(-0.5F,-0.5F, 0.5F); gl.vertex( 0.5F,-0.5F, 0.5F);
gl.normal( 0.0F, 0.0F,-1.0F);
gl.vertex(-0.5F,-0.5F,-0.5F); gl.vertex(-0.5F, 0.5F,-0.5F);
gl.vertex( 0.5F, 0.5F,-0.5F); gl.vertex( 0.5F,-0.5F,-0.5F);
gl.normal( 0.0F, 1.0F, 0.0F);
gl.vertex( 0.5F, 0.5F, 0.5F); gl.vertex( 0.5F, 0.5F,-0.5F);
gl.vertex(-0.5F, 0.5F,-0.5F); gl.vertex(-0.5F, 0.5F, 0.5F);
gl.normal( 0.0F,-1.0F, 0.0F);
gl.vertex(-0.5F,-0.5F,-0.5F); gl.vertex( 0.5F,-0.5F,-0.5F);
gl.vertex( 0.5F,-0.5F, 0.5F); gl.vertex(-0.5F,-0.5F, 0.5F);
gl.normal( 1.0F, 0.0F, 0.0F);
gl.vertex( 0.5F, 0.5F, 0.5F); gl.vertex( 0.5F,-0.5F, 0.5F);
gl.vertex( 0.5F,-0.5F,-0.5F); gl.vertex( 0.5F, 0.5F,-0.5F);
gl.normal(-1.0F, 0.0F, 0.0F);
gl.vertex(-0.5F,-0.5F,-0.5F); gl.vertex(-0.5F,-0.5F, 0.5F);
gl.vertex(-0.5F, 0.5F, 0.5F); gl.vertex(-0.5F, 0.5F,-0.5F);
gl.end();
gl.popMatrix();
}
Is it that ugly ?
As far as I’m concerned, the main simplification I would like is redundant suffix removal (see my first post). The rest I don’t really care, but I think we should aim at the best readability / efficiency balance.