(AGK version: 108.24)
Submitted: 2015-01-02 18:06:14
// this example should work with AGK V1 and V2

// press the spacebar or the onscreen button to toggle the cull mode of the cubes

// make and position 3 transparent boxes one behind the other
for i = 1 to 3
	CreateObjectBox(i,20,20,20)
	SetObjectTransparency(i,1)
	SetObjectColor(i,0,255,255,150)
	SetObjectPosition(i,-30,0,(i-1)*30)
next i

for i = 4 to 6
	CreateObjectBox(i,20,20,20)
	SetObjectTransparency(i,1)
	SetObjectColor(i,0,255,255,150)
	SetObjectPosition(i,30,0,(i-4)*30)
next i


// create a directional and point light
CreateLightDirectional(1,-1,-1,0.5,255,255,255)
CreateLightPoint(1,0,10,30,200,255,255,255)

// position and orientate camera
SetCameraPosition(1,0,50,-100)
SetCameraLookAt(1,0,0,30,0)

// set an initial cull mode
cull_mode = 1

do

	// press the space button to toggle the cull mode
	if GetButtonPressed(1) = 1
		inc cull_mode
		if cull_mode > 2
			cull_mode = 0
		endif

		// alter the cull mode for all the cubes
		for i = 1 to 6
			SetObjectCullMode(i,cull_mode)
		next i

	endif

	// print a message based on the cull mode
	select cull_mode

		case 0
			print("show front and back faces")
		endcase

		case 1
			print("show front faces only")
		endcase

		case 2
			print("show back faces only")
		endcase

	endselect

	sync()

loop
Help make AGK better by submitting an example for this command!
(All examples are subject to approval)
Login to post an example of your own.