Jump to content

OpenGl Plugin - Update 2007/08/31


A. Percy
 Share

Recommended Posts

Hello.

In the last 3 weeks I had working in a interesting experiment with OpenGl and I created this little plugin.

It is just an experiment. Please, make sure you have glut32.dll in your system.

The project have texture support now, implemented by EFF. To use textured version, you need glaux.dll on your system.

Glut32 and Glaux can be found here.

This project is open for any contribution, modifications of any kind. Is public! But please, if you expand it in any way, share with us!

List of Functions:

-Initializing:
CreateGlWindow( Width, Heigh, "WinTitle" )
SetClearColor( Red, Green, Blue )

-Manage Lights: LightNumber can be 0 to 7
CreateLight( LightNumber, X, Y, Z )
SetLightAmbient( LightNumber, Red, Green, Blue )
SetLightDiffuse( LightNumber, Red, Green, Blue )
SetLightSpecular( LightNumber, Red, Green, Blue )
SetLightPosition( LightNumber, X, Y, Z )

-Manage Camera:
SetCamera( EyeX, EyeY, EyeZ, TargetX, TargetY, TargetZ )
SetCameraUp( X, Y, Z )
SetCameraView( Near, Far )

-Show:
SceneDraw( )

-Manage Objects:
AddObject( ObjectName )
DelObject( ObjectName )
TranslateObject( ObjectName, X, Y, Z )
RotateObject( ObjectName, X, Y, Z )
ScaleObject( ObjectName, X, Y, Z )

-Manage Groups: Groups can contain Objects and another Groups
CreateGroup( GroupName )
SetToGroup( GroupName, Object/GroupName )
TranslateGroup( GroupName, X, Y, Z )
RotateGroup( GroupName, X, Y, Z )
ShowGroup( GroupName )
HideGroup( GroupName )
DeleteGroup( GroupName )

-Add Poligons:
AddLine( ObjectName, Xv1, Yv1, Zv1, Xv2, Yv2, Zv2, Red, Green, Blue, Alpha )
AddTriangle( ObjectName, Xv1, Yv1, Zv1, Xv2, Yv2, Zv2, Xv3, Yv3, Zv3, Xn, Yn, Zn, Red, Green, Blue, Alpha )
AddQuad( ObjectName, Xv1, Yv1, Zv1, Xv2, Yv2, Zv2, Xv3, Yv3, Zv3, Xv4, Yv4, Zv4, Xn, Yn, Zn, Red, Green, Blue, Alpha )
AddGlSphere( ObjectName, X, Y, Z, Radius, Slices, Stacks, Red, Green, Blue, Alpha )
AddGlCylinder( ObjectName, X, Y, Z, Radius1, Radius2, Height, Slices, Stacks, Red, Green, Blue, Alpha )
AddGlStrokeChar( ObjectName, X, Y, Z, Red, Green, Blue, AsciiCode )

-Manage Textures:
SetTextureBuffer( NumberTextures )
AddTexture( textureID, TexturePath )
BindTexture( objName, TextureName )
SetTextureMode( )

A blank sample:

#include "GlPluginUtils.au3"

;hide icon!!!!!!
AutoItSetOption( "TrayIconHide", 1 )
$Title = "Sample"
DefineGlWindow( 800, 600, $Title )
SetClearColor( 0.1, 0.1, 0.1 )

CreateLight( 0, 600, 1000, 600 )
SetLightAmbient( 0, 0.2, 0.2, 0.2 )
SetLightDiffuse( 0, 0.7, 0.7, 0.7 )
SetLightSpecular( 0, 0, 0, 0 )

;... make some objects...

SetCamera( 0, 60, 300, 0, 30, 0 )

Opt( "WinTitleMatchMode", 3 )
WinWait( $Title )
$CheckWindowTimer = TimerInit( )
While 1
    SceneDraw( )
    sleep( 10 )
    ;...post your animation code here...
    
    ;check if window exist... (using a timer to reduce CPU usage by WinExists function)
    If TimerDiff( $CheckWindowTimer ) > 1000 Then
        If WinExists( $Title ) = 0 Then ExitLoop
        $CheckWindowTimer = TimerInit( )
    EndIf
Wend

Comments will be welcome.

Bye!

PS: Requires a graphics card that supports OpenGL (Intergrated Chipsets not recommended).

--------------------------------------

UPDATED - 31/Aug/2007

--------------------------------------

Added function:

AddPartialDisk( Name, X, Y, Z, Radius1, Radius2, Slices, Stacks, StartAngle, SweepAngle, Red, Green, Blue, Alpha )

Fixed texture "bug". Now it works with textures in any size.

--------------------------------------

UPDATED - 18/Sep/2007

--------------------------------------

deprecated...

T2 is the current version

Details here.

--------------------------------------

UPDATED - 29/Aug/2007

--------------------------------------

>> Removed functions:

SetFPS

