Jump to content

OpenGl Plugin - Update 2007/08/31


A. Percy
 Share

Recommended Posts

!Draw a Cube!

#compiler_plugin_funcs=DefineGlWindow, DelObject, SetClearColor, SetCamera, GlMainLoop, AddLine, AddTriangle, AddObject, RotateObject, TranslateObject, AddGlSphere
#include <GUIConstants.au3>
#include <Misc.au3>
$handle = PluginOpen( @ScriptDir & "\Au3GlPlugin.dll" )
$w = 1
$h = 1
$startX = 0
$startY = 0
$on = False
$title = "AutoIt OpenGl Experiment"
DefineGlWindow( @DesktopWidth, @DesktopHeight, $title )
SetCamera( -180, 0, 600, 0, 0, 0 )
SetClearColor( 2, 0.2, .2 )
GlMainLoop( )
WinWait( $title )
WinSetState( $title, "", @SW_MAXIMIZE )
$GUI = ""
While 1
    If _IsPressed("01") Then
        If $on = False Then
            ;$GUI = GUICreate("cube", 1, 1, $startX, $startY, $ws_popup, 0x00000020)
            ;GUISetState()
            $startX = MouseGetPos( 0 )
            $startY = MouseGetPos( 1 )
            $on = True
        Else
            $w = MouseGetPos( 0 ) - $startX
            $h = MouseGetPos( 1 ) - $startY
        EndIf
        WinMove ( "cube", "", $startX, $startY, $w, $h )
    Else
        If $on = True Then _CreateRect( Random(1, 10), Random(0,1), Random(0,1), Random(0,1), .5, $w, $h, 40, -@DesktopWidth/2+$startX, @DesktopHeight/2-$startY, -100 )
            $on = False
        ;GUIDelete($GUI)
    EndIf
    Sleep(10)
WEnd
Func onautoitexit()
    PluginClose( $handle )
EndFunc
Func _CreateRect( $Name, $Red, $Green, $Blue, $Alpha, $width, $height, $depth, $x, $y, $z )
    
    AddObject( $Name )
    
    Local $V1[3] = [ -($width/2)+$x,  $height/2+$y, -($depth/2)+$z]
    Local $V2[3] = [  $width/2+$x,  $height/2+$y, -($depth/2)+$z]
    Local $V3[3] = [ -($width/2)+$x, -($height/2)+$y, -($depth/2)+$z]
    Local $V4[3] = [  $width/2+$x, -($height/2)+$y, -($depth/2)+$z]
    Local $V5[3] = [ -($width/2)+$x,  $height/2+$y,  $depth/2+$z]
    Local $V6[3] = [  $width/2+$x,  $height/2+$y,  $depth/2+$z]
    Local $V7[3] = [ -($width/2)+$x, -($height/2)+$y,  $depth/2+$z]
    Local $V8[3] = [  $width/2+$x, -($height/2)+$y,  $depth/2+$z]
    
    Local $Normal[3] = [ 0, 0, 1 ]
    _AddTriangleEx( $Name, $V1, $V2, $V3, $Normal, $Red, $Green, $Blue, $Alpha )
    _AddTriangleEx( $Name, $V3, $V4, $V2, $Normal, $Red, $Green, $Blue, $Alpha )

    Local $Normal[3] = [ 1, 0, 0 ]
    _AddTriangleEx( $Name, $V6, $V2, $V8, $Normal, $Red, $Green, $Blue, $Alpha )
    _AddTriangleEx( $Name, $V8, $V4, $V2, $Normal, $Red, $Green, $Blue, $Alpha )

    Local $Normal[3] = [ 0, 0,-1 ]
    _AddTriangleEx( $Name, $V6, $V8, $V5, $Normal, $Red, $Green, $Blue, $Alpha )
    _AddTriangleEx( $Name, $V7, $V8, $V5, $Normal, $Red, $Green, $Blue, $Alpha )

    Local $Normal[3] = [-1, 0, 0 ]
    _AddTriangleEx( $Name, $V5, $V1, $V3, $Normal, $Red, $Green, $Blue, $Alpha )
    _AddTriangleEx( $Name, $V5, $V7, $V3, $Normal, $Red, $Green, $Blue, $Alpha )

    Local $Normal[3] = [ 0, 1, 0 ]
    _AddTriangleEx( $Name, $V1, $V6, $V5, $Normal, $Red, $Green, $Blue, $Alpha )
    _AddTriangleEx( $Name, $V1, $V2, $V6, $Normal, $Red, $Green, $Blue, $Alpha )

    Local $Normal[3] = [ 0,-1, 0 ]
    _AddTriangleEx( $Name, $V3, $V8, $V7, $Normal, $Red, $Green, $Blue, $Alpha )
    _AddTriangleEx( $Name, $V3, $V8, $V4, $Normal, $Red, $Green, $Blue, $Alpha )
