This tutorial explains the basics of creating a scene using Au3GlPlugin T2 on AutoIt and running it.
First, create an empty script file and put this:
#include "GlPluginUtils.au3" AutoItSetOption( "TrayIconHide", 1 ) Opt( "WinTitleMatchMode", 3 )
Ok, this will load plugin and hides the tray icon.
But we need a window to show the scene, so put this too:
;defining window $WinTitle = "My First Scene" DefineGlWindow( 400, 300, $WinTitle )
Now sets a background color and put a light.
;setting back color SetClearColor( 1.0, 1.0, 1.0 ) ;creating light 0 CreateLight( 0, 300, 300, 300 ) SetLightAmbient( 0, 0.2, 0.2, 0.2 ) SetLightDiffuse( 0, 0.7, 0.7, 0.7 ) SetLightSpecular( 0, 1.0, 1.0, 1.0 )
Now you can create an object
;creating an object $Object1 = ObjectCreate( )
The object was created, but empty!
Then you can create a shape on it.
;creating a shape in object $Cube = AddCube( $Object1, 2, 2, 2, 0.9, 0.2, 0.2, 1.0 )
For some aesthetic, rotate that cube around Y axis.
;rotating the shape (not the object) ShapeRotate( $Object1, $Cube, 0, 45, 0 )
Where is the camera????
;setting the camera SetCamera( 0, 3, 12, 0, 0, 0 )
Well, you have window, light, object, shape... But, by default, an object isn't in print buffer, so, you need put it in:
;setting to print the object SetPrint( $Object1 )
And now the funny part. For drawing the scene, call SceneDraw( ). So, put it in a loop.
WinWait( $WinTitle ) While 1 ;drawing SceneDraw( ) Sleep( 100 ) Wend
For some control on exit, replace the above code to this:
WinWait( $WinTitle ) $CheckWindowTimer = TimerInit( ) While 1 ;drawing SceneDraw( ) Sleep( 100 ) ;check if window exist... (using a timer to reduce CPU usage by WinExists function) If TimerDiff( $CheckWindowTimer ) > 1000 Then If WinExists( $WinTitle ) = 0 Then ExitLoop $CheckWindowTimer = TimerInit( ) EndIf Wend
Experiment this simple demo with some variations.
![]()