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