VBO GL_DYNAMIC_DRAW and lighting problem

I’ve got a problem with dynamic vbo and lighting:

I’ve got one stationary light and 2 vbo’s. One vbo is static and transformed with matrix, this geometry is rotating nicely and shaded correctly.

The other vbo is dynamic and isn’t transformed with matrix but by updating vbo’s vertex pos and normals. While the geometry comes up fine on this dynamic vbo, it’s shading is “stuck”, as if the light was rotating with it.

Any ideas what might be causing this? I’ve tried stream mode too and switching order of vbo’s drawn but the results are same.

AFAIK, GL_DYNAMIC_DRAW has nothing with incorrect drawing. It is just a hint. You have a problem with vales stored in that VBO.

By the way, dynamically updating VBO instead of standard transformations is a very bad idea of doing things. :wink:

That’s what I thought and that’s how it is :slight_smile:

Thanks for replying, got me check my data more closely. I am getting the data from 3d animation application and there is quirk in SDK and vertex normals. For some reason func to get deform normals gave static data and func to get static data gave deformed. So my normals weren’t proper and it looked like the lighting was “stuck”.

What I learned: 1) check your data at least thrice 2) don’t trust SDK’s

Reason for using dynamic vbo is that in such animation package there are lot of deformers. So I think that is quite reasonable reason :wink:

Yes, that is very acceptable reason. :slight_smile:

By the way, you can freely set GL_STATIC_DRAW as a hint, and it will not change the performance.