Hi,
Here are some news about raafal development.
I know raafal development is very slow, but as you may know, I'm doing it during my spare time and I would like - as much as possible - to make the right choices from the start and to keep things as simple and light as possible as well as as flexible and powerful as possible. This is not as simple as it sounds as I'm confronted to a lot of choices and possibilities. Yet I'm not really in a hurry, I prefer to take the time to do things properly. So far I've spent most of my time doing experiments and tests rather than actually coding raafal itself albeit the base of the framework is already in place.
That said, raafal will evolve more rapidly from now on as I've finally made final decisions about some key points of the framework:
1) OpenGL:
For a graphic oriented framework, hardware accelerated graphics is mandatory and PureBasic offers some options but not what's necessary to tackle professional applications. In fact, there is currently only one issue I've ranted a lot about already all over the forum but nothing changed so far on this matter: The ability to configure the OpenGL context creation, on all supported platform, so we can use Core OpenGL and its latest version where possible. I'm still puzzled why the OpenGLGadget does not offer such possibility but I've stopped asking myself why, it's like trying to discover the Meaning of Life and it drives me crazy.
To workaround this issue I've experimented and spent a lot of time with several known libraries, GLFW, FSML, SDL.. but I've stumbled on some very annoying issues especially regarding the "main loop" management, with interferences between PB one and the libraries one. Finally, and following the KISS principle (keep it simple..) I've gone back to the roots: using the PureBasic OpenGLGadget. To workaround the configuration issue, I'm now creating a custom OpenGL context that I "bind" to the OpenGLGadget window/view. Sound simple ? Well, as usual, it is dead simple *once you know how to do it* ! (especially in a cross-platform way). I've been stuck quite sometime on MacOSX with this, as I couldn't really find information about how to this with PureBasic.
Well, it is indeed dead simple once you know how to do it, here is the code for those interested:
Code: Select all
; ---[ Allocate Pixel Format Object ]---------------------------------
Protected pfo.NSOpenGLPixelFormat = CocoaMessage( 0, 0, "NSOpenGLPixelFormat alloc" )
; ---[ Set Pixel Format Attributes ]----------------------------------
Protected pfa.NSOpenGLPixelFormatAttribute
With pfa
\v[0] = #NSOpenGLPFAColorSize : \v[1] = 24
\v[2] = #NSOpenGLPFAAlphaSize : \v[3] = 8
\v[4] = #NSOpenGLPFAOpenGLProfile : \v[5] = #NSOpenGLProfileVersion3_2Core ; will give 4.1 version (or more recent) if available
\v[6] = #NSOpenGLPFADoubleBuffer
\v[7] = #NSOpenGLPFAAcceleratedCompute ; I also want OpenCL available
\v[8] = #Null
EndWith
; ---[ Choose Pixel Format ]------------------------------------------
CocoaMessage( 0, pfo, "initWithAttributes:", @pfa )
; ---[ Allocate OpenGL Context ]--------------------------------------
Protected ctx.NSOpenGLContext = CocoaMessage( 0, 0, "NSOpenGLContext alloc" )
; ---[ Create OpenGL Context ]----------------------------------------
CocoaMessage( 0, ctx, "initWithFormat:", pfo, "shareContext:", #Null )
; ---[ Associate Context With OpenGLGadget NSView ]-------------------
CocoaMessage( 0, ctx, "setView:", GadgetID(oglcanvas_gadget) ) ; oglcanvas_gadget is your OpenGLGadget#
; ---[ Set Current Context ]------------------------------------------
CocoaMessage( 0, ctx, "makeCurrentContext" )
; do your OpenGL drawing..
; ---[ Swap Buffers ]-------------------------------------------------
; CocoaMessage( 0, ctx, "flushBuffer" )
This code is extracted from the raafal code minus the error handling, it is supposed to be inside a Procedure (hence the use of "Protected").
For convenience in raafal, NSOpenGLPixelFormatAttribute is a hardcoded macro to a hardcoded fixed size structure..
Code: Select all
; ...[ array9_t ]......................................................
Structure array9_t
v.l[9]
EndStructure
; ...[ NSOpenGLPixelFormatAttribute ]...................................
Macro NSOpenGLPixelFormatAttribute
array9_t
EndMacro
; ...[ NSOpenGLPixelFormat ]............................................
Macro NSOpenGLPixelFormat
i
EndMacro
; ...[ NSOpenGLContext ]................................................
Macro NSOpenGLContext
i
EndMacro
As this issue is now solved, raafal GUI development is back on rails.
2) Scripting:
At first, I wanted to integrate the DAO scripting language into raafal. DAO was a very promising development, awesome language features, partly JIT accelerated. Unfortunately, its author decided to stop its development.. once I've been quite deep in integrating DAO with PureBasic.. So I've wasted a lot of time on this one, but the experience was very interesting. Finally I've decided to stick with a robust, well known and not soon to disappear scripting language
I've narrowed down my choice to two options: Python and Lua (LuaJIT in fact). Python is the industry standard in the CGI industry, you can find it in Blender, Maya, Nuke, etc.. in almost every graphic application. But I don't like Python
It's slow and heavy, you need a specific installation, yet I don't like its ident formatting that can lead to catastrophic failures. I'm still puzzled why it became the industry standard but I don't want to think about it anymore (Meaning of Life syndrome again..).
KISS !! Again, keep it simple - yet powerful - enter LuaJIT. LuaJIT is too awesome to ignore. It is super light to embed, even as a static library with PB, and it is the fastest scripting language in the world, period. Plus with the recent development of Terra (terralang), a Lua extension using LLVM as a back end, you can envision some awesome developments and performances. So be it, raafal will use LuaJIT, case closed.
Except that I'm now confronted to a silly issue.. On x64 Mac OSX (again..), LuaJIT requires the application embedding it or using it to be compiled with the following linker flags:
Code: Select all
-pagezero_size 10000 -image_base 100000000
I've tried to use the linker option file from the PureBasic IDE, so far unsuccessfully (here is the thread link:
http://www.purebasic.fr/english/viewtop ... 19&t=65866). If you can help on this one, you will be more than welcome !
There are other areas where choices have been made. On the data side and on the tasks side, but more on this in another post.
Thanks for your interest in this project,
Cheers,
Guy.