GetSurface not working?

BlitzMax Forums/MiniB3D Module/GetSurface not working?

LT(Posted 2007) [#1]
The GetSurface command (and the GetEntityBrush command) seems to always return a Null value. Is there any other way to get access to a mesh's surfaces? I'm using Klepto's extended version, btw.

Here's some sample code. In the debugger, the value for s is Null! Am I missing something?

Graphics3D 1024, 768, 32, 2

c:TMesh = CreateCube ()
s:TSurface = GetSurface( c, 0 )

DebugStop

While Not KeyDown ( KEY_ESCAPE )
Flip ()
Wend


LT(Posted 2007) [#2]
Okay, found out that if I call this instead, it works!

s:TSurface = c.GetSurface(1) <--Note it uses index starting with 1

I guess I'll start calling the oo versions. I like that methodology better, anyway. :)


AltanilConard(Posted 2007) [#3]
s:TSurface = GetSurface( c, 1 ) works too, it is the 1 parameter that matters I think.
I don't understand why though, isn't a cube supposed to have 6 surfaces, as I'm not able to get any other surface then 1.

[EDIT] Nevermind I got it now, of course a cube just has one surface. Also this explains why the parameter should be 1 (from the blitz3d manual): "Index should be in the range 1...CountSurfaces( mesh ), inclusive".


LT(Posted 2007) [#4]
When I tried that, it didn't work and still returns a Null value. Weird.