PDA

View Full Version : Can oxygen "alias" TB-Functions from other modules?



ReneMiner
24-07-2013, 18:05
To explain this it needs a little information:
Some may remember I made some 3d-editor to draw 3d-stuff. This stuff has to be saved somehow in a format so it can be loaded as fast as even possible - so save can take its time but loading has to be fast.
Now the TBGL-Entities don't have native methods except loading m15 to get filled with data from file. m15-format does not support materials so I won't stick to them.
The creating of a display-list in TBGL works through passing single values in a certain order and not just through a pointer to the loaded binary data. It looks similar to this:


TBGL_NewList xyz
TBGL_BeginPoly %GL_TRIANGLES
TBGL_Color 255, 255, 255
TBGL_TexCoord2D 0.000000, 0.000000
TBGL_Normal 0.000000, 1.000000, 0.000000
TBGL_Vertex -4.250000, 4.250000, -0.200000
'...
TBGL_TexCoord2D 1.000000, 0.000000
TBGL_EndPoly
TBGL_EndList

so its always a keyword (tbgl-function) followed by comma delimited numbers, how to deal with the variable xyz we know already ;)

My idea was to save the (3d-)data in the way it can be processed as fastest as possible from file - or string- without any further converting numbers nor looping through a bunch of data to sort them in - straightforward as one would type it in. And since oxygen can process stuff from string on the fly I wonder if there were a possibility that oxygen can call TB(GL)-Keywords and -functions - even if it means to save the keywords in the data prefixed in every line with somewhat like "send_to" or to list/declare all needed/used functions in advance before processing the data to install "the right connections"

I could imagine that would work only on non-core-functions - so maybe just on modules that are included through "uses". In doubt O2 should surely use its own functions if names are identical - or there could be a switch... So would be possible to use "Console_PrintL" or "File_Load" through oxygen-functions - and even TBGL_...

But in reality looks more like one had to declare all those needed functions from within oxygen at the current TB-pointer of the function inside TBGL-module for example...and since I have not found any method yet to get the function-pointers of a by tB loaded .dll I have no idea if it makes sense to think further into this direction.

So the final question: Could oxygen - i think in tB it's within the same process - use the functions of another currently loaded tB-module and how
- anyone ideas to this?

ReneMiner
24-07-2013, 19:39
Its not about this user-defined functions but those within some currently present .dll. Maybe call them methods or procedures or whatever - but if oxygen would know where they are to find it could call them - couldn't it? It just had to identify them once but thinCore.dll only delivers user-defined-script-functions but none of other loaded modules, I fear. And above those script-functions I have no idea what's going on nor how it works.

Charles Pegge
24-07-2013, 21:41
Hi Rene,

I know of no method of calling another module's functions directly. However, it is possible to perform Opengl functions directly from Oxygen, cooperatively with TBGL. One such example can be found in the new thinBasicOxygen zip: examples/graphical/psva10.o2bas

The flame particles are rendered directly from an Oxygen function, while TBGL provides the particle data.And conversely, the bellows is rendered by TBGL while the bellows geometry is dynamically controlled by Oxygen, sharing a vertex array buffer.

Oxygen can also share the opengl header files with TBGL.

Charles

ReneMiner
24-07-2013, 21:51
I thought there might be some way similar to Declare Set Address/At or a way to retrieve where tB has put these functions. But I am to new to oxygen to start it with this kind of stuff :D

Petr Schreiber
24-07-2013, 21:51
This could be the way - TBGL_NewList/TBGL_EndList called on TBGL side, and between these two call glBeginPoly, glColor, glVertex from compiled Oxy file.
Keep the high level goodies of TBGL, such as entity system not found in original OpenGL and the geodef with Oxygen. Why not :)


Petr