Vert Arrays + Cg shader = crash, seperately work fine

I have had this weird bug with Cg fragment shader and vertex arrays ( blue screen bug ) for a while now.

I have managed to reduce it to this:
-The shader works fine when I render stuff in immediate mode.
-The Vertex arrays render fine when not using shader.
-I get bluescreen on my laptop, crashes on other peoples pcs when I try to use them in combination.

I have made a sample test case that demonstrates this , you can d/l it from here ( test )

Can anyone suggest what I might be doing wrong?


Commonly, it happens when you enable some vertex attrib arrays and forget to set their pointers, or they violate buffer’s data storage.
Immediate mode doesn’t fall, because it gets attribute value as it were set very last (or zero if no calls were made).
Check, whether all your pointers setup is correct.

I have tested the indexes when loading from my maya exported files and they had no errors and still I got the same bug. Also, I have been using this 3DS loader for some years now and I am 99.9% sure that there is no problem with the data. Tested with various models also.

The weird thing is that it renders a few frames, then hangs.

here is my Vertex arrays rendering code

void	CMesh::RenderPerPixel()
//	if (m_ShadowPass==1)	{ RenderDepthPass(); return; }


	glDisableClientState(GL_TEXTURE_COORD_ARRAY); // added this now, makes no difference

	glVertexPointer(3,  GL_FLOAT, 0, m_pVert);
	glNormalPointer(	GL_FLOAT, 0, m_pNorm);

//	glLockArraysEXT(0, m_numVerts);

	glDrawElements(GL_TRIANGLES, m_numIdxs, GL_UNSIGNED_INT, m_pIdx);
//	glUnlockArraysEXT();



Excuse me, but for what actually do you need INDEX_ARRAY?
When you enable it - it means that you want to use some single-valued color index.
INDEX_ARRAY is not indices array specification )))

Yep GL_INDEX_ARRAY was the problem It wasted more than a few days of my time.
It’s been there for years and didn’t cause any problems until shaders where added.

Well done Jackis

what did you think it meant???

I knew it was for color indexes, I read about it so many times here and other places…
It just sliped my attention…
too much copy paste programming
… four eyes are always better than two :slight_smile:

you’re not much of a “comment-out-build-comment-out-build” debugger then?

knackered ofcourse I comment out stuff. . but usually commenting out stuff creates more bugs, in fact it creates bugs even if you correct the original problem, and you dont even notice what the problem was, you just create new bugs.
how about you? you are not much of a team player then?