Creating custom mesh in 2.1

Discussion area about developing with Ogre2 branches (2.1, 2.2 and beyond)
Post Reply
ashleybeshir
Gnoblar
Posts: 18
Joined: Thu Sep 25, 2014 12:53 pm

Creating custom mesh in 2.1

Post by ashleybeshir »

Hello everyone ,

I know how to create custom mesh in 1.8,1.9 using manualobject and stuff but i have no clue when it comes to 2.1 ? any good ideas where to start. Trying to make small voxel world .

Regards Ashley

User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 4360
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 885
Contact:

Re: Creating custom mesh in 2.1

Post by dark_sylinc »

See CustomRenderable & DynamicGeometry samples.

There is also a community-ported version of ManualObject, but it works a little different (see http://www.ogre3d.org/forums/viewtopic. ... ct#p519713) and CustomRenderable probably has what you need.

ashleybeshir
Gnoblar
Posts: 18
Joined: Thu Sep 25, 2014 12:53 pm

Re: Creating custom mesh in 2.1

Post by ashleybeshir »

dark_sylinc wrote:See CustomRenderable & DynamicGeometry samples.

There is also a community-ported version of ManualObject, but it works a little different (see http://www.ogre3d.org/forums/viewtopic. ... ct#p519713) and CustomRenderable probably has what you need.
Thank you for your reply . I checked the samples but couldnt find these two ? is it in the 2.1 - samples file ?

User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 4360
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 885
Contact:

Re: Creating custom mesh in 2.1

Post by dark_sylinc »

Yes.

CustomRenderable, DynamicGeometry

Maybe you didn't enable OGRE_BUILD_SAMPLES2?

Cheers.
Matias.

ashleybeshir
Gnoblar
Posts: 18
Joined: Thu Sep 25, 2014 12:53 pm

Re: Creating custom mesh in 2.1

Post by ashleybeshir »

dark_sylinc wrote:Yes.

CustomRenderable, DynamicGeometry

Maybe you didn't enable OGRE_BUILD_SAMPLES2?

Cheers.
Matias.
unchecked it by mistake . what is the difference between customrenderable and dynamicgeometry ?

User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 4360
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 885
Contact:

Re: Creating custom mesh in 2.1

Post by dark_sylinc »

DynamicGeometry sample shows how to construct a v2 Mesh and create an Item from it, while still being able to modify the mesh after the Item was created (unless the buffers were created with the immutable flag for performance).
Decreasing the vertex/count afterwards is easy, but increasing the vertex/index count is almost impossible with this method unless you recreate the items or update its inner structure (though if you know the upper limit, you can create a vertex buffer large enough, then only use a fraction by calling VertexArrayObject::setPrimitiveRange)

CustomRenderable shows how to derive from MovableObject & Renderable to render geometry in a more customized way, similar to what deriving from v1::SimpleRenderable used to provide.

ashleybeshir
Gnoblar
Posts: 18
Joined: Thu Sep 25, 2014 12:53 pm

Re: Creating custom mesh in 2.1

Post by ashleybeshir »

dark_sylinc wrote:DynamicGeometry sample shows how to construct a v2 Mesh and create an Item from it, while still being able to modify the mesh after the Item was created (unless the buffers were created with the immutable flag for performance).
Decreasing the vertex/count afterwards is easy, but increasing the vertex/index count is almost impossible with this method unless you recreate the items or update its inner structure (though if you know the upper limit, you can create a vertex buffer large enough, then only use a fraction by calling VertexArrayObject::setPrimitiveRange)

CustomRenderable shows how to derive from MovableObject & Renderable to render geometry in a more customized way, similar to what deriving from v1::SimpleRenderable used to provide.
Thank you very much for your help. If i wanted to add uv for texturing . how would i go about ?

User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 4360
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 885
Contact:

Re: Creating custom mesh in 2.1

Post by dark_sylinc »

Just add an extra element:

Code: Select all

vertexElements.push_back( VertexElement2( VET_FLOAT2, VES_TEXTURE_COORDINATES) );

xrgo
OGRE Expert User
OGRE Expert User
Posts: 1142
Joined: Sat Jul 06, 2013 10:59 pm
Location: Chile
x 164

Re: Creating custom mesh in 2.1

Post by xrgo »

maybe this thread could help you:
http://www.ogre3d.org/forums/viewtopic.php?f=25&t=83999
the uv part is commented out but its there

Post Reply