NV_vertex_program and aliased attributes.

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).]

Try enabling the client state, before setting the pointers.

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

Nutty

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?

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?

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

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

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.

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).]

The next demo down on the page, uses Vertex Attribute Arrays.

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?

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 Then pray and hope that a new driver releases fixes it.

Originally posted by Asgard:
Seems to be a driver bug, if you ask me.

That’s what I’m thinking too.

Does my Vertex Attribute Array demo run on your current set up?

If it does, then its not a driver bug.

Nutty

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.

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

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