Vulkan with Python Tutorial 16 Uniform Buffer Objects (deprecated)

preview_player
Показать описание


Рекомендации по теме
Комментарии
Автор

Thanks for another great video! Thanks for the trick about UBOs. I think I managed to learn UBOs for OpenGl...even used them in a python project I had...and I don't think it was being asked for the matrices to be presented as bytes. I might be remembering vaguely, or the whole "tobytes" is a Vulkan requirement.

Few comments on pyrr:
About the view matrix, as well as other stuff with pyrr, I had the similar problem with the dtype. Debugging hours until I found that by default python will use float64 for it's variables. I was dabbling in OpenGL at the time, but I would suppose it's the same in Vulkan...you could pass 64bit floats but I guess you have to set that up. I suppose the part where you set things like data type - R32G32B32A32 =vec4, one could do R64G64B64A64=dvec4, but that means that we have to use dvec4 in our shaders.

Also I understand you want to be extra explicit after that bad experience, but you don't need to set the dtype in the vector arrays, heck you don't need np.array for a vector like `position, target, up `. A simple python list is enough, the create_matrix function handles that. So even if you have 64f lists it will still make a 32f matrix if you provide the dtype in the matrix creation. I think(I might be wrong) numpy arrays take more memory because they have extended functionality than regular python lists. So if you want to have lower memory usage you can use just regular python lists with pyrr's matrix functions. And I think in pyrr's documentation it says that the "Vector" object is just slightly extended np.array. And they also say that unless you need the specific features of the "Vector" object...like multiplying vectors or stuff like that, they recommend using regular python lists even in matrix creation.

NikolaNevenov