Well it does not seem to work for me (when I’m using gl_Vertex and “position” for ie. vertex color it works just fine). I heard that gl_Vertex is reserved in some way. Could You write sth about this special case to make things more clear for me? Thanks!!
Yes, glVertex is special in that way that it invokes the vertex pipeline with the current attribute state. (That is why glVertex is put last in immediate mode code.)
No write to glVertex, no vertex pipeline processing!
For generic attibutes the special case is attribute 0. You must have exactly one of the used attributes in the vertex shader bound to 0 or the vertex pipeline is not started.
You should use the gl_ModelViewProjection matrix in your shader.
Never write matrix * matrix * vector operations without brackets. Writing this: matrix * (matrix * vector) is 2.5 times faster.
Do the math and you’ll see the number of instructions.
thanks for the quick answer!as for the matrix multiplications - I need to process the vertex after transforming it to world space - that’s why I must use two multiplications. Cheers!
Off-topic:
Are you actually Polish?
If so, where did you learn the phrase “works like a charm”? Is there an equivalent phrase in Polish?
I find the quality of english from non-native english people on these forums amazing, especially when they use unusual phrases like this in the the correct context.
Makes me feel pretty ignorant, as I only speak the one language.
my observations are u will find ppl just pick up phrases from books/tv or other ppl talking and during their own talking interject them if they feel it ‘fits’
check out an image on www.gamedev.net i posted yesterday entitled ‘friemel’.
where that word comes from is from hearing my girlfriend saying often to me
‘hou es op met jouw gefriemel met je piemel’
a lot of speaking is done by rote
The location for attrib “gridXY” is #0; the location for attrib “gridZ” is #1; the locations are allocated automatically during program linkage [i.e., no call to glBindAttribLocationARB() but to glGetAttribLocationARB()]. No output is generated.
If I change my code to (note the usage of the dummy gl_Vertex-attrib):
“gridXY” gets location #1; “gridZ” gets location #2; “gl_Vertex” gets location #0! If I provide the vertex array data pointer for the gridXY-data to locations #0 and #1 the expected output is generated!
Whats wrong here?
I am using the latest official ATI driver (6.4?) on a X800…
Originally posted by Hampel:
[b] To bring this question up again: I want to use the following vertex shader:
[…]
“gridXY” gets location #1; “gridZ” gets location #2; “gl_Vertex” gets location #0! If I provide the vertex array data pointer for the gridXY-data to locations #0 and #1 the expected output is generated!
Whats wrong here?
I am using the latest official ATI driver (6.4?) on a X800… [/b]
Nothing is wrong here. Read the spec. Vertex attribute 0 and gl_Vertex cannot be aliased. When gl_Vertex is used, vertex attribute slots are allocated starting from 1.
Also, you should not rely on vertex attribute declaration order in the shader. Use vertex attrib location queeries (knackered!) to find out the actual attrib location. It will save you troubles like this.