• Hi,
    da ich gerade am OpenGL lernen bin (statt GDI+ :D) wollte ich euch mal meinen Progress vorstellen.
    Den Sourcecode gibt es hier schon zu sehen, jedoch muss man das .zip Archiv downloaden, da dort 3 .dlls und die .au3, welche benötigt wird, enthalten sind.
    Ist noch nicht wirklich kompliziert, jedoch bin ich ja auch gerade erst am lernen ;)

    Hier der Source:

    Spoiler anzeigen
    [autoit]

    #include "GlPluginUtils.au3"

    [/autoit] [autoit][/autoit] [autoit]

    AutoItSetOption("TrayIconHide", 1)
    AdlibRegister("_CheckWindow", 1000)

    [/autoit] [autoit][/autoit] [autoit]

    $Title = "Simple Progessbar with OpenGL by Pinguin94"
    $Scale = 0.5
    $Translate = -142
    $Change = 0
    $Stop = 0
    $Percent = 0
    $Old = 0

    [/autoit] [autoit][/autoit] [autoit]

    DefineGlWindow($Title, 440, 300)
    SetClearColor( 0.5, 0.5, 0.5)

    [/autoit] [autoit][/autoit] [autoit]

    CreateLight(0, 200, 1000, 400)
    SetLightAmbient(0, 0.2, 0.2, 0.2)
    SetLightDiffuse(0, 1, 1, 1)

    [/autoit] [autoit][/autoit] [autoit]

    $Text1 = ObjectCreate()
    AddStrokeText($Text1, 0, 0, 0, 1.0, 1, 0, "0%")
    ObjectScale($Text1, 0.2, 0.2, 0.2)
    ObjectTranslate($Text1, -20, 75, 0)
    SetPrint($Text1)

    [/autoit] [autoit][/autoit] [autoit]

    $Cube1 = ObjectCreate()
    $Box = AddCube($Cube1, 30, 30, 30, 0, 1, 0, 1)
    ObjectTranslate($Cube1, -138, 25, 0)
    SetPrint($Cube1)

    [/autoit] [autoit][/autoit] [autoit]

    $Cube2 = ObjectCreate()
    _CreateWireCube($Cube2, -20, 20, -20, 20, -20, 20 , 1, 0, 0)
    ObjectTranslate($Cube2, 0, 25, 0)
    ObjectScale($Cube2, 8, 1, 1)
    SetPrint($Cube2)

    [/autoit] [autoit][/autoit] [autoit]

    SetCamera(0, 100, 300, 0, 30, 0)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    While 1
    SceneDraw()
    Sleep(25)
    If $Percent <> $Old Then
    ObjectDelete($Text1)
    $Text1 = ObjectCreate()
    AddStrokeText($Text1, 0, 0, 0, 1.0, 1.0, 0.0, $Percent)
    ObjectScale($Text1, 0.2, 0.2, 0.2)
    ObjectTranslate($Text1, -20, 75, 0)
    SetPrint($Text1)
    $old = $Percent
    EndIf
    ObjectTranslate($Cube1, $Translate + $Change, 25, 0 )
    ObjectScale($Cube1, $Scale, 1, 1)
    If $Stop = 0 Then
    $Scale += 0.02
    $Change += 0.3
    EndIf
    If $Scale >= 10 Then $Stop = 1
    $Percent = Floor(100/10 * $Scale) & "%"
    WEnd

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func _CheckWindow()
    If Not WinExists($Title) Then Exit
    EndFunc

    [/autoit]

    Ich hoffe es gefällt euch :thumbup:


    MfG

  • Ineluki:

    Zitat

    Original von Pinguin94:
    Den Sourcecode gibt es hier schon zu sehen, jedoch muss man das .zip Archiv downloaden, da dort 3 .dlls und die .au3, welche benötigt wird, enthalten sind.

    @Pinguin94: saubere Arbeit, habe selber ja auch schon ein wenig mit OpenGL gemacht, aber noch nicht die Zeit gehabt mich wirklich mit zu beschäftigen xD.

  • TheShadowAE: Ich kenn OpenGL zwar nur von C++, daher vermute ich, dass damit die gesamte Kamera um eine bestimmte "Einheit" rotiert/verschoben wird, genauer weiß ich es aber auch nicht.

  • TheShadowAE:

    Rotate camera on it's own X,Y axis.

    [autoit]

    SetCameraRotate( $Axis, $Angle )

    [/autoit]

    Freut mich, dass es euch gefällt, an einer OpenGL Progressbar UDF arbeite ich schon :)
    Bei Fragen könnt ihr mich fragen, konnte mich in den Stoff schon recht gut einarbeiten :)
    Mein nächstes Projekt wird das Brettspiel Dame sein und danach mach ich ein 3D Haus...

    Nachteil an der UDf wird sein, dass Progressbar_Create sehr viele Parameter haben wird (wegen EmbedGlWindow).

    EDIT:

    Zitat

    Ich bekomm da nur Errors, dass die Funktionen Unbekannt sind

    Welche Funktionen sind denn unbekannt?

  • Spoiler anzeigen
    [autoit]

    #include "GlPluginUtils.au3"

    [/autoit] [autoit][/autoit] [autoit]

    AutoItSetOption("TrayIconHide", 1)
    AdlibRegister("_CheckWindow", 1000)

    [/autoit] [autoit][/autoit] [autoit]

    $Title = "OpenGL by Pinguin94"
    $Scale = 0.5
    $Translate = -142
    $Change = 0
    $Stop = 0
    $Percent = 0
    $Old = 0

    [/autoit] [autoit][/autoit] [autoit]

    DefineGlWindow($Title, 440, 300)
    SetClearColor( 0.5, 0.5, 0.5)

    [/autoit] [autoit][/autoit] [autoit]

    CreateLight(0, 200, 1000, 400)
    SetLightAmbient(0, 0.2, 0.2, 0.2)
    SetLightDiffuse(0, 1, 1, 1)

    [/autoit] [autoit][/autoit] [autoit]

    $Text1 = ObjectCreate()
    AddStrokeText($Text1, 0, 0, 0, 0, 0, 1, "0 %")
    ObjectScale($Text1, 0.2, 0.2, 0.2)
    ObjectTranslate($Text1, -20, 75, 0)
    SetPrint($Text1)

    [/autoit] [autoit][/autoit] [autoit]

    $Cube1 = ObjectCreate()
    $Box = AddCube($Cube1, 30, 30, 30, 0, 1, 0, 1)
    _CreateWireCube($Cube1,15,20,20,-15,-20,-20, 1, 1, 0)
    ObjectTranslate($Cube1, -138, 25, 0)
    SetPrint($Cube1)

    [/autoit] [autoit][/autoit] [autoit]

    $Cube2 = ObjectCreate()
    _CreateWireCube($Cube2, -20, 20, -20, 20, -20, 20 , 1, 0, 0)
    ObjectTranslate($Cube2, 0, 25, 0)
    ObjectScale($Cube2, 8, 1, 1)

    [/autoit] [autoit][/autoit] [autoit]

    ;~ ;...................-V..|V..|<
    ;~ ObjectRotate($Cube2, 0, 0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    SetPrint($Cube2)

    [/autoit] [autoit][/autoit] [autoit]

    SetCamera(0, 100, 300, 0, 30, 0)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;For FPS:
    $t=TimerInit()
    $round=0
    $ot=WinGetTitle($Title)
    $hwnd=WinGetHandle($ot)
    ;
    ;For Camera Rotate:
    $wink=0
    ;

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    While 1
    SceneDraw()
    Sleep(25)
    If $Percent <> $Old Then
    ObjectDelete($Text1)
    $Text1 = ObjectCreate()
    AddStrokeText($Text1, 0, 0, 0, 0, 0, 1, $Percent)
    ObjectScale($Text1, 0.2, 0.2, 0.2)
    ObjectTranslate($Text1, -20, 75, 0)
    SetPrint($Text1)
    $old = $Percent
    EndIf
    ObjectTranslate($Cube1, $Translate + $Change, 25, 0 )
    ObjectScale($Cube1, $Scale, 1, 1)
    If $Stop = 0 Then
    $Scale += 0.02
    $Change += 0.3
    EndIf
    ;~ If $Scale >= 10 Then $Stop = 1
    ;#
    If $Scale >= 10 Then
    $Scale=0.5
    $Change=0.0
    EndIf
    ;#
    $Percent = Floor(100/10 * $Scale) & "%"
    ;For FPS:
    $fps=Round($round/TimerDiff($t)*1000,0)
    $round+=1
    WinSetTitle($hwnd,"",$ot&" - "&$fps&" FPS")
    ;
    ;For Camera Rotate:
    $wink+=1
    if $wink>360 then $wink=0
    ;~ SetCameraPos(0,0,$wink)
    SetCameraRotate($wink,0)
    ;
    WEnd

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func _CheckWindow()
    If Not WinExists($Title) Then Exit
    EndFunc

    [/autoit]
  • Falls es noch Fragen gibt, frag ruhig ;)

    Spoiler anzeigen
    [autoit]

    #Include "GlPluginUtils.au3"

    [/autoit] [autoit][/autoit] [autoit]

    HotKeySet( "{ESC}", "_End" )
    AutoItSetOption("TrayIconHide", 1)
    AdlibRegister("_CheckWindow", 1000)

    [/autoit] [autoit][/autoit] [autoit]

    $Title = "Beispielscript by Pinguin94"

    [/autoit] [autoit][/autoit] [autoit]

    DefineGlWindow($Title, 300, 300)
    SetClearColor(1.0, 1.0, 1.0)

    [/autoit] [autoit][/autoit] [autoit]

    CreateLight( 0, 0, 100, 300 )
    SetLightAmbient(0, 0.2, 0.2, 0.2)
    SetLightDiffuse(0, 1, 1, 1)

    [/autoit] [autoit][/autoit] [autoit]

    $Object1 = ObjectCreate( )
    $Cube = AddCube($Object1, 2, 2, 2, 1, 0.5, 1, 1)
    SetPrint($Object1)

    [/autoit] [autoit][/autoit] [autoit]

    SetCamera(5, 5, 5, 0, 0, 0 )

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    SceneDraw()
    SetCameraRotate("Y", 2) ;Dreht die Camera um die Y Achse um 5 Grad. Wegen While Schleife dreht sie dauerhaft.
    Sleep(20)
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func _CheckWindow()
    If Not WinExists($Title) Then Exit
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _End()
    Exit
    EndFunc

    [/autoit]