Sign in to follow this  

Drawin Mesh (without model file)

This topic is 685 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 guys,

 

in normal case I'm using .fbx models to draw my stuff ingame.

I just want to know how can I draw meshes without a .fbx model file.

 

For example, i want to draw some cubes.

I defined a Array for 100 cubes, the Array just includes the Position of the cube and the size.

Is it possible to draw this cubes or do i need to create model files for all this cubes first?

 

If it is possible, how can I add some texture to this cube mesh?

 

Greetz

ecko

 

 

Share this post


Link to post
Share on other sites

You can certainly do this. The rendering API has no idea where the data originally came from (model file, network stream or even defined at runtime).

 

You just need a way to define each vertex (a vertex buffer) and some way to define the ordering the vertices into triangles (an index buffer) and fill those with the data you want. For texturing, just make sure your vertices have UV coordinates and set the texture you want to use. The exact details of this depend on the engine/framework you are using and on the shaders used.

 

In theory you could even generate the data on the GPU completely using eg. the geometry shader, but lets' not go there. My point is just that the CPU does not even need to know about your meshes.

Share this post


Link to post
Share on other sites

This topic is 685 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this