PDA

View Full Version : VBO GL_DYNAMIC_DRAW and lighting problem



peksi
02-15-2011, 10:11 AM
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.

Aleksandar
02-15-2011, 01:22 PM
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. ;)

peksi
02-17-2011, 08:53 AM
That's what I thought and that's how it is :)

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 ;)

Aleksandar
02-18-2011, 10:54 AM
Reason for using dynamic vbo is that in such animation package there are lot of deformers. So I think that is quite reasonable reason ;)

Yes, that is very acceptable reason. :)

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