X_DRAWOBJ X_NUMFACES bug

Previous topic - Next topic

Hemlos

bug with X_NUMFACES
If i dont call X_DRAWOBJ right before X_NUMFACES, the program crashes.
Is this normal?

= this is ok
Code (glbasic) Select

  X_LOADOBJ "name.ddd",0
  X_DRAWOBJ 0 , 0
  Count = X_NUMFACES( 0 )



= this crashes program
Code (glbasic) Select

X_LOADOBJ "name.ddd",0
Count = X_NUMFACES( 0 )

Bing ChatGpt is pretty smart :O

Kitty Hello

a crash is always a bug :(

Hemlos

Ok more info about this bug..and ill move this to bug reports.

On first run, loading an object, then calling x_numface, is ok.
However if you load then draw it, crash.

Also when using filerequest, then loading object, you must draw it or it crashes.
Bing ChatGpt is pretty smart :O

mentalthink

I´m not sure Hemlos, but I think I did a test some days ago, and I don´t draw the mesh, and if I don´t rebember bad my code works... I speak about 10.x

Hemlos

#4
Ok i think i nipped it in the bud.
Here is my workaround...as im loading multiple objects, this is needed..

First call:
Code (glbasic) Select

X_LOADOBJ "", 1
X_DRAWOBJ 1, 0 //Prevent a crash
X_LOADOBJ Filename$, 1
Count = X_NUMFACES(1)


And if i want to replace object #1, and reuse X_NUMFACES(1) multiple more times:
Code (glbasic) Select

X_LOADOBJ "", 1
X_DRAWOBJ 1, 0
X_NUMFACES(1)
X_LOADOBJ FileName$, 1
X_DRAWOBJ 1 , 0
Count = X_NUMFACES(1)


If these commands are not called as i listed, in order...eventually the program crashed.
I suspect a memory/array crash here.
Bing ChatGpt is pretty smart :O