Jump to content

OpenGL


 Share

Recommended Posts

Since struggling with writing some OpenGL stuff in autoit due to the fact of me being newish to the whole programming game and the fact that I really don't have a clue on how to write or use plugins, I thought I would share some of my code I have made that demonstrates using OpenGL with purely autoit and dll calls directly with opengl32 and glu32. I have made a start writing a GLConstants.au3 and GLFunctions.au3 files that I think should be a standard library by now in the Autoit Include folder. Any feedback would be nice

Right clicking on the GUI moves the Camera around (while holding), w and s moves forward/backward and a and d spins left and right. Enjoy ;)

GLConstants.au3

GLFunctions.au3

3D Viewport.au3

Link to comment
Share on other sites

Seems vry advanced

Thnx :D

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Link to comment
Share on other sites

Been hard at work and got a few more functions and features down. Added smoothed points so they appear as circles, put a line stipple on which gives a dashed appearence to lines, but the main feature I have got working is the VertexArrays features which enable editing of Vertices on the fly. This can also be used for colour, surface normals, texture coordinates, and such, but at the moment only I have only put an example of Vertex Coordinate editing. Just to warn I have not been adding error checking.

I have been writing a basic model editing program for quite a while and have been avoiding tackling OpenGL. Unfortunatley you are limited with GDI+ as it is so slow., just a few hundred vertices and you are looking at seconds per frame, not frames per second. When I was adding and debugging the VertexArray functions I tested a structure of 1 million float variables which would allocate 333,333 vertices and frames per second are still great.

I will update the GLFunctions/Constants files above and add the new examples. I have started to add a few more lines in to explain but I'm mainly researching and testing things out when I get the time, which is limited with a baby in the house. My next area of investigation is going to be tackling how to selected a vertex, or picking as it's known. Im not sure how or if it can be done while using VertexArray but I'm guessing it can.

1M verts test.au3

Vertex Array Animation.au3

Not sure how to edit my first post so I will add the functions and constants below...

;DataType enum:
Global Const $GL_BYTE        = 0x1400
Global Const $GL_UNSIGNED_BYTE     = 0x1401
Global Const $GL_SHORT       = 0x1402
Global Const $GL_UNSIGNED_SHORT    = 0x1403
Global Const $GL_INT         = 0x1404
Global Const $GL_UNSIGNED_INT      = 0x1405
Global Const $GL_FLOAT       = 0x1406
Global Const $GL_2_BYTES        = 0x1407
Global Const $GL_3_BYTES        = 0x1408
Global Const $GL_4_BYTES        = 0x1409
Global Const $GL_DOUBLE      = 0x140A
Global Const $GL_DOUBLE_EXT     = 0x140A

Func GLDisableClientState($iCap)
DllCall($hOPENGL32, "none", "glDisableClientState", "uint", $iCap)
EndFunc   ;==>GLDisableClientState
Func GLEnableClientState($iCap)
DllCall($hOPENGL32, "none", "glEnableClientState", "uint", $iCap)
EndFunc
Func GLDrawArrays($iMode, $iFirst, $iCount)
DllCall($hOPENGL32, "none", "glDrawArrays", "uint", $iMode, "uint", $iFirst, "uint", $iCount)
EndFunc   ;==>GLDrawArrays
Func GLVertexPointer($iSize, $iType, $iStride, $aPtr)
DllCall($hOPENGL32, "none", "glVertexPointer", "uint", $iSize, "uint", $iType, "int", $iStride, "ptr", $aPtr)
EndFunc
Func GLLineStipple($iFactor, $iPattern)
DllCall($hOPENGL32, "none", "glLineStipple", "int", $iFactor, "ushort", $iPattern)
EndFunc   ;==>GLLineStipple
Func GLLineWidth($fWidth)
DllCall($hOPENGL32, "none", "glLineWidth", "float", $fWidth)
EndFunc   ;==>GLLineWidth
Func GLPolygonStipple($iMask)
DllCall($hOPENGL32, "none", "glPolygonStipple", "ubyte*", $iMask)
EndFunc   ;==>GLPolygonStipple
Edited by WesleyThomas
Link to comment
Share on other sites

  • 4 months later...

These Code is for look up and look down. :)

If _IsPressed(51) Then;if q is pressed rotate cam up

$RotPos[1] += 10

EndIf

If _IsPressed(45) Then;if e is pressed rotate cam down

$RotPos[1] -= 10

EndIf

Hoping that someday autoit can rendered a 3d models made from 3dsmax and maya

:)

Edited by RZLucian0127
Link to comment
Share on other sites

@RZLucian0127, you can try to handle them with "au3irrlicht 2"

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
Link to comment
Share on other sites

  • 4 weeks later...

The idea of this project was to use Autoit to access OpenGL directly with no intermediate plugin. I have been away for a while but plan to carry on with this. If nothing else this is a great way to learn OpenGL and understand how the graphics pipeline works without having all the hard work done in a plugin. I have already made many improvements. This is my first experience with graphics and I am happy where it is heading with the little programming experience I have being a self taught hobbiest

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

×
×
  • Create New...