How to Create a Mesh

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Krendor
Posts: 8
Joined: Sat Aug 26, 2006 10:01 pm

How to Create a Mesh

Post by Krendor »

How can I create a mesh?
I mean without a file, just with code.

Can I create a MeshBuffer like:
createMeshBuffer(int VertexCount, int IndexCount, int FaceCount)
???
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

Look at the CustomSceneNode tutorial :)
Image Image Image
jonasled
Posts: 34
Joined: Sat Aug 26, 2006 5:08 pm
Location: Sweden
Contact:

Re: How to Create a Mesh

Post by jonasled »

Krendor wrote:How can I create a mesh? I mean without a file, just with code.
I was just about to ask the same question. Could someone perhaps kindly provide a simple tutorial on how to create a cube or a pyramid and how to set textures for a surface etc.
Krendor
Posts: 8
Joined: Sat Aug 26, 2006 10:01 pm

Post by Krendor »

Oh, I didn't mean the DrawPrimitiveUp().
I will create a MeshBuffer.
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

Have a look at the documentation for SMesh and SMeshBuffer. Just allocate a mesh buffer, and modify the vertex and index array directly...

Code: Select all

  scene::SMeshBuffer* mesh = new SMeshBuffer;
  mesh->Vertices.push_back(video::S3DVertex(...));
  mesh->Vertices.push_back(video::S3DVertex(...));
  mesh->Vertices.push_back(video::S3DVertex(...));
  mesh->Vertices.push_back(video::S3DVertex(...));

  mesh->Indices.push_back(0);
  mesh->Indices.push_back(1);
  mesh->Indices.push_back(2);
  mesh->Indices.push_back(3);
Post Reply