Jump to content

OpenGl Plugin - Update 2007/08/31


A. Percy
 Share

Recommended Posts

  • Replies 166
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

AddGlSphere( Name, X, Y, Z, Radius, Slices, Stacks, Red, Green, Blue, Alpha )

X, Y, Z - position

Radius - radius of sphere

Slices - like longitude of Earth

Stacks - like latitude

Red, Green, Blue, Alpha - color

;)

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

Flying with AutoIt.

use your pointer keys.

NOTE: if you have Epilepsy, you should not play this.

CODE
#compiler_plugin_funcs=DefineGlWindow, SetClearColor, SetCamera, GlMainLoop, AddLine, AddTriangle, AddObject, RotateObject, TranslateObject, AddGlSphere

;AutoItSetOption( "TrayIconHide", 1 )

#include <GUIConstants.au3>

#include <misc.au3>

Global Const $TBS_REVERSED = 0x200

$handle = PluginOpen( @ScriptDir & "\Au3GlPlugin.dll" )

;--------------------------------------------------------------------------------------------

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

;--------------------------------------------------------------------------------------------

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

;--------------------------------------------------------------------------------------------

$title = "AutoIt OpenGl Experiment"

DefineGlWindow( @DesktopWidth, @DesktopHeight, $title )

SetCamera( 0, 0, 300, 0, 0, 0 )

SetClearColor( .02, 0, .02 )

AddObject( "a" )

AddObject( "b" )

AddObject( "c" )

AddObject( "d" )

AddTriangle( "a", -30, -20, -20, 30, -20, -20, 0, -20, 60, 0, 0, 1, 1, 0, 0, .2 );bottom

AddTriangle( "b", 0, 10, -20, 30, -20, -20, 0, -20, 60, 0, 0, 1, 0, 0, 1, .2 );left

AddTriangle( "c", -30, -20, -20, 0, 10, -20, 0, -20, 60, 0, 0, 1, 1, 2, 1, .2 );right

AddTriangle( "d", -30, -20, -20, 30, -20, -20, 0, 10, -20, 1, 0, 0, 0, 0, 0.1, .05 );back

TranslateObject( "a", 0, -30, 0 )

TranslateObject( "b", 0, -30, 0 )

TranslateObject( "c", 0, -30, 0 )

TranslateObject( "d", 0, -30, 0 )

;_CreateRect( "b", 0, 100, 0, .4, 50, 10, 100, 100, 30, 10 )

AddGlSphere( "e", 0, 0, 0, 10, 10, 10, 1.0, 0.4, 0.4, 1.0 )

TranslateObject( "f", -120, 0, 0 )

GlMainLoop( )

WinWait( $title )

WinSetState( $title, "", @SW_MAXIMIZE )

$y = 0

$x = 0

$up_down = 1

$left_right = 1

$X_Axis = 0

$Y_Axis = 0

$Z_Axis = 0

;RotateObject( "a", 0, 180, 0 )

;RotateObject( "b", 0, 180, 0 )

;RotateObject( "c", 0, 180, 0 )

;RotateObject( "d", 0, 180, 0 )

While 1

SetClearColor( Random(.0, .5), Random(.0, .5), Random(.0, .5) )

;$pos = WinGetPos( $title )

;$mouse = MouseGetPos()

;If WinActive( $title ) And $mouse[0] > $pos[0] And $mouse[0] < $pos [2] And $mouse[1] > $pos[1] And $mouse[1] < $pos [3] And _IsPressed("01") Then

; $X_Axis = $mouse[1]

; $Y_Axis = $mouse[0]

; ;TrayTip("", "X: " & $Y_Axis & @CRLF & "Y: " & $X_Axis, 1, 16 )

;EndIf

If Not WinExists( $title ) Then ExitLoop

If _IsPressed("25") Then

$X_Axis = $X_Axis - 1.3

move($X_Axis, $Y_Axis, $Z_Axis)

EndIf

If _IsPressed("26") Then

$Y_Axis = $Y_Axis + 1.3

move($X_Axis, $Y_Axis, $Z_Axis)

