xcounting textures used

Blitz3D Forums/Blitz3D Programming/xcounting textures used

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Im sure there's a command that returns the number of active textures, but I looked through the docs and found naff all...

Any ideas, or is it an undocumented thingy I have seen somewhere?

I don't know of any such command. Sure you're not getting confused with the HWTexUnits command?

Yes, Activetextures(). It is one of those undocumented commands. I have not tested it, so I do not know how reliable it is, or for that matter what exactly it considers an "active" texture.

Thanks DJW!

Im gonna test it anyway.

Im guessing its either:

1) # textures loaded
2) # textures actually brushed onto a mesh (whether Meshes are rendered or not)
3) # textures actually rendered (perhaps even in view)

Graphics3D 800,600
SetBuffer BackBuffer()
AmbientLight 255,255,255

plane=CreatePlane(16)
RotateEntity plane,0,0,180

EntityColor plane,50,250,50

tex1=LoadTexture("t.bmp")
tex2=LoadTexture("x.bmp")
tex3=LoadTexture("t.bmp")

LOADED=ActiveTextures()

Cube=CreateCube()
EntityTexture cube,tex1

Sphere=CreateSphere(20)
EntityTexture sphere,tex1

Cone=CreateCone(20,True)
EntityTexture Cone,tex2

TEXTURED=ActiveTextures()

camera=CreateCamera()
CameraViewport camera,0,0,800,600
CameraRange camera,1,1000
CameraClsColor camera,100,100,255

PositionEntity cone,15,0,0
PositionEntity cube,-15,0,0

While Not KeyDown(1)

TurnEntity camera,0,1,0

UpdateWorld
RenderWorld

RENDERED=ActiveTextures()

If MouseDown(1) And tex4=0
tex4=LoadTexture("x.bmp")
EXTRALOADED=ActiveTextures()
EntityTexture cube,tex4
EXTRATEXTURED=ActiveTextures()
Delay 250
EndIf

If MouseDown(1) And tex4>0
FreeTexture tex4
EXTRALOADED=ActiveTextures()
EXTRATEXTURED=ActiveTextures()
tex4=0
Delay 250
EndIf

If MouseDown(2)
 EntityAlpha cone,hidden
 hidden=(1-hidden)
EndIf

If KeyDown(57) And tex1>0
FreeTexture tex1
FreeTexture tex2
FreeTexture tex3
FreeTexture tex4
tex1=0
tex2=0
tex3=0
tex4=0
EndIf

Text 0,0,"LOADED:"+LOADED
Text 0,50,"TEXTURED:"+TEXTURED
Text 0,100,"RENDERED:"+RENDERED
Text 0,150,"EXTRA LOADED:"+EXTRALOADED
Text 0,200,"EXTRA TEXTURED:"+EXTRATEXTURED

Flip

Wend

EndGraphics


Interesting...