View Full Version : Using Oxygen with TBGL
Charles Pegge
31-03-2009, 00:52
Dynamically generated objects - These are built in vertex arrays instead of GL lists. So they can be morphed on-the-fly.
Examples of the day can be found in O2H_TBGL.zip on the download page
To be used with the latest O2 Compiler
http://community.thinbasic.com/index.php?topic=2517.0
Charles, pretty amazing stuff, thanks.
I bumped up the Vertices to 72,000 and still got nice frame rates and very nice smooth rotation and scaling with the mouse!!
Petr Schreiber
31-03-2009, 10:46
Very nice demo Charles,
the power of o2h rises with every day :)
Petr
Charles Pegge
31-03-2009, 16:35
Thank you both!
Now, I seem to have hit an obstacle - can't get access to Normal Pointers to accompany Vertex Pointers. I see that you do not include this in the gl library, Petr but trying to declare glNormalPointer does not remedy the situation so I must assume that the standard Opengl32.dll for XP does not support it.
This means providing a client side lighting system. :shock: Now there's a challenge..
Petr Schreiber
31-03-2009, 21:44
Hehe,
that would be one way ( and little ghost in my mind says ... go shader only path ... go shader only path ).
But ... glNormalPointer is OpenGL 1.1 - I use it in TBGL, so there could be other problem.
Try to use this script, it shows glNormalPointer for me:
uses "EXE", "Console", "OS", "File"
printl OS_GetWindowsDir+"system32\OpenGL32.dll"
dim exports as string = EXE_PE_GetExportList( OS_GetWindowsDir+"system32\OpenGL32.dll", $CRLF )
printl exports
file_save("OpenGL_Exports.txt", exports)
waitkey
Petr
Charles Pegge
31-03-2009, 23:02
Yes I see the parameters for GLNormalPointer are less than for glVertexPointer - so my torus looks nice and solid now. And I will not be venturing down the Shader path just yet. Thank you Petr.
Charles
Charles Pegge
01-04-2009, 08:13
I cannot think of a fitting name for this object, but it is produced by warping a torus with some of the calculations.
Demo psva7 in O2H_TBGL.zip
http://community.thinbasic.com/index.php?topic=2517.0
Petr Schreiber
01-04-2009, 09:21
Good looking object,
with little modifications of base torus coordinates lot of monsters can be produced :)
Petr
Charles Pegge
01-04-2009, 20:32
Here the fire texture has been used to decorate the torus, giving the illusion of corrugation - like a bellows.
Demo psva8 in O2H_TBGL.zip
http://community.thinbasic.com/index.php?topic=2517.0
Petr Schreiber
01-04-2009, 22:18
Nice look :)
It looks like it is alive, that is a neat effect. Like it is breathing and blowing out Fire... A Torus Dragon.
Charles Pegge
02-04-2009, 23:27
A small refinement makes it possible to perform low level Opengl entirely within Oxygen compiled code, while maintaining operability with TBGL. Opengl must not be freed when Oxygen terminates - as would normally occur with the `terminate` command. If this happens a GPF will occur at the end of the program.
To resolve this I've unbundled terminate into freelibs, freestrings and freestatics.
So it is now possible to omit freelibs from the usual termination sequence.
sub finish() at #p0
'
'terminate ' STANDARD TERMINATION
'
'SPECIAL TERMINATE WHEN SHARING OPENGL WITH THINBASIC
'
'freelibs ' EXCLUDED
freestrings
freestatics
end sub
This means we can run lengthy Opengl procedures at full wack in O2H and still have access to all the goodies in TBGL. :)
Charles
PS: This is demonstrated in PSVA9 but looks essentially the same as the PSVA8 Bellows above.
This is really great to hear about Charles. Thanks.
I like the cool looking comments too, very artistic!
Charles Pegge
03-04-2009, 07:37
Thanks Kent,
I find the commented graffiti makes a HUGE difference in being able to navigate long listings, and also helps to conceptualise what the code is doing.
#####
# #
# O = #
# ! #
# -- #
#####
###
Charles