Custom Mesh Shapes

Anything and everything that's related to OGRE or the wider graphics field that doesn't fit into the other forums.
Post Reply
ApfelPresse
Gnoblar
Posts: 5
Joined: Mon Oct 28, 2013 3:43 pm

Custom Mesh Shapes

Post by ApfelPresse »

Hi,
im new to Ogre and my language is not the best :?

My Problem:
I have a 2d Array which contains the heights of the map, created by the (http://en.wikipedia.org/wiki/Diamond-square_algorithm) DiamondSquare Algo.
But I dont know how to create a mesh with vertex in Ogre.
Is there a docu how to set the Vertex Coordinates, Texture Coordinates, Normals and so on ?



thanks
User avatar
tod
Troll
Posts: 1394
Joined: Wed Aug 02, 2006 9:41 am
Location: Bucharest
x 94
Contact:

Re: Custom Mesh Shapes

Post by tod »

Ogre Terrain component can handle height maps. Look at the sample.
User avatar
Kojack
OGRE Moderator
OGRE Moderator
Posts: 7157
Joined: Sun Jan 25, 2004 7:35 am
Location: Brisbane, Australia
x 534

Re: Custom Mesh Shapes

Post by Kojack »

Have a look here for a tutorial on the ManualObject class: http://www.ogre3d.org/tikiwiki/tiki-ind ... e=Cookbook
ManualObject provides an easy way to generate meshes in code, using an interface inspired by opengl.
(Important note: the position element must always be the first, it starts a new vertex. Other elements like normal and texture coordinates can be in any order, as long as the first one is always a position for each vertex. The tutorial mentions that, but it's an easy detail to miss)
User avatar
lingfors
Hobgoblin
Posts: 525
Joined: Mon Apr 02, 2007 12:18 am
Location: Sweden
x 79

Re: Custom Mesh Shapes

Post by lingfors »

Here's a wiki page describing how to create a mesh by manually creating and modifying hardware buffers: http://www.ogre3d.org/tikiwiki/tiki-ind ... e=Cookbook

The wiki describes creating a sphere, but the same technique can be used for any kind of shape.
ApfelPresse
Gnoblar
Posts: 5
Joined: Mon Oct 28, 2013 3:43 pm

Re: Custom Mesh Shapes

Post by ApfelPresse »

thanks for the fast answers

@tod
i heard about it but i need some basics
because its to complicated for me

@Kojack
thats what i am looking for

@lingfors
I'll have a look.
Post Reply