Page 1 of 1

3D Textures

PostPosted: Jun 27, 2007 @ 11:05pm
by gilad_no
Hello,

I'm trying to play a little bit with the 3D example (the one with the jumping turtle).

When drawing the block, it uses the texture for each face. How can I define a different texture for each face of the cube?

PostPosted: Jun 28, 2007 @ 1:12pm
by edge

But how do I map the faces?

PostPosted: Jun 28, 2007 @ 4:10pm
by gilad_no
I've used the same code from the sample in Edge, to draw the cube.

Then, in order to render it, I use:

pDisplay->BindTexture(&m_BoardTexture);
pDisplay->SetShading(E3D_GOURAUD|E3D_TEXTURE);
pDisplay->Render(&m_Board);

But if I'm using your sample texture, I see it on every face, instead of mapping it as you suggested.

Additional question that I have (related to 3D): How do I write selection code? I want to draw a 3D board with some pieces on it, and allow the user to select a piece by clicking on it with the mouse. I saw a code in the sample (View3D) for the mouse selection, but from what I understood it is to determine the change in the mouse position - rather then selection the model.

BTW, I think you should really put up a section on the website where people can upload and share code samples for EdgeLib.

- Gilad

PostPosted: Jun 28, 2007 @ 6:07pm
by edge
Hi Gilad,

You should map every face manually using the texture coordinates. You can do this with E3DSurface::SetTexCoord (or directly using 3D modeling software). This method is used in the turtle model included in the SDK.

Your second question is not really related to EDGELIB and it's pretty hard to give a short answer, as you probably want to be able to rotate and tilt the game board as well. You could try to give the game board a fixed position (for example from above, 45 degrees rotated to make the calculation less complicated.

We all like the idea here of putting up a website where EDGELIB developers can post, share and comment on sample code, snippets and tutorials. Do you have additional ideas on this? Please contact us at info [at] edgelib [dot] com to discuss this in more detail.

Thanks and regards,

PostPosted: Jun 28, 2007 @ 11:53pm
by gilad_no

PostPosted: Jun 29, 2007 @ 5:43pm
by edge