Gordoni Posted November 9, 2013 Share Posted November 9, 2013 (edited) $__GLUT_hDLL = "freeglut.dll" DllOpen($__GLUT_hDLL) DllCall($__GLUT_hDLL, "none", "glutInitWindowPosition", "int","100", "int", "100") DllCall($__GLUT_hDLL, "none", "glutInitWindowSize", "int", "640", "int", "360") $naik = BitOr(0x1908, 0x140A, 0x1801) DllCall($__GLUT_hDLL, "none", "glutInitDisplayMode", "int",$naik) DllCall($__GLUT_hDLL, "int", "glutCreateWindow", "char", "myname") While 1 Sleep(1000) WEnd I would like to create window with freeglut and autoit. in C++ code which i translated : glutInit(&argc, argv); glutInitWindowPosition(100, 100); glutInitWindowSize(640, 360); glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH); glutCreateWindow("myname"); In attachment there is some examples which i found on our forum ( freeglut.dll is a clone of glut32.dll with some changes, but no in these functions ). Could someone check what is wrong or have idea how to make it working? Important links : http://www.opengl.org/documentation/specs/glut/spec3/spec3.html http://freeglut.sourceforge.net/docs/api.php ogl_glut_functions.au3 Edited November 9, 2013 by Gordoni Link to comment Share on other sites More sharing options...
LarsJ Posted November 10, 2013 Share Posted November 10, 2013 This example creates a colored triangle in a black window. expandcollapse popupGlobal Const $dllFreeGLUT = DllOpen( "freeglut.dll" ) Global Const $dllOpenGL32 = DllOpen( "opengl32.dll" ) #include "Utilities\Utilities.au3" #include "OpenGL\OpenGLconstants.au3" #include "OpenGL\OpenGLfunctions.au3" #include "FreeGLUT\FreeGLUTstdConsts.au3" #include "FreeGLUT\FreeGLUTextConsts.au3" #include "FreeGLUT\FreeGLUTstdFuncs.au3" #include "FreeGLUT\FreeGLUTextFuncs.au3" Opt( "MustDeclareVars", 1 ) Global $CurrentWidth = 800, $CurrentHeight = 600 Global $FrameCount = 0 MainFunc() DllClose( $dllFreeGLUT ) DllClose( $dllOpenGL32 ) Func MainFunc() Local $argc = 1 Local $argv[$argc] = [ @ScriptName ] glutInit( $argc, $argv ) glutInitContextVersion( 1, 1 ) ;glutInitContextVersion( 3, 3 ) ;glutInitContextFlags( $GLUT_FORWARD_COMPATIBLE ) ;glutInitContextProfile( $GLUT_CORE_PROFILE ) glutSetOption( $GLUT_ACTION_ON_WINDOW_CLOSE, $GLUT_ACTION_GLUTMAINLOOP_RETURNS ) glutInitWindowSize( $CurrentWidth, $CurrentHeight ) glutInitWindowPosition( 400, 100 ) glutInitDisplayMode( $GLUT_DEPTH + $GLUT_DOUBLE + $GLUT_RGBA ) Local $Title = "Triangle" Local $WindowHandle = glutCreateWindow( $Title ); glutReshapeFunc( "ResizeFunction" ) glutDisplayFunc( "RenderFunction" ) glutIdleFunc( "IdleFunction" ) glutTimerFunc( 0, "TimerFunction", 0 ) glClearColor( 0.0, 0.0, 0.0, 0.0 ) glutMainLoop() EndFunc ; Callback function Func ResizeFunction( $Width, $Height ) $CurrentWidth = $Width $CurrentHeight = $Height glViewport( 0, 0, $CurrentWidth, $CurrentHeight ) EndFunc ; Callback function Func RenderFunction() $FrameCount += 1 glClear( $GL_COLOR_BUFFER_BIT + $GL_DEPTH_BUFFER_BIT ) glBegin($GL_TRIANGLES) glColor3f ( 0.0, 1.0, 0.0 ) glVertex3f( -0.75, -0.50, 0.00 ) glColor3f ( 1.0, 0.0, 0.0 ) glVertex3f( 0.00, 0.75, 0.00 ) glColor3f ( 0.0, 0.0, 1.0 ) glVertex3f( 0.75, -0.50, 0.00 ) glEnd() glutSwapBuffers() glutPostRedisplay() EndFunc ; Callback function Func IdleFunction() glutPostRedisplay() EndFunc ; Callback function Func TimerFunction( $Value ) If $Value <> 0 Then Local $Title = "Triangle: " & _ $FrameCount * 4 & " Frames Per Second" & _ " @ " & $CurrentWidth & " x " & $CurrentHeight glutSetWindowTitle( $Title ) Endif $FrameCount = 0 glutTimerFunc( 250, "TimerFunction", 1 ) EndFuncExample and UDFs are in the zip file but not the dll files.Take a look at this thread in the Examples section.Triangle.7z Gordoni 1 Controls, File Explorer, ROT objects, UI Automation, Windows Message MonitorCompiled code: Accessing AutoIt variables, DotNet.au3 UDF, Using C# and VB codeShell menus: The Context menu, The Favorites menu. Shell related: Control Panel, System Image ListsGraphics related: Rubik's Cube, OpenGL without external libraries, Navigating in an image, Non-rectangular selectionsListView controls: Colors and fonts, Multi-line header, Multi-line items, Checkboxes and icons, Incremental searchListView controls: Virtual ListViews, Editing cells, Data display functions Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now