GlMainLoop

>> Added command:

SceneDraw( )

- now you control animation loop inside autoit...

- no more "racing condition" while working in some animations

>> Now Cylinder have 2 sides.

--------------------------------------

UPDATED - 23/Aug/2007

--------------------------------------

DeleteGroups fixed

Some improvements

--------------------------------------

UPDATED - 22/Aug/2007

--------------------------------------

Now texture works on quads, triangles, spheres and cylinders (new)

New Functions:

AddGlCylinder( ObjectName, X, Y, Z, Radius1, Radius2, Height, Slices, Stacks, Red, Green, Blue, Alpha )

Removed Function:

AddGlCone( ObjectName, X, Y, Z, Radius, Height, Slices, Stacks, Red, Green, Blue, Alpha ) - deprecated by AddGlCylinder

--------------------------------------

UPDATED - 20/Aug/2007

--------------------------------------

New Functions:

ShowGroup( GroupName )

HideGroup( GroupName )

DeleteGroup( GroupName )

--------------------------------------

UPDATED - 10/Aug/2007

--------------------------------------

Bug fix on SetFPS

New Functions:

AddGlStrokeChar( Name, X, Y, Z, Red, Green, Blue, AsciiCode )

ScaleObject( Name, X, Y, Z )

--------------------------------------

UPDATED - 07/Aug/2007

--------------------------------------

Bug fix - no more flick in some machines

--------------------------------------

UPDATED - 25/Apr/2007

--------------------------------------

Texture bug that allows only one texture to be used was fixed. Now it can be used with any number of textures.

Modifications:

Function TextureMode can be used with one parameter - 0 (default) that turns texture mode without other colour. Or 1, textures will be combined with object colour.

--------------------------------------

UPDATED - 20/Apr/2007

--------------------------------------

EFF has added texture functions ;)

It needs "glaux.dll" to work.

--------------------------------------

UPDATED - 16/Apr/2007

--------------------------------------

Cone bug fixed - thanks EFF

--------------------------------------

UPDATED - 22/Jan/2007 - r2

--------------------------------------

Bug related SetFPS function fixed

--------------------------------------

UPDATED - 22/Jan/2007

--------------------------------------

New functions:

SetFPS( Frequency )

Sets animation frequency per second

--------------------------------------

UPDATED - 11/Jan/2007

--------------------------------------

New functions:

SetCameraView( Near, Far ); - made to Pa Callender (I think that it will be usefull for you)

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

Now I'm planning to add textures. Give me time...

--------------------------------------

UPDATED - 05/Jan/2007

--------------------------------------

New function: SetLightPosition( LightNumber, X, Y, Z )

Some refactory in code.

--------------------------------------

UPDATED - 25/Dec/2006

--------------------------------------

Now using GL_CULL_FACE: means that any polygon have only one face (now the polygon vertexes needs be placed clockwise - examples was updated )

--------------------------------------

UPDATED - 23/Dec/2006

--------------------------------------

Added functions:

CreateLight( Number, X, Y, Z ) -> important: for while, it's working only with Const Lights

SetLightAmbient( LightNumber, Red, Green, Blue )

SetLightDiffuse( LightNumber, Red, Green, Blue )

SetLightSpecular( LightNumber, Red, Green, Blue )

Modifications:

Only internal improvements.

--------------------------------------

UPDATED - 12/Dec/2006

--------------------------------------

Added functions:

DelObject( Name )

CreateGroup( Name ) ;yes, for now you can group objects

SetToGroup( GroupName, Object ) ; insert object into group, or group into group (recursive)

TranslateGroup

RotateGroup

Please, see file Sample2.au3 inside zip file.

Modifications:

All modifications was internal. Now objects and groups works in a linked list. New file with mesh class.

--------------------------------------

UPDATED - 08/Dec/2006

--------------------------------------

Added function:

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

Now Alpha blending is working!

--------------------------------------

UPDATED - 07/Dec/2006

--------------------------------------

For now is possible add lines into objects -

AddLine( $Name, $Source_X, $Source_Y, $Source_Z, $Dest_X, $Dest_Y, $Dest_Z, $Red, $Green, $Blue )

Modified:

RotateObject was modified - Now only rotate objects across it's axis.

--------------------------------------

Posted Image

Download:

With texture support:

- total downloads from very old versions: 416

- all versions can be found here

Without texture (discontinued):

Last: Au3GlPlugin_2007_04_16.zip

Old: +147 downloads...

source + compiled dll

Used IDE: Code::Blocks

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

  • Replies 166
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

This is great! Any chance you could provide source code so that folks (like myself) can help you debug/expand the plugin?

-S

(Yet Another) ExcelCOM UDF"A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly...[indent]...specialization is for insects." - R. A. Heinlein[/indent]
Link to comment
Share on other sites

Hello.

In the last 3 weeks I had working in a interesting experiment with OpenGl and I created this little plugin.

