Page 1 of 1

How to show a 3D Wavefront obj file in PB ?

Posted: Sat Oct 06, 2007 5:25 pm
by raska
I need to know if there is some way to use any library or something to show a Wavefront *.obj file in solid, points and edges mode. At same time that it can be moved with the mouse in Zoom, Pan and rotate options.

Thanks

Posted: Sat Oct 06, 2007 5:35 pm
by Xqerience2003

Posted: Sat Oct 06, 2007 5:49 pm
by raska
Thanks a lot but I am looking for a very small thing, My program is 100 k. big and only that library is more than 9 meg. :roll:

I am looking for something simple with only those few functions that I explained in my firt post. Something like the Total commander's wcpfrep32.wlx list 3D viewer that is 300 k. big or maybe another more simple thing. :D

Thanks anyway ;)

Posted: Sat Oct 06, 2007 6:54 pm
by Thalius
Actually the dll itself is about 1.2 megs. If thats till too much you could use this as a converter / loader.

Use Irrlicht to load your object file and dump vertex / Indice / UV Data to a custom file ( which you in the final exe could include via includebinairy or paste as text - depending how you store it - you could even compress that section using Pbs pack commands ). Then use the OpenGL include
from: http://www.purebasic.fr/english/viewtopic.php?t=28835
to create your lil viewer passing the vertex / Indice / UV data to OpenGL.

Basically this data is a bunch of Arrays.

This way you could easly make a few kb sized viewer (30kb + obj data) - or you can write your own OBJ importer using the Format description from here:
http://www.wotsit.org/download.asp?f=vi ... =244988950

as for Irrlicht: if your unsure how to extract Vertex Data etc from a model i can provide an example.

Thalius

Re: How to show a 3D Wavefront obj file in PB ?

Posted: Sat Oct 06, 2007 7:43 pm
by Comtois
raska wrote:I need to know if there is some way to use any library or something to show a Wavefront *.obj file in solid, points and edges mode. At same time that it can be moved with the mouse in Zoom, Pan and rotate options.

Thanks
May be you can use Deledto convert your Wavefront to Mesh ?

Posted: Sat Oct 06, 2007 7:48 pm
by raska
Thalius wrote:Actually the dll itself is about 1.2 megs. If thats till too much you could use this as a converter / loader.

Use Irrlicht to load your object file and dump vertex / Indice / UV Data to a custom file ( which you in the final exe could include via includebinairy or paste as text - depending how you store it - you could even compress that section using Pbs pack commands ). Then use the OpenGL include
from: http://www.purebasic.fr/english/viewtopic.php?t=28835
to create your lil viewer passing the vertex / Indice / UV data to OpenGL.

Basically this data is a bunch of Arrays.

This way you could easly make a few kb sized viewer (30kb + obj data) - or you can write your own OBJ importer using the Format description from here:
http://www.wotsit.org/download.asp?f=vi ... =244988950

as for Irrlicht: if your unsure how to extract Vertex Data etc from a model i can provide an example.

Thalius
Wow, that sounds good, but very advanced for a PB newbie like me. :)
My program manage some *,obl files and read their vertex to manipulate them in a way that I need to get what I want. Although the program really don't need the *.obj simple player it would be a good addition.
My idea was that every time that the program get an *.obj file it could call to an own smal library or Procedure able to show the obj in an small window.

I just got amazed after to see what the italian guy made with those demos. I will check them slowly trying to understand what he does. :)

Thanks for all your help and fast response

Re: How to show a 3D Wavefront obj file in PB ?

Posted: Sat Oct 06, 2007 7:54 pm
by raska
Comtois wrote:
raska wrote:I need to know if there is some way to use any library or something to show a Wavefront *.obj file in solid, points and edges mode. At same time that it can be moved with the mouse in Zoom, Pan and rotate options.

Thanks
May be you can use Deledto convert your Wavefront to Mesh ?
For my own use maybe yes, but it is an extra work that I really don't want yo do. For all my friends that using the program really it would be a big issue, because they don't know how to do it.
I think I will study the Thalius suggest to see what can I do :)
Thanks anyway