EndFunc
Func _AddTriangleEx( $Name, $V1, $V2, $V3, $Normal, $Red, $Green, $Blue, $Alpha )
    If UBound( $V1 ) and UBound( $V2 ) and UBound( $V3 ) and UBound( $Normal ) Then
        AddTriangle( $Name, $V1[0], $V1[1], $V1[2], $V2[0], $V2[1], $V2[2], $V3[0], $V3[1], $V3[2], $Normal[0], $Normal[1], $Normal[2], $Red, $Green, $Blue, $Alpha )
    EndIf
EndFunc

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Link to comment
Share on other sites

  • Replies 166
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

!Draw a Cube!

...

Definitively you like colors! :P

Só o que posso lhe dizer, bom é quando faz mal!My work:Au3Irrlicht - Irrlicht for AutoItMsAgentLib - An UDF for MSAgentAu3GlPlugin T2 - A 3D plugin for AutoIt...OpenGl Plugin - The old version of Au3GlPlugin.MAC Address Changer - Changes the MAC AddressItCopter - A dragonfly R/C helicopter simulator

VW Bug user

Pinheiral (Pinewood) city:

http://pt.wikipedia.org/wiki/Pinheiral

Link to comment
Share on other sites

Definitively you like colors! :P

well I was going to have it just one color but when you draw a lot of rectangles its hard to tell

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Link to comment
Share on other sites

  • 2 weeks later...

New update released, now with some light management functions (will be improved later)

I have many ideas, but little time. Please, don't blame! :P

Bye!

Só o que posso lhe dizer, bom é quando faz mal!My work:Au3Irrlicht - Irrlicht for AutoItMsAgentLib - An UDF for MSAgentAu3GlPlugin T2 - A 3D plugin for AutoIt...OpenGl Plugin - The old version of Au3GlPlugin.MAC Address Changer - Changes the MAC AddressItCopter - A dragonfly R/C helicopter simulator

VW Bug user

Pinheiral (Pinewood) city:

http://pt.wikipedia.org/wiki/Pinheiral

Link to comment
Share on other sites

Updated again... 25/12/2006

Any opinion? Please, post here!!!!

Só o que posso lhe dizer, bom é quando faz mal!My work:Au3Irrlicht - Irrlicht for AutoItMsAgentLib - An UDF for MSAgentAu3GlPlugin T2 - A 3D plugin for AutoIt...OpenGl Plugin - The old version of Au3GlPlugin.MAC Address Changer - Changes the MAC AddressItCopter - A dragonfly R/C helicopter simulator

VW Bug user

Pinheiral (Pinewood) city:

http://pt.wikipedia.org/wiki/Pinheiral

Link to comment
Share on other sites

Updated again... 25/12/2006

Any opinion? Please, post here!!!!

cool

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Link to comment
Share on other sites

This is amazing work, but is crying out for a basic 3D editor, like having Cube, Sphere and Prymid shapes that you place in 3D space... :P

