problem with var, vertex program and gl_short streams

Hi

In my terrain renderer I split vertex data into 2 streams:
first stream with height only (1 word - GL_SHORT)
second stream with x,z coordinates (2 words).
I combine these 2 streams into vertex position in a vertex program. The gain is that I can reuse second stream in all terrain blocks (terrain is divided into 32x32 blocks).
Everything works fine unless I use vertex array range extension. The height stream (the one with one word) works like it gets only the first word in the stream, so all vertices in the block get height of the first vertex. The stream stride is 2 but according to var specs there’s no stride or pointer alignment restriction on GeForce3 with recent drivers (I’ve got both).
Has anyone had similar problems or know any solution? Maybe I’m doing something wrong with stream setup, but the strange thing is that everything works fine without var.

Thanks in advance

coop

Doesn’t work, or it’s slow?

  • Matt

It doesn’t work. It gets only the first value from the stream. It seems that strides less than 4 doesn’t work with VAR.
To be precise:
glVertexAttribPointerNV(1, 1, GL_SHORT, 0, height_stream);
or
glVertexAttribPointerNV(1, 1, GL_SHORT, 2, height_stream);
doesn’t work. But when I insert a dummy short betweeen every element in the stream and use
glVertexAttribPointerNV(1, 1, GL_SHORT, 4, height_stream);
everything works fine.
height_stream is placed in memory allocated by wglAllocateMemoryNV of course (tested with AGP and video memory)
I don’t think I do something wrong here. And everything works ok when I don’t use VAR.

Hope it clears the situation

Coop

Seeing all these answers I guess nobody had similar problem…
I’ll check my code again (for the 1000th time) but I’ll probably find nothing wrong there again…

Can you send a test app to me?

  • Matt

Sure. I’ll try to prepare the simplest test app showing the problem