PDA

View Full Version : Displacement map pseudo



ToolTech
07-10-2003, 02:00 AM
I have written a vertex program that generates the vertex position out of an index that I send with the vertex attributes. I want to disable the normal vertex fetch but when I glDisableClientState(GL_VERTEX_ARRAY) the vertex program is not executed. If I enable it, it executes ok but I dont use the vertex.position.

Any clue if this is a bug or if my idea fails ?

Jan
07-10-2003, 02:09 AM
This is no bug. A vertex-array gets enable/disabled with GL_VERTEX_ARRAY. At least one thought so, when vertex-arrays were put into gl.
Of course today it is possible to generate the vertex-position with a vertex-program, but this doesnīt change the behaviour of vertex arrays.
You said you have to pass some data to the vertex-program. Why donīt you just pass it through the vertex-position. This way you can save some memory, since the vertex-position has to be used anyway.

Jan.

ToolTech
07-10-2003, 02:14 AM
An if I specify that ...

glVertexPointer(1,GL_FLOAT,0,addr);

instead of

glVertexPointer(3,GL_FLOAT,0,addr);

i get a crasch i NVOLG

vincoof
07-10-2003, 02:18 AM
If the vertex array is disabled it is normal that vertex processing is not provoked since no glVertex command is called.

ToolTech
07-10-2003, 02:26 AM
THANX !!! DBUGGER !!!

He found that you can provoke the ARB vertex program by using vertex attribute list 0 !!!

Great. Great !!!! Great !!!

vincoof
07-10-2003, 02:27 AM
It's definately a bug if it crashes, but it is forbidden since glVertexPointer must be called where size is one of [2,3,4] (OpenGL1.4 Specifications, p25).

vincoof
07-10-2003, 02:35 AM
Which card/driver combo are you using ?
It should NOT work. It is required that the GL_INVALID_VALUE error is generated if size is different than 2, 3 or 4. If you test this on other graphics cards this may give undefined results.

ToolTech
07-10-2003, 04:48 AM
vincoof. You are right. I get into trouble when I use larger arrays of data when size is = 1 in the vertex attribute array[0]. I don't get any errors but the driver crashes...

I wonder why they have put this constraint on the vertex array list 0 ??

/Anders

Jan
07-10-2003, 04:59 AM
vertex-attrib[0] is only another name for vertex-position. And that a position needs at least 2 coordinates should be understandable, no?

ToolTech
07-10-2003, 05:18 AM
Still problems. Why can't i draw a vertex array with a size of 262144 vertex size ? Is there a max size for a vertex array ?

tfpsly
07-10-2003, 05:32 AM
Originally posted by ToolTech:
Still problems. Why can't i draw a vertex array with a size of 262144 vertex size ? Is there a max size for a vertex array ?

Many cards won't accept more than 65536 vertices in a single array

MZ
07-10-2003, 05:55 AM
Sorry for OT:

This is just another one of those few little, but annoying GL 1.0 features (along with texture targets) that IMHO should be cured in GL 2.

When using glDrawArrays/Elements, the "provoking" paradigm is not really useful for anything (except for causing problems, like the one which ToolTech just have had)

For immediate mode calls, the glVertex() command could be split in two:
- glPosition3f(...) /* which does not "provoke" anything */
- glNowSubmitMyVertexPlease(void) /* which is obvious */
and then all vertex attributes would be equal...

vincoof
07-10-2003, 10:05 AM
In fact after reading the specs again and again, it should be allowed to send in a vertex attribute 0 with size = 1, BUT your vertex program has to load the attribute vertex.attrib[0] and NOT the attribute vertex.position and that should do the trick.

ToolTech
07-10-2003, 10:24 AM
I do that but now i get a crash because too many vertices. I guess I need to divide them in smaller chunks. the code works on MacOSX with ATI hw but not on NVidia HW

vincoof
07-10-2003, 11:28 AM
Do you allocate memory for your vertex attribute 0 array ?

Have you queried glGet with GL_MAX_ELEMENT_VERTICES and GL_MAX_ELEMENT_INDICES ?

Are you sure that all your indices lie in the [start,end] range ?

Is your glDrawRangeElements call compiled into a display list, and/or referenced into a vertex buffer object ?

[This message has been edited by vincoof (edited 07-10-2003).]

ToolTech
07-10-2003, 11:28 AM
I have read the spec for gllDrawRangeElemnt and it clearly states that the driver should allow large sets of data even if it exceeds the reccomended sizes. i think it is a clear NVidia driver bug in that case...

Anyone fron Nvidia here so you can have a look ? Where is Matt nowadays ??

ToolTech
07-10-2003, 08:46 PM
Even if I disable the vertex attribute array 0 i get the crash. It seemes as when I render a lot of indices greater than the GL_MAX_ELEMENT_VERTICES and more indices than GL_MAX_ELEMENT_INDICES i get the crash. The spec clearly states that it shall be possible to draw the buffer but with a possible degraded performance...

vincoof
07-10-2003, 10:52 PM
It is highly recommended not to send too many vertices since it can reduce dramatically your performance.

Anyway, I agree that it should not crash. It should never crash, whatever the parameters you setup (except sending a pointer to an invalid memory address space).