PDA

View Full Version : If I draw without enable GL_VERTEX_ARRAY in 2.1



Thaina
04-14-2011, 09:52 PM
What will happen?

I have read man page of OpenGL 2 and it have mention about EnableClientState(GL_VERTEX_ARRAY) for draw things

I don't fully understand that short explanation, I want to know what it will really be

And also

If I understand it right, It means we cannot do anything if we don't EnableClientState(GL_VERTEX_ARRAY) and use glVertex* ,which is deprecated in 3.0 right?

How can I just use only glVertexAttrib* ,which is promoted tobe main method of future version and ES

Thanks for all reply

Alfonse Reinheart
04-14-2011, 10:14 PM
We have a wiki (http://www.opengl.org/wiki/Vertex_Specification) for this sort of thing.

Thaina
04-14-2011, 10:35 PM
Is that related?

At least I ask about 2.1 not 3.0 but yours is 3.0

Alfonse Reinheart
04-14-2011, 11:00 PM
At least I ask about 2.1 not 3.0 but yours is 3.0

Your post:


which is deprecated in 3.0 right?

The only reason you would care about what is deprecated in 3.0 and removed in 3.1 is if you are actually using core 3.1 and above. Otherwise, just use what you've got and don't worry about it; compatibility (http://www.opengl.org/wiki/Core_And_Compatibility_in_Contexts) will always be there.

Furthermore, there's nothing on that page which is limited to 3.0 or above. VAOs are from the ARB_vertex_array_object extension which is supported on plenty of 2.1 hardware (and you don't even need VAOs specifically, since without VAO's, everything's just context state). The same goes for many of the features related to drawing.

Thaina
04-15-2011, 12:31 AM
You misunderstand

What I care about is to try to use 2.1 in the nearest way as 3 and ES 2.0

In the 2.1 doc it seem like openGL force every draw to enable GL_VERTEX_ARRAY and use glVertex* functions, which is removed from ES 2.0 and above 3

So I try to find any way to avoid it

I don't care anything between 3.0 and 3.1
You are so wrong from the first place, please be careful

Also, I will not use extension, even ARB is not my taste, I will use only core function from 2.1
I just try to make my style compatible with 2.0 ES as much as possible

BionicBytes
04-15-2011, 04:38 AM
Use the generic vertex attribute pointers with shaders. That's the closest thing to OpenGL 3.x and ES.
See here for more infomation (http://www.opengl.org/sdk/docs/man/xhtml/glVertexAttribPointer.xml)

Alfonse Reinheart
04-15-2011, 05:05 AM
In the 2.1 doc it seem like openGL force every draw to enable GL_VERTEX_ARRAY and use glVertex* functions, which is removed from ES 2.0 and above 3

Then the man pages are wrong (it won't be the first time, and I'm submitting a bug on it). I checked the OpenGL 2.1 specification, and it says that vertices are specified by glVertex or glVertexAttrib with an index of 0.


You are so wrong from the first place, please be careful

The only thing not mentioned on that page that is important to your needs is the need for attribute 0 (which is something that core 3.0 cast off. Not to mention OpenGL ES 2.0). And it's mentioned there now.

_arts_
04-15-2011, 06:28 AM
How can I just use only glVertexAttrib* ,which is promoted tobe main method of future version and ES

You can use VertexAttrib if your OpenGL version is below 3.x, as long as you have vertex/fragment shader extensions (I don't know for vertex/fragment program extensions).
As far as I can remember, ARB_vertex_shader extension specs says that.

See http://www.opengl.org/registry/specs/ARB/vertex_shader.txt and http://www.opengl.org/wiki/GlVertexAttribPointer for more details.

V-man
04-15-2011, 09:23 AM
How can I just use only glVertexAttrib* ,which is promoted tobe main method of future version and ES

You can use VertexAttrib if your OpenGL version is below 3.x, as long as you have vertex/fragment shader extensions (I don't know for vertex/fragment program extensions).
As far as I can remember, ARB_vertex_shader extension specs says that.

See http://www.opengl.org/registry/specs/ARB/vertex_shader.txt and http://www.opengl.org/wiki/GlVertexAttribPointer for more details.

That's not what glspec20.pdf says.

Thaina
04-15-2011, 12:28 PM
Thanks for every reply

I'm so appreciate, I'll go to try experiment right now

Thank you, everyone

_arts_
04-18-2011, 05:38 AM
That's not what glspec20.pdf says.

Really ? mmmm my mistake then. So what's the correct behavior ? Where to know about it ?

Alfonse Reinheart
04-18-2011, 06:45 AM
So what's the correct behavior ?

*ahem*:


it says that vertices are specified by glVertex or glVertexAttrib with an index of 0.

You must use either GL_VERTEX_ARRAY or attribute 0.