View previous topic :: View next topic |
Author |
Message |
tirengarfio Member
Joined: 08 Aug 2006 Posts: 1
|
Posted: Tue Aug 08, 2006 10:07 am Post subject: Loading a 3d object just giving 3 of its coordinates. |
|
|
Hi,
im trying to write a code that loads a 3d model into a Vc++/Opengl application.
I would like to set the 3d object, just giving the position to three of its coordinates
I mean, if my 3d object is a cube of 2x2x2, I would like to set the coordinate (0,0,0) of the cube in some position of space OpenGL, the coordinate (2,0,0) in another position of the space, and the coordinate (0,2,0) in another position.
Someone told me something about DMF loader.
Can DMF Loader load the object 3D in the way i have said?
Do you know any other loader that can loads objects in that way? |
|
Back to top |
|
|
Jeroen Site Admin
Joined: 07 Aug 2004 Posts: 5332 Location: The Netherlands
|
Posted: Tue Aug 08, 2006 10:38 am Post subject: |
|
|
Hi there tirengarfio, and welcome!
I'm not really sure what you're trying to achieve, but I think you just want to place the loaded object at some particular position in 3D worldspace, right? If so, you can just add that position to all vertices in your object. For example, if you want to place your object at 10,4,5, then do something like:
Code: |
for i = 0 to numvertices-1 do
vertex = GetVertex(i)
vertex.x = vertex.x + 10
vertex.y = vertex.y + 4
vertex.z = vertex.z + 5
end
|
|
|
Back to top |
|
|
tirengarfio Member
Joined: 08 Aug 2006 Posts: 1
|
Posted: Tue Aug 08, 2006 10:53 am Post subject: |
|
|
GetVertex is a function from DMF Loader? |
|
Back to top |
|
|
Jeroen Site Admin
Joined: 07 Aug 2004 Posts: 5332 Location: The Netherlands
|
Posted: Tue Aug 08, 2006 11:00 am Post subject: |
|
|
I'm not familiar with the DMF loader (I write my own loaders for DeleD ). You will have to store your vertices in some way. Arrays for example. A function like GetVertex simply gets a vertex from a specific position from such array. |
|
Back to top |
|
|
|