I'm using opengl 3.3, glm, glfw
I've continued my adventures with OpenGL and am looking to draw multiple objects each independent of each other. For example I have a class drawObject and during each update or render I will call all the drawObjects relevant function. I am hoping to have a vector of these objects and each render to do the pre render stuff necessary and then iterate through the vector and call the render function for each object. The conceptual problem I'm faced with is: Do I store each object with a model matrix that I change for each object based on its movement (seems somewhat costly) and then multiply this by a global ProjectionView matrix or is there someway to store a transformation for each object like in GCC4. Moreover would I then pass PV matrix to the vertex shader globally and then send in the model matrix per object and calculate them in the shader, would I send in the model matrix via glUniformMatrix4fv or as something else?
I am also trying to use indices as well, although I'm not entirely sure how these work with multiple objects to be drawn, I'm guessing I use them for each object and use glDrawElements for each object as well.
I'm probably going to give this method a try, although it seems like I am missing something I just don't know what.
Sorry if I've explained it poorly, just writing this out has given me a couple of ideas about how to proceed, I'll try post some source later and the results of my experiment.
I've continued my adventures with OpenGL and am looking to draw multiple objects each independent of each other. For example I have a class drawObject and during each update or render I will call all the drawObjects relevant function. I am hoping to have a vector of these objects and each render to do the pre render stuff necessary and then iterate through the vector and call the render function for each object. The conceptual problem I'm faced with is: Do I store each object with a model matrix that I change for each object based on its movement (seems somewhat costly) and then multiply this by a global ProjectionView matrix or is there someway to store a transformation for each object like in GCC4. Moreover would I then pass PV matrix to the vertex shader globally and then send in the model matrix per object and calculate them in the shader, would I send in the model matrix via glUniformMatrix4fv or as something else?
I am also trying to use indices as well, although I'm not entirely sure how these work with multiple objects to be drawn, I'm guessing I use them for each object and use glDrawElements for each object as well.
I'm probably going to give this method a try, although it seems like I am missing something I just don't know what.
Sorry if I've explained it poorly, just writing this out has given me a couple of ideas about how to proceed, I'll try post some source later and the results of my experiment.