PDA

View Full Version : tiny stupid NV_vertex_program doesn't work :(



JanHH
05-23-2004, 12:54 PM
Hello,

sorry for this probably stupid question, I must be missing something very obvius, but have no idea what. I am trying to use NV_vertex_program instead of ARB_vertex_program and so tried changing the program itself, starting with very basic parts. The arb version work, the NV doesn't. This is the code:

ARB:

!!ARBvp1.0

PARAM MVP[4] = { state.matrix.mvp }; # Modelview Projection Matrix.

DP4 result.position.x, MVP[0], vertex.position;
DP4 result.position.y, MVP[1], vertex.position;
DP4 result.position.z, MVP[2], vertex.position;
DP4 result.position.w, MVP[3], vertex.position;

END

NV:

...
glTrackMatrixNV(GL_VERTEX_PROGRAM_NV, 0, GL_MODELVIEW_PROJECTION_NV, GL_IDENTITY_NV);
...
!!VP1.0

DP4 o[HPOS].x, c[0], v[0];
DP4 o[HPOS].y, c[1], v[0];
DP4 o[HPOS].z, c[2], v[0];
DP4 o[HPOS].w, c[3], v[0];

END

Does anyone have an idea what is going wrong here? Thanks in advance..

Jan

jwatte
05-23-2004, 01:09 PM
Do you want the transpose version of the tracked matrix?

JanHH
05-23-2004, 01:33 PM
Do I need to? I have to admit that I do not know very much about that matrix stuff, probably weaknesses in maths ;) . I should do a linear algebra crash course. I want the NV program to do the same as the ARB one. If I need the transpose matrix for that, then, probably, the answer is "yes". But this glTrackMatrix-command is so common in examples that I thought it would be the right one, and also it sounds obvious as in the ARB program, it is state.matrix.mvp. Thanks..

Eric Lengyel
05-23-2004, 09:15 PM
The way you've tracked the mvp matrix is correct -- you don't need to transpose it. The only thing I can think of is to try replacing v[0] with v[OPOS] (with two letter O's).

-- Eric Lengyel

JanHH
05-24-2004, 12:49 PM
I tried that but doesn't change anything, still nothing is visible. strange indeed..

plasmonster
05-24-2004, 01:24 PM
Have you tried different addresses for the matrix besides 0?

JanHH
05-24-2004, 02:07 PM
I just did after reading your post.. but it doesn't change anything. Does it matter when gltTrackMatrix is called? I tried after enabling NV_vertex_program and after bindig a program, but that does not change anything either..

plasmonster
05-24-2004, 05:51 PM
Yeah, that was a long shot (bug hunt). I was just looking over the spec again, and I didn't see anything relevant to your problem. The way they set it up is very forgiving. All I can tell you is I used to call TrackMatrixNV() once after loading all my programs, and that's it.

JanHH
05-25-2004, 06:25 AM
I think I'll stick with ARB_vertex_program. NV_vertex_program is running fine, I guess the performance gain when changing to NV_vertex_program is neglectable (or at least, I hope so ;) ).

Jan

JanHH
05-25-2004, 02:50 PM
I solved it, it was my fault.. the fragment program uses tex coords that were not assigend by the vertex program, both the ARB and the NV version, and somehow the ARB version seems to behave different with such a thing, so by coincidence, with the ARB program, there was something visible, and with the NV version not.

But to use NV_vertex_program instead of ARB does not give any advantage in performance, so I might as well go on with ARB ;) .

Jan