Jump to content
  • Advertisement
Sign in to follow this  
McZ

OpenGL mesh classes etc.

This topic is 5144 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

at the moment I have a CRenderAble class wich contains a pointer to a CMesh class and a pointer to a CGeometryChunk class the GeometryChunk has a pointer to a CVertexBuffer(not API specefic) class and a CMaterial pointer.. when I add the CRenderAble class to the world it will "compile" it into the the GeometryChunk, it means it will check what streams it needs for the current material from the Mesh class and push them into my VertexBuffer class.. when it is rendered it will push the VB to the renderer and the renderer will do what it wants with it, e.g. create VBO in OpenGL or simply use vertex arrays or in DX a vertexbuffer.. But now I was thinking... the above means it will create one GC and one VB for each CRenderAble class in the SceneGraph, this will get alot of different VB's... anyway if I have a large world loaded is it then better to have all the vertices and stuff pushed into a huge VB and then have some kind of IndexBuffer in the GeometryChunk to and a VertexFormat storage so I know which pice of each vertex element to use for this particular chunk this means each Mesh gets its own VB and every GC has a pointer to that VB regardless what info it is in it and the GC could have an IndexBuffer pointer if it doesn't use all vertices in that Mesh and it has a descriptor of the format the current GC uses, and then when rendering it will create an API specefic VRamBuffer and push the data needed into that buffer, also have some kind of check to determine if the buffer used last time still exists in VRam if so it doesn't need to recreate it used re-activate it. EDIT: I use some kind of Material/Shader implementation, but without the Effects part to describe each effect, I dynamicly choose the shaders depending on what info the Material Class has. and then I ask each shader for the vertexstream it needs and then I create the buffer and push in only the streams needed.

Share this post


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

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!