Drawing polygons

Ydobon

15-11-2007 08:18:09

I have looked through Mogre/Ogre API and i can't find any method/class for drawing polygon using vertices.

What i want do do?
I want to draw a poligon like in OpenGL, i.e.

1. set texture
2. call a method that begins drawing polygon
3. assign vertices
4. end drawing polygon

or do 1. in one method then do 2.-4. in one method

or do 1.-4. in one method


I hope there is some simple solution to my problem

Regards
Kresimir

bleubleu

15-11-2007 11:49:33

Ha! This is your lucky day!

Look for a class called ManualObject. This class will allow you to enter vertices just like you would do with OpenGL. Moreover, you will be able to convert the result into an Ogre mesh afterwards.

To assign the texture (your step #1) you will have to become familiar with Materials. You will either have to create a .material file or to create one programatically. The only two builtin materials I know of are "BaseWhite" and "BaseWhiteNoLighting".

Dont forget that you would be better to learn to do stuff "Ogre-way" instead of sticking to old OpenGL concepts.

Pseudo-top-of-my-head code.

ManualObject mo = sm.CreateManualObject("test");

mo.Begin("BaseWhite");
mo.Position(0,0,0);
mo.Position(1,0,0);
mo.Position(0,1,0);
mo.End();

sm.RootSceneNode.AttachObject(mo);



Have fun

Ydobon

15-11-2007 11:59:52

That's great. I hope it will work for me.

Btw. you said:

"dont forget that you would be better to learn to do stuff "Ogre-way" instead of sticking to old OpenGL concepts"

I do wana drop OpenGL concepts but how can I do that when I can't draw simple polygon out of vertices in, non_sarcastic_quote "graphic engine".

By using the class you suggested, do you think I'm doing it the "Ogre way"?

Thank you for help