This site is no longer active and is available for archival purposes only. Registration and login is disabled.

3D Textures


3D Textures

Postby gilad_no » Jun 27, 2007 @ 11:05pm

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?
gilad_no
pm Member
 
Posts: 22
Joined: Feb 13, 2007 @ 5:50pm
Location: Montreal


Postby edge » Jun 28, 2007 @ 1:12pm

Attachments
cubetex.zip
Sample texture
(2.18 KiB) Downloaded 423 times
EDGELIB: Cross-platform mobile development at your fingertips
http://www.edgelib.com
User avatar
edge
pm Member
 
Posts: 1180
Joined: Aug 22, 2005 @ 3:42pm
Location: The Netherlands


But how do I map the faces?

Postby gilad_no » Jun 28, 2007 @ 4:10pm

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
gilad_no
pm Member
 
Posts: 22
Joined: Feb 13, 2007 @ 5:50pm
Location: Montreal


Postby edge » Jun 28, 2007 @ 6:07pm

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,
EDGELIB: Cross-platform mobile development at your fingertips
http://www.edgelib.com
User avatar
edge
pm Member
 
Posts: 1180
Joined: Aug 22, 2005 @ 3:42pm
Location: The Netherlands


Postby gilad_no » Jun 28, 2007 @ 11:53pm

gilad_no
pm Member
 
Posts: 22
Joined: Feb 13, 2007 @ 5:50pm
Location: Montreal


Postby edge » Jun 29, 2007 @ 5:43pm

EDGELIB: Cross-platform mobile development at your fingertips
http://www.edgelib.com
User avatar
edge
pm Member
 
Posts: 1180
Joined: Aug 22, 2005 @ 3:42pm
Location: The Netherlands


Return to EDGELIB


Sort


Forum Description

Powerful and affordable C++ middleware solution covering true multi-platform 2D, 3D and network features for Apple iPhone, Windows Mobile, Symbian S60, UIQ, Linux and Windows desktop.

Moderator:

edge

Forum permissions

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

cron