HOw to combine 3D objects to reduce draw-calls

Previous topic - Next topic

tictac

Hello,

I need to create a lot of basic objects at runtime, in 3D, so I need to "group" (combine) objects to reduce the draw-calls.
Is there any native function in GLBasic to do that? Or is there someone who was able to create such function?

Thank you for help!
-Alessandro

Kitty Hello

You can either combine them with the modeling program. You can write such a combiner with the X_GETFACE commands.

tictac

Thank you, but I need to combine objects at runtime.

QuoteYou can write such a combiner with the X_GETFACE commands.

It means there is no built-in function to make this?
Ok, thank you!
-Alessandro

matchy

There's no real way of grouping vertex or poly objects but you can merge the creation process by calling X_OBJSTART only once for the new object id, and then add parts to it.

For example, for a kitchen table model (psuedo) from five part to one like Ikea;

open a new vertex object for a table, no merge
merge the table top vertex object, with merge
merge the four legs vertex object, with merge
close the table vertex object
:rtfm:
Code (glbasic) Select

FUNCTION make_object: obj AS vertex_object, object_merge
IF object_merge THEN X_OBJSTART obj.num
X_OBJADDVERTEX ...
...
X_OBJNEWGROUP
IF object_merge THEN X_OBJEND
ENDFUNCTION