It is just an experiment. Please, make sure you have glut32.dll in your system.

Comments will be welcome.

Bye!

Could you please post a link to glut32.dll.

EDIT: Btw, would you mind to post the plugin source code?

Cheers

Kurt

Edited by /dev/null

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Link to comment
Share on other sites

The errors are due to the fact that the functions in his plugin are not known by SciTE. Just "continue anyway" on the errors and it'll work.

The AutoIt script doesn't close out properly, though - he needs to add an Exit handler to it.

You can get glut32.dll here: http://www.dll-files.com/dllindex/dll-files.shtml?glut32

-S

Edited by Locodarwin
(Yet Another) ExcelCOM UDF"A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly...[indent]...specialization is for insects." - R. A. Heinlein[/indent]
Link to comment
Share on other sites

The AutoIt script doesn't close out properly, though - he needs to add an Exit handler to it.

right, after the window get's closed AutoIT.exe will consume 99% CPU time.

Actually I figured out, that Ruby (http://www.ruby-lang.org) installed a glut32.dll on my system :-)

Cheers

Kurt

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Link to comment
Share on other sites

This is great! Any chance you could provide source code so that folks (like myself) can help you debug/expand the plugin?

-S

Ok! The source code is now in first post.

I'm planning to add a "light manager" class and many other things. If you have any idea, implement it!

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

Ok! The source code is now in first post.

I'm planning to add a "light manager" class and many other things. If you have any idea, implement it!

Thanks!

Cheers

Kurt

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Link to comment
Share on other sites

Very nice effects indeed. It does seem quite difficult though ;)

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

This is cool.

Do you have the parameters for the plugin? are there other objects such as spheres?

Thanks! ;)

For while we have only triangles for tests, cause it's ease to implement, but I'm thinking implement other object types.

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

how do you move things, change colors, and rotate once it is started?

is there a help file

I didn't create a help file cause it's just an experiment, but I will explain how it works:

I can create objects any time!

To create an object, it's necessary declare it:

AddObject( "MyObject" )
oÝ÷ Ùh^*.®ãyË^Æ+-³*.q©ÚuÛ(ëk©àëºÚ"µÍYX[ÛJ   ][ÝÓ^SØXÝ   ][ÝË  ÌÍÕVÌK  ÌÍÕVÌWK ÌÍÕVÌK  ÌÍÕÌK   ÌÍÕÌWK  ÌÍÕÌK   ÌÍÕÖÌK ÌÍÕÖÌWK    ÌÍÕÖÌK ÌÍÓÜX[ÌK   ÌÍÓÜX[ÌWK  ÌÍÓÜX[ÌK   ÌÍÔY ÌÍÑÜY[  ÌÍÐYK    ÌÍÐ[H
BoÝ÷ Ù8b±û§rبwv̨º·^rV«jס¸ÞrÛa­ç¯z»^Åú+¶¸   ^]mçb­ç-è~«¨¶z+©jº_iÇÛayÊ%¢´F'{¦¦WßÛÞr·µç@uÔë©àá1q«¬z+wöÇ(û¬¬¶¬x]N¸    ^jëh×6
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
oÝ÷ Ù8^WîËb¢v®¶­s` Æö6Âb33cµc³5ÒÒ²ÓÂÓÂÓÐ Æö6Âb33cµc%³5ÒÒ²ÂÓÂÓÐ Æö6Âb33cµc5³5ÒÒ²ÂÂÓÐ  Æö6Âb33c´æ÷&Öų5ÒÒ²ÂÂÐ  ôFEG&ævÆTWgV÷C´×ö&¦V7BgV÷C²Âb33cµcÂb33cµc"Âb33cµc2Âb33c´æ÷&ÖÂÂãBÂãÂãBÂãoÝ÷ Ùg¥ÈÁ©í®Zµæ§¡¸ÞrØî²×V®¶­s`¥&÷FFTö&¦V7BgV÷C´×ö&¦V7BgV÷C²ÂÂ#ÂoÝ÷ Ø    ݶ¶§²V­z+ZºÚ"µÍ[Û]SØXÝ
    ][ÝÓ^SØXÝ   ][ÝËMH
B

;)

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 are there any other objects? and how do you change the xy of an existing object? and can we get the source?

For while we don't have any other type of objects, and we need create others using triangles. To change xy, use TranslateObject. The source is in first post! ;)

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

and is there commands like: _DeleteCube() OR _EditCube()?

No... ;)

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

oh, if we had those two we could make some sweet games. is there an easy way to add pipes or lines?

Thanks

No, but it's a good idea. This will be usefull. 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

One more thing, Can you tell me what Vars are what in the functions such as:

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

RotateObject( "Cube2", 10, -20, 0 )

TranslateObject( "Cube2", -40, 40, -10 )

and is there a way to create an opengl object in autoit like objcreate()

Thanks

Edited by www.CyberZeroCool.com
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...