Advertisement Jump to content
Sign in to follow this  
Basiror

OpenGL Renderer design suggestions?

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

Hi, I am working on my 3d editor again after a little break. At the bottom you see the data layout which suits perfectly the requirements for editable data. However I have to implement a renderer now. The simples solution would be to use display lists (I am using opengl). But the code shall be compatible with D3D so I guess I should use vertex arrays... The question is how would you implement the vertex array generation? The mesh class is a member of my geometry class. A mesh can contain triangles with different textures assigned to it. Would you store the vertex array data in the geometry object or would you rather apply some space partition and store the vertex data in the partition tree's leafs? So each leaf contains a few vertex arrays that contain the vertex data of all the objects in the leaf's space. and upon editing of a mesh you have to rebuild the leaf/leafs. Any suggestions would be greatly appreciated.
class vertex
	{
	private:
		cross::vector3d		m_vecPos;
		cross::vector3d		m_vecNormal;
		cross::vector3d		m_vecTexCoords[MAX_TEXCOORDS];
	};
class triangle
	{
        private:
		uint32			m_uiIndex;
		uint32			m_uiShader;
		vertex			m_Vertices[3];
	};
typedef std::pair< uint32, uint32 >	VertexID;
	typedef std::list< triangle >		TriangleList;
	typedef std::vector< VertexID >		VertexIndexArray;
	typedef std::list< VertexIndexArray > VertexIndex;

	class mesh
	{
	private:
		
		TriangleList	m_Triangles;
		VertexIndex		m_VertexIndex;
	};


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.

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!