EndIf

If _IsPressed("27") Then

$X_Axis = $X_Axis + 1.3

move($X_Axis, $Y_Axis, $Z_Axis)

EndIf

If _IsPressed("28") Then

$Y_Axis = $Y_Axis - 1.3

move($X_Axis, $Y_Axis, $Z_Axis)

EndIf

;RotateObject( "e", 0, $Y_Axis*3, 0 )

;$Y_Axis = $Y_Axis + 2

;If $Y_Axis = 360 Then $Y_Axis = 0

;If $Y_Axis > 360 Then $Y_Axis = $Y_Axis - 360

Wend

PluginClose( $handle )

Func move($X_Axis, $Y_Axis, $Z_Axis)

TranslateObject( "a", $X_Axis, $Y_Axis, $Z_Axis )

TranslateObject( "b", $X_Axis, $Y_Axis, $Z_Axis )

TranslateObject( "c", $X_Axis, $Y_Axis, $Z_Axis )

TranslateObject( "d", $X_Axis, $Y_Axis, $Z_Axis )

EndFunc

Check out ConsultingJoe.com
Link to comment
Share on other sites

That was... insane! ;)

Try create a Star Wars game! :lmao:

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

That was... insane! ;)

Try create a Star Wars game! :lmao:

Thanks I would like to but I have to be able to edit the objects and delete them.

If there was a way to design the objects and have it write the code that would be cool, I could make it if I had those other commands.

Suggestions:

  • Object Edit
  • Object Delete
  • Object Create Object (For Guis)
  • Objects return object variables
  • Create Light/Reflection
I could think of a bunch more
Check out ConsultingJoe.com
Link to comment
Share on other sites

I have the same problem when trying examples from here.

I have it use the exit function when it is exiting, so if the window is gone it exits. or have it close process

But I also want to know how you made a sphere out of the triangles, what is the formula?

Edited by CyberZeroCool
Check out ConsultingJoe.com
Link to comment
Share on other sites

I just commented out line 88. Anyway nice example zerocool

My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.
Link to comment
Share on other sites

New update in 12/12/06

See first post!

And please, try sample2.au3 included with source code!

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

Thanks!

I will work now in lights management, so it will be a 3d engine.

We need make some UDFs with parser to load objects from file, some functions that creates polygons, functions documentation, etc...

And we need a colision system for games :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

Thanks!

I will work now in lights management, so it will be a 3d engine.

We need make some UDFs with parser to load objects from file, some functions that creates polygons, functions documentation, etc...

And we need a colision system for games :P

I am here to help, I could do some udfs for different shapes, I just need you to review them to make sure points are correct. Please give me the formula for the sphere though.

And yes we need events for shapes such as colision and mouse clicks, etc.

Thanks a lot

BTW: Cool new example, how do you map out your points when you are designing?

Edited by CyberZeroCool
Check out ConsultingJoe.com
Link to comment
Share on other sites

Thanks!

Well, the sphere... I did not "program" it. I used a glut function to do it. But if I need create in hand a sphere, I can calculate the vertex positions using ( Radius * sen( angle ) ) and ( Radius * cos( angle ) ) to obtain X and Y...

I will use it when create function to rotate camera and spot light.

For now we need to document all functions... The easy way is looking in source code. :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

BTW: Cool new example, how do you map out your points when you are designing?

Well... I map in my mind... This is a sequel of PovRay :P (www.povray.org)

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

Thanks!

Well, the sphere... I did not "program" it. I used a glut function to do it. But if I need create in hand a sphere, I can calculate the vertex positions using ( Radius * sen( angle ) ) and ( Radius * cos( angle ) ) to obtain X and Y...

I will use it when create function to rotate camera and spot light.

For now we need to document all functions... The easy way is looking in source code. :P

:">

Ok, thanks, I will make a few more UDFs and write up a help file in the next few days. thanks

BTW: I see you made DelObject, Thanks but would you make EditObject for triangles and spheres?

Edited by CyberZeroCool
Check out ConsultingJoe.com
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...