Page 1 of 2

Several objects

PostPosted: May 15, 2007 @ 5:14pm
by meiline
Hello,

I'm trying to load several objects, but it doesn't work like I want. I explain myself:

If an object is inside another one, they seem that they are superposed. For example, I have two objects in format 3ds. A cup and a spoon. The spoon is inside the cup. If I load both objects with 3D studio, is correctly. But when I load them with the EDGELIB functions it seems that the spoon is outside the cup.

How can I do to get this effect?
Have I explained myself well? I must apologize for my English. I'm sorry.:oops:

Thanks a lot. :lol:

PostPosted: May 16, 2007 @ 11:03am
by edge
Hi Meiline,

Can you tell me which method you use for rendering the 3D objects?

If you're using the EDGELIB internal renderer, it's currently not possible to do proper object sorting when drawing multiple objects. The best way to solve it is to merge the objects before rendering.

PostPosted: May 16, 2007 @ 2:59pm
by meiline

PostPosted: May 18, 2007 @ 8:17am
by meiline
Hi again!

I have tried to merge the objects, but I don't achieve my purpose.

I have read: "Setting up the OpenGL ES display is handled by the Edge SDK, enabling developers to start outputting 3D models right away. In addition, Edge's existing E3DSurface interface can be used in combination with the 3D Studio Max 3DS loader to easily load 3D models in OpenGL ES powered applications."

So my question now is: If I load my 3ds object in E3DSurface, ¿how can I render it with OpenGL ES? ¿Is it possible?

Thanks a lot of. Best regards.

PostPosted: May 18, 2007 @ 8:27am
by Rye
Im no expect on the subject so could be way off here but, wouldn't you have to first move the spoon surface inside the 3d space of the cup?

Without first moving the spoon it would appear in front of the cup but if you moved the spoons z axis to be in the range of the cups it would give the effect it is inside it.

Or maybe it is because you are rendering the cup and THEN the spoon?

Just a guess...

PostPosted: May 18, 2007 @ 11:27am
by meiline
Hi Rye,

Thanks for your guess.

If I render the cup and then the spoon, the effect is "the spoon is in front of the cup". If I render the spoon first, the result is "spoon is behind the cup"
I'd like to have the effect "the spoon is inside the cup" That means: if you see the scene in one part the cup cover the spoon, but in another part, the spoon cover the cup

Thanks anyway!! :)

PostPosted: May 18, 2007 @ 2:36pm
by napoleondynamite
There is no spoon.

Sorry, I couldn't resist! No idea how to fix your problem, though :wink:

PostPosted: May 18, 2007 @ 3:10pm
by edge
Hi Meiline,

To enable OpenGL ES, you can define EGL_USEGL before including edgemain.h and link the necessary libraries. It may be needed to download an SDK, for example PowerVR or Rasteroid.

For more information look at the View3D and Animate3D samples or read our tutorial here: http://www.edgelib.com/index.php?node=1093

PostPosted: May 20, 2007 @ 3:55am
by kuroneko

PostPosted: May 20, 2007 @ 3:27pm
by edge
Well, actually it's a problem with depth sorting in the internal EDGELIB renderer (which isn't based on OpenGL and doesn't have a z-buffer). The internal EDGELIB renderer is used when OpenGL isn't enabled.

Both objects are rendered by z-sorting the polygons. Because the first object is already drawn before the second object, the second object will be rendered on top of that without looking at the rotation or position of the objects. The only solution for this would be to draw both objects in one render call. Of course, this only applies when using the internal EDGELIB renderer instead of using OpenGL.

When OpenGL is enabled, it will render properly because OpenGL has a z-buffer. This buffer is automatically enabled in the OpenGL configuration.

PostPosted: May 21, 2007 @ 3:04pm
by meiline

PostPosted: May 22, 2007 @ 10:21am
by edge
Hi Meiline,

Actually, the call to display->Render(&cup) will have the ability to render to OpenGL. If OpenGL is enabled, first call display->Perspective3D before calling display->Render(). For an example, please look at the view3D sample, bundled with the SDK.

PostPosted: May 22, 2007 @ 3:31pm
by meiline

PostPosted: May 23, 2007 @ 3:24pm
by edge
Hi Meiline,

Can you tell me which OpenGL ES implementation you're using? Would you like to recompile the View3D sample and try to run it on your device? Does it generate an error message?

If the problem only occurs with your project we recommend adding an EGL_POWERVR or EGL_RASTEROID definition to your Embedded Visual C++ project. If you're using the Edge IDE you can see this definition when editing the project file with a text editor.

PostPosted: May 25, 2007 @ 11:40am
by meiline