Jump to content

  • Log In with Google      Sign In   
  • Create Account

#ActualEddieV223

Posted 19 March 2013 - 05:02 PM

You didn't specify if you are using c/c++ so I'll assume c++.

 

The easiest way to do this would be to pass around your VAO id.  For every object that uses that mesh just have a copy of that VAO id.  When you get ready to draw a missile for example you just bind the vao, send in your objects world matrix ( to the shader uniform ),  and draw.   This is called instancing.

 

Another way to handle it is more work but more robust, create a Manager Class that manages your Meshes.  You have a vector of pointers to mesh objects ( use unique_ptr ) in the mesh manager and you can get a pointer to a managed mesh object, from that Manager class, by file name. 

 

Managing Textures and Shaders can also be done in similar ways.


#6EddieV223

Posted 19 March 2013 - 05:02 PM

You didn't specify if you are using c/c++ so I'll assume c++.

 

The easiest way to do this would be to pass around your VAO id.  For every object that uses that mesh just have a copy of that VAO id.  When you get ready to draw a missile for example you just bind the vao, send in your objects world matrix ( to the shader uniform ),  and draw.   This is called instancing.

 

Another way to handle it is more work but more robust, create a Manager Class that manages your Meshes.  You have a vector of pointers to mesh objects ( use unique_ptr ) in the mesh manager and you can get a pointer to a managed mesh object, from that Manager class, by file name. 


#5EddieV223

Posted 19 March 2013 - 03:55 PM

You didn't specify if you are using c/c++ so I'll assume c++.

 

The easiest way to do this would be to pass around your VAO id.  For every object that uses that mesh just have a copy of that VAO id.  When you get ready to draw a missile for example you just bind the vao, send in your objects world matrix ( to the shader uniform ),  and draw.   This is called instancing.

 

Another way to handle it is more work but more robust, create a Manager Class that manages your Meshes.  You have a vector of pointers to mesh objects ( use unique_ptr ) in the mesh manager and you can get a pointer to a mesh from that class by file name. 


#4EddieV223

Posted 19 March 2013 - 03:53 PM

You didn't specify if you are using c/c++ so I'll assume c++.

 

The easiest way to do this would be to pass around your VAO id.  For every object that uses that mesh just have a copy of that VAO id.  When you get ready to draw a missile for example you just bind the vao, send in your objects world matrix ( to the shader uniform ),  and draw.   This is called instancing.

 

Another way to handle it is more work but more robust, create a Manager Class that manages your Meshes.  You have a vector of pointers to mesh objects ( use unique_ptr ) in the mesh manager and you can get a pointer to a mesh from that class by file name.


#3EddieV223

Posted 19 March 2013 - 03:49 PM

You didn't specify if you are using c/c++ so I'll assume c++.

 

The easiest way to do this would be to pass around your VAO id.  For every object that uses that mesh just have a copy of that VAO id.  When you get ready to draw a missile for example you just bind the vao, send in your objects world matrix,  and draw.   This is called instancing.

 

Another way to handle it is more work but more robust, create a Manager Class that manages your Meshes.  You have a vector of pointers to mesh objects ( use unique_ptr ) in the mesh manager and you can get a pointer to a mesh from that class by file name.


#2EddieV223

Posted 19 March 2013 - 03:47 PM

The easiest way to do this would be to pass around your VAO id.  For every object that uses that mesh just have a copy of that VAO id.  When you get ready to draw a missile for example you just bind the vao and draw.   This is called instancing.

 

Another way to handle it is more work but more robust, create a Manager Class that manages your Meshes.  You have a vector of pointers to mesh objects ( use unique_ptr ) in the mesh manager and you can get a pointer to a mesh from that class by file name.


PARTNERS