GLBasic User Manual

Main sections


id% = GENX_OBJ()

This command returns an index that can be used to open a resource with X_LOADOBJ without overwriting already loaded data.

If no more memory is available, -1 will be returned.

The obvious advantage of this approach is that you can write libraries that fit seamlessly into existing projects without interferring with with the existing code.
If using these commands to allocate indicies in any part of your code, you should use them throughout your whole program.

The example here:
file$ = "robot.ddd"
X_LOADOBJ file$, 1

Can be written as:
GLOBAL gXobjRobot
gXobjRobot = GENX_OBJ()
file$ = "robot.ddd"
X_LOADOBJ file$, gXobjRobot
X_DRAWOBJ gXobjRobot, 0

See also...