Advertisement Jump to content
Sign in to follow this  
EarthBanana

Meshes and VBO/VAO

This topic is 1870 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Quick question - I think I know the probable answer but...

 

I have a class for representing VBOs and another for VAOs - right now in my "ResourceManager" each mesh has a collection of submeshes and each submesh has a VAO and VBOs (using my VBO/VAO classes - which wraps the opengl code) to represent vertex data... my question that I think I know the answer to but am trying to avoid the work of reimplementation is this.. should my "RenderManager" be controlling all of the VBO and VAO objects and not the submeshes that are part of the "ResourceManager"..?

 

As in - I should probably just have vectors containing the vertex data in the submeshes, and the render manager should be in charge of making the necessary VBO/VAO to issue draw commands (passing in the submesh data to the renderer and letting it fill the buffers) right?

 

If this is the case - anyone want to give a quick explanation of how the renderer should be filling the buffers with data? since the actual mesh data rarely changes I understand that it shouldnt be refilling the buffers every frame - what is an accepted way of doing this? Letting the renderer scan the resources anytime a new resource is added and refilling the necessary buffers then?

 

Thanks for any help I appreciate it!!

Edited by EarthBanana

Share this post


Link to post
Share on other sites
Advertisement

Also - one more thing I'm wondering about with the resource manager... right now - since I only have 6 types of resources (mesh, texture, material, audio, shader, and animation ) in the manager i just made a create, get, load etc functions for each type of resource rather than making a base resource class and making all of them inherit this base class.. you think it may be time I make that base class so that I only need one get, create, load etc function in the resource manager?

 

I did it the other way at first because i only started with meshes, shaders, and textures but now as I add more resource types its getting more complicated in the sense that there are a lot of loading and getting functions depending on the resource your trying to deal with..

 

Again thanks for any input

 

by the way - my load/create functions return a pointer to the loaded/created resource which is why they need their own functions rather than just an enum to decide which resource type to load

Edited by EarthBanana

Share this post


Link to post
Share on other sites

my question that I think I know the answer to but am trying to avoid the work of reimplementation is this.. should my "RenderManager" be controlling all of the VBO and VAO objects and not the submeshes that are part of the "ResourceManager"..?

As long as the rendering module has no idea what a mesh/model is that is one way to go, but not really necessary.
In both my and my office’s engine the models themselves hold their own vertex data, a feature exposed by the rendering module.

 

As in - I should probably just have vectors containing the vertex data in the submeshes, and the render manager should be in charge of making the necessary VBO/VAO to issue draw commands (passing in the submesh data to the renderer and letting it fill the buffers) right?

Absolutely not if it means the renderer knows what a submesh is.
 

If this is the case - anyone want to give a quick explanation of how the renderer should be filling the buffers with data? since the actual mesh data rarely changes I understand that it shouldnt be refilling the buffers every frame - what is an accepted way of doing this? Letting the renderer scan the resources anytime a new resource is added and refilling the necessary buffers then?

It’s enough to just let the models and their submeshes handle their own vertex buffers. In fact in many studios the model file itself already contains the vertex-buffer data in a format that is ready to be directly fed into a vertex buffer and off you go. For the sake of reducing load times.
 

you think it may be time I make that base class so that I only need one get, create, load etc function in the resource manager?

Exactly why I tell people to shy away from resource managers. No one shoe fits all kinds of resources, and it becomes a megalithic class that knows too much about too many other types of objects.
Each object should have a separate class for its loading so that that class can be specially design for that resource and maintain modularity. That class can and certainly should inherit from some kind of base class, and in my case it is a templated base class.

These managers should be organized hierarchically logically as well. The texture manager does not need to know what a model is nor what a shader is, while the model resource manager needs to know about them both.


L. Spiro

Edited by L. Spiro

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!