PDA

View Full Version : NV_vertex_program and aliased attributes.



bakery2k
11-14-2002, 11:22 PM
Is this:





glVertexAttribPointerNV(9, 3, GL_FLOAT, sizeof(TORUS_VERTEX), &torus.vertices[0].sTangent);
glEnableClientState(GL_VERTEX_ATTRIB_ARRAY9_NV);

equivalent to this:



glClientActiveTextureARB(GL_TEXTURE1_ARB);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glTexCoordPointer(3, GL_FLOAT, sizeof(TORUS_VERTEX), &torus.vertices[0].sTangent);


If so, does anyone have any idea why the first crashes my system or draws wildly incorrect geometry, yet the second works fine?

I am using a GF3 Ti200 and the 40.72 drivers.

Thanks


[This message has been edited by bakery2k (edited 11-15-2002).]

Nutty
11-15-2002, 04:05 AM
Try enabling the client state, before setting the pointers.

Thats all I can see that is different, or possibly wrong.

Nutty

bakery2k
11-16-2002, 04:54 AM
Thanks Nutty, but that made no difference. I have tried it on a simpler program. simply replacing this:




glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3, GL_FLOAT, sizeof(TORUS_VERTEX), &torus.vertices[0].position);


with:




glEnableClientState(GL_VERTEX_ATTRIB_ARRAY0_NV);
glVertexAttribPointerNV(0, 3, GL_FLOAT, sizeof(TORUS_VERTEX), &torus.vertices[0].position);


means that nothing is drawn. Do I need to change anything else?

Asgard
11-16-2002, 05:50 AM
It should work the way you're doing it. Maybe you can post some more of your vertex program setup code. Just a guess, but are you sure vertex program mode is enabled?

bakery2k
11-16-2002, 03:21 PM
Yep, vertex program mode is definitely enabled. I have used NV_vertex_program in many of my projects on my website and it has always worked well. However, when I use the aliased attributes, they all seem to go wrong.
If someone wants to look at my code, try downloading the cel-shading project (482 kb) from my site:
http://users.ox.ac.uk/~univ1234/celshading.htm

Thanks

Nutty
11-16-2002, 04:05 PM
I have an Vertex Attribute stream demo on my site, you might wanna take a look, and do some comparisons to your own code.

here; http://opengl.nutty.org/nvidia/index.html

Look for the vp_streams.zip I know I should put titles in there.. I'll do that one day.

Nutty

Asgard
11-17-2002, 01:35 AM
bakery2k,

You're calling glEnable(GL_VERTEX_PROGRAM_NV) and glBindProgram for every frame which is unnecessary. Move the glEnable(GL_VERTEX_PROGRAM_NV) up to your GLinit function and don't call glBindProgram every frame and everything runs like a charm, even with glVertexAttribPointerNV.
It shouldn't crash in NVOGLNT.dll though, even when you're calling glEnable every frame.

bakery2k
11-17-2002, 02:46 AM
Nutty:
Thanks for your help. I noticed that you are using the VertexAttrib "Immediate mode" functions in your demo rather than vertex attribute arrays. I changed my code to use this method and it works.

Asgard:
Also, thank you. The reason I am calling Enable(VERTEX_PROGRAM_NV) every frame is because I do not want the vertex program enabled when drawing the outline pass, or the text on screen. Of course, you are right that the BindPrograms are redundant.
Using vertex attribute arrays crashes my system when I do not use LockArraysEXT. Using LockArraysEXT, it just draws incorrectly.
The program worked if I put Enable(VERTEX_PROGRAM_NV) in the init function, but as I expected, the text comes out incorrectly.
So, I tried to find out what the difference is if I also call it in the Init function. It turns out that the program runs fine if I sandwich glClear, i.e.




glEnable(GL_VERTEX_PROGRAM_NV);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glDisable(GL_VERTEX_PROGRAM_NV);


It also seems that only the very first clear needs vertex program enabled in order for the program to work correctly. Any ideas why this may be?

Thanks for your help

[This message has been edited by bakery2k (edited 11-17-2002).]

Nutty
11-17-2002, 02:52 AM
The next demo down on the page, uses Vertex Attribute Arrays.

bakery2k
11-17-2002, 03:18 AM
Oh yes, I see.
I changed your demo so it looks more like mine, i.e. Initialising the vertex pointers and arrays once at the beginning rather than per frame, and it crashes in the first call to DrawElements. I wonder if this is related?

Asgard
11-17-2002, 03:23 AM
Seems to be a driver bug, if you ask me. I don't see anything wrong with your code. You'll have to find a combination where it doesn't crash and stick to that http://www.opengl.org/discussion_boards/ubb/wink.gif Then pray and hope that a new driver releases fixes it.

bakery2k
11-17-2002, 03:32 AM
Originally posted by Asgard:
Seems to be a driver bug, if you ask me.


That's what I'm thinking too.

Nutty
11-17-2002, 04:18 AM
Does my Vertex Attribute Array demo run on your current set up?

If it does, then its not a driver bug.

Nutty

bakery2k
11-17-2002, 04:54 AM
Your demo does work on my setup.
However, as I stated above, you enable and disable the vertex arrays per frame. If I change my code to do this, it works fine.
In my code I set up the arrays only once, and enable vertex program per frame. Only by making sure vertes program mode is enabled during glClear does it work. If I change your demo so it sets up the arrays at the beginning, it also crashes.

Nutty
11-17-2002, 06:08 AM
I dont think you can set the Vertex Attribute Arrays, and toggle Vertex Program mode, and expect it to work.

When you disable Vertex Program mode, the Vertex Attribute Array information is probably cleared. Not too sure tho, best ask Matt on this one.

Nutty

crashmaster
11-26-2003, 09:26 PM
UH sorry to interupt but ...lol

I have this nvoglnt.lrc, version 6.13.10.3140, hang address 0x000d179b.

crash report with my multigaming ...

any clue if related to what is being discussed here ?? rsvp ?? crash_mtl@comcast.net