PDA

View Full Version : OpenGL 3.0 has glColor glNormal commands?



Bosi Michele
11-26-2007, 05:36 PM
Does anyone know if OpenGL 3.0 will support glColor and glNormal commands? I find them very useful to set with a single commad the color / normal for a whole bunch of polygons before using my vertex arrays/VBOs.

Besides, with OpenGL I always missed a simple way to specify the color and normals "for-primitive" instead the usual "for-vertex" which forces the user to either use glBegin/End or to triplicate the number of vertices and to use more color/normal attribute than necessary (just imagine the unnecessary extra work needed to draw a cube with a unique flat color on each face using indexed triangles). Has this problem been addressed with OpenGL 3.0?

It would be nice to have something like:
glColorPointer(size, type, stride, pointer, GL_BIND_PER_PRIMITIVE);
glNormalPointer(type, stride, pointer, GL_BIND_PER_PRIMITIVE);

... etc ...

You could even use GL_PER_PRIMITIVE in some arrays and GL_PER_VERTEX in others. Obviously you could even have a GL_PER_OBJECT that specifies a single normal/color for the whole vertex array.

Basically GL_PER_VERTEX is what OpenGL does now.

Regards,
Michele

Jan
11-26-2007, 05:43 PM
Immediate mode will be gone, so there will be neither glColor nor glNormal. Although many people have asked for per-primitive data, instead of per-vertex (including me), there will be no such thing (seems the hardware isn't capable of doing such a thing and/or the vendors don't think it's worth the trouble to add it).

Jan.

Bosi Michele
11-26-2007, 06:07 PM
That's too bad... I knew that immediate mode was gone but since glColor and glNormal can be called from outside glBegin/glEnd to set the "current color" or "current normal" I was hoping to find them again in OGL 3.0, that's really really bad new to me :(

Mic.

Korval
11-26-2007, 06:17 PM
Although many people have asked for per-primitive data

Per-primitive data lives in the shader. A single color for the primitive makes the most semantic sense if it's in the program environment. A normal makes a bit less sense there, but it can still be reasoned that way.

Xmas
11-27-2007, 04:01 AM
You will still be able to set default attribute values in GL3.

For per-primitive processing you need the geometry shader that will come with Mount Evans.

JoeDoe
11-27-2007, 11:36 AM
I advocate the idea of immediate mode for simple drawing of full-screen quads, triangles or some kind of geometry like schematic drawing of my cameras, b-boxes, scissor rectangles and other stuff of 3D-scene. Instead in GL 3.0 we stick to VBO, which is ugly mechanism for this purposes.

Per primitive data really should be gone, because in any case driver must "copy" this data for every vertex that will be drawn.

Xmas
11-27-2007, 12:00 PM
Instead in GL 3.0 we stick to VBO, which is ugly mechanism for this purposes.
I fail to see where VBOs are uglier than immediate mode.

Korval
11-27-2007, 12:16 PM
You will still be able to set default attribute values in GL3.

Glslang will still have those attributes pre-defined if you wish to use them, but there won't be any API that is made specifically for them. If you want to use those attributes, you have to treat them like any other shader attribute, at least as far as the C API is concerned.

Xmas
11-27-2007, 12:36 PM
Maybe my word order wasn't correct: I meant attribute default values, not built-in attributes.

Korval
11-27-2007, 02:33 PM
I meant attribute default values, not built-in attributes.

In that case... maybe.

It's possible that the VAO, in lieu of an actual VBO binding for a vertex attribute, can take a constant value. But I don't recall that this was verified to be the case by any ARB publication.