Hi Macros,
TBGL does not feature this, as it is not possible to do it for geometry defined using immediate mode/display lists - this is sent directly to driver and archived nowhere.
But there is still hope, multiple options
OBJ format is very simple, so it is not that hard to write custom exporter.
Take following code:
[code=thinbasic]
TBGL_BeginPoly %GL_TRIANGLES
TBGL_Vertex -1, -1, 0
TBGL_Vertex 1, -1, 0
TBGL_Vertex 0, 1, 0
TBGL_EndPoly
[/code]
It can be "translated" to OBJ as following:
You can also make list of texture coordinates and even define material (texture, color) via MTL file.# TRIANGLE
# List of vertices
v -1.000000 -1.000000 0.000000
v 1.000000 -1.000000 0.000000
v 0.000000 1.000000 0.000000
# List of faces pointing to vertex list above
f 1 2 3
OBJ does not support geometric primitives or transformations, so for exporting cylinder, you would have to create simple triangle mesh for it, and then postprocess vertices via matrix multiplication - you would basically duplicate push/pop matrix, translate, rotate commands.
OBJ format specification can be found on the web, for example here:
http://local.wasp.uwa.edu.au/~pbourke/dataformats/obj/
VRML
Now that you are scared from doing ton of work, there is VRML - it is very close to OpenGL representation of data, includes primitives and transformations. I guess this would be the most straightforward way, but I am not sure if your 3D modeler supports import from this.
[code=thinbasic]
TBGL_PushMatrix
TBGL_Translate 2, 2, 2
TBGL_Cylinder 2, 2, 4
TBGL_PopMatrix
[/code]
would become
... or something like thatSeparator {
translation {
translation 2, 2, 2
}
Cylinder {
radius 2
height 4
}
}
Petr
Bookmarks