Here`s a project for Mr CyberCool, create the letter "A" (or the word "Autoit" if you like :D) and have it rotate when you move the mouse, eg moving the mouse left causes the letter to spin clockwise in the X axis, moving the mouse up and down cuases the letter to rotate in the Y axis (flips the A), while the mouse wheel zooms in and out.

2015 - Still no flying cars, instead blankets with sleeves.

Link to comment
Share on other sites

  • 2 weeks later...

Thanks Lakes. I will add some polygons in next release.

Today I added a new function called SetLightPosition and made some refactory in code. I having few time for now, but that refactory will help me a lot in next release :P

Please, take a look in new example called Pyramid.au3

Obs: Code updated

Alexsandro Percy

Edited by A. Percy

Só o que posso lhe dizer, bom é quando faz mal!My work:Au3Irrlicht - Irrlicht for AutoItMsAgentLib - An UDF for MSAgentAu3GlPlugin T2 - A 3D plugin for AutoIt...OpenGl Plugin - The old version of Au3GlPlugin.MAC Address Changer - Changes the MAC AddressItCopter - A dragonfly R/C helicopter simulator

VW Bug user

Pinheiral (Pinewood) city:

http://pt.wikipedia.org/wiki/Pinheiral

Link to comment
Share on other sites

Wow, this is really cool. This is a cool script.

Thanks!

Só o que posso lhe dizer, bom é quando faz mal!My work:Au3Irrlicht - Irrlicht for AutoItMsAgentLib - An UDF for MSAgentAu3GlPlugin T2 - A 3D plugin for AutoIt...OpenGl Plugin - The old version of Au3GlPlugin.MAC Address Changer - Changes the MAC AddressItCopter - A dragonfly R/C helicopter simulator

VW Bug user

Pinheiral (Pinewood) city:

http://pt.wikipedia.org/wiki/Pinheiral

Link to comment
Share on other sites

I'm gonna do some tweaking and make a 3d Screen saver.

Good luck! Count on me on what I may be usefull.

Só o que posso lhe dizer, bom é quando faz mal!My work:Au3Irrlicht - Irrlicht for AutoItMsAgentLib - An UDF for MSAgentAu3GlPlugin T2 - A 3D plugin for AutoIt...OpenGl Plugin - The old version of Au3GlPlugin.MAC Address Changer - Changes the MAC AddressItCopter - A dragonfly R/C helicopter simulator

VW Bug user

Pinheiral (Pinewood) city:

http://pt.wikipedia.org/wiki/Pinheiral

Link to comment
Share on other sites

But I got one question: Would it be possible to maybe display stuff in OpenGL based Games? Like drawing inside the Game?

I don't know. I will search about, but I don't believe it's possible... But it's a good idea.

Thanks!

Só o que posso lhe dizer, bom é quando faz mal!My work:Au3Irrlicht - Irrlicht for AutoItMsAgentLib - An UDF for MSAgentAu3GlPlugin T2 - A 3D plugin for AutoIt...OpenGl Plugin - The old version of Au3GlPlugin.MAC Address Changer - Changes the MAC AddressItCopter - A dragonfly R/C helicopter simulator

VW Bug user

Pinheiral (Pinewood) city:

http://pt.wikipedia.org/wiki/Pinheiral

Link to comment
Share on other sites

I don't know. I will search about, but I don't believe it's possible... But it's a good idea.

Thanks!

good idea but would it also be possible to read the position of opengl or directx objects like for an aim bot? probably not right?

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Link to comment
Share on other sites

Just thought I'd add something in...

I've made a prototype of a recreation of the world view of Populous: The Beginning's engine (or the Magic Carpet engine, as PopTB is based on Magic Carpet technology). Populous: The Beginning is an excellent game where you play a primitive tribe's spiritual leader, and conquer other worlds and the three other tribes (Dakini, Matak and Chumara) in your quest to become a god. You play through 3D worlds and build, attack, defend and cast spells to alter land, scare the enemy tribe and enhance the power of your followers.

Controls:

Simple Controls
====== ========
PgUp        - Zoom In
PgDn        - Zoom Out
Up        - Rotate World on Y-Axis by positive amount
Down        - Rotate World on Y-Axis by negative amount
Right      - Rotate World on X-Axis by positive amount
Left        - Rotate World on X-Axis by negative amount

Advanced Controls
======== ========
PgUp        - Zoom In
PgDn        - Zoom Out
Up        - Rotate Camera on Y-Axis about 0,0 by positive amount
Down        - Rotate Camera on Y-Axis about 0,0 by negative amount
Right      - Rotate Camera on X-Axis about 0,0 by positive amount
Left        - Rotate Camera on X-Axis about 0,0 by negative amount
W          - Move Camera up
S          - Move Camera down
A          - Move Camera to the left
D          - Move Camera to the right
Mouse Left  - } Not actually sure, what these do, but try using them
Mouse Right - } when you have rotated the camera so you are facing the world from the side.

Here it is - don't overdo it on the stars, use ~30 for slow computers and ~150 for fast computers.

Needs the latest Glut32.dll and the latest A3GLPlugin.dll. Place it in the same directory as the DLL and GLPluginUtils.au3.

TestWorld.au3

[size="4"]YOU SHALL NOT PARSE!![/size]
Link to comment
Share on other sites

Also, there is something I would like to note... With my globe, it gets it's radius from @DesktopHeight/3, and prevents zooming in further than the surface, but if you zoom out too far, the planet sort of passes through the boundary of the universe. Is there any way that this boundary can be expanded - so that if you zoom far enough, the planet is still a full sphere, not a part of a sphere.

This also happens with the advanced controls.

[size="4"]YOU SHALL NOT PARSE!![/size]
Link to comment
Share on other sites

here is my small controleable box :) the problem is that the camera won't follow the box correctly. (it should hover BEHIND the box, and turn with it so ur always behind it)

#include "GlPluginUtils.au3"
#Include <Misc.au3>
;hide icon!!!!!!
AutoItSetOption( "TrayIconHide", 1 )
dim $x=0
dim $y=10
dim $z=0
dim $eyex=100
dim $eyey=100
dim $eyez=100
dim $rotation=0
dim $speed=5
dim $pi = 3.14159265358979
dim $zforce=0
dim $jump = 1
DefineGlWindow( 400, 300, "Walk da box" )
SetClearColor( 0.5, 0.5, 0.5 )

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 )

_CreateCube( "Cube1", -30, 30, -30, 30, -30, 30 , 1, 0, 0, 1.0 )
TranslateObject( "Cube1", $x, $y, $z )

_CreateCube( "Cube2", -30, 30, -30, 30, -30, 30 , 0.4, 0.4, 1.0, 1.0 )
TranslateObject( "Cube2", 30, 60, 10)

_CreateCube( "Plate", -100, 100, -1, 100, -100, 1, 0, 1, 0, 1.0 )
_CreateCube( "Plate", 100, 100, -1, 300, -100, 1, 0, 0, 1, 1.0 )
TranslateObject( "Plate", 0, 0, 0)

SetCamera( 0, -100, 80, $x, $y, $z )

GlMainLoop( )

While 1
    sleep( 5 )
;Rotate box
    _movecam(40)
    SetCamera( $x, $y-400, $z+230, $x, $y, $z )
    RotateObject( "Cube1", 0, 0,$rotation)
    TranslateObject( "Cube1", $x, $y, $z+30 )
if WinActive ( "Walk da box") Then
    if _IsPressed("57") Then _move(-$speed);W
    if _IsPressed("53") Then _move($speed);s
    if _IsPressed("41") Then $rotation+=1;a
    if _IsPressed("44") Then $rotation-=1;D
    if _IsPressed("20") Then 
        if $jump = 1 Then
            $zforce=20
            $jump=0
        EndIf
    EndIf
    if _IsPressed("11") Then $z=-10;Ctrl
EndIf
    _CheckExit()
    _Forces()
Wend



Func _move($speedgo)
    $movex= -cos((2*$pi/360)*($rotation+90))*$speedgo
    $movey= -sin((2*$pi/360)*($rotation+90))*$speedgo
    $x +=$movex
    $y +=$movey
EndFunc

Func _movecam($distance)
    $movex= -cos((2*$pi/360)*($rotation+90))*$distance
    $movey= -sin((2*$pi/360)*($rotation+90))*$distance
    $eyex =$movex
    $eyey =$movey
EndFunc

Func _CheckExit()
    if not WinExists("Walk da box") then Exit
EndFunc
    
Func _Forces()
    $z+=$zforce
    $zforce-=1
    if $zforce<-10 then $zforce=-10
    if $z<=0 then 
        $zforce=0 
        $jump=1
    EndIf
EndFunc

UPDATE: i got a small work around for the camera, but it seems the camera doesn't autorotate to stay leveled. thats why my screen turned.

I also made the box moveable and jump able. autoit also stops nicely when u exit the window

Edited by zeroZshadow
*If u thought life couldn't get worse, u meet me *<guy> What would you give my little sister to unzip ?<friend> 10 bucks<guy> No, i mean like Winzip...
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...