Search code examples
openglsmalltalkpharo

Does NBOpenGL really worth the effort?


Ok so I tried to learn Opengl ES 2 (and opengl 4) during my eastern vacation because I realised that I dont really need Athens or vector graphics for my GUI, since I will be dealing mostly with 3d graphics anyway. (My project "Ephestos" will be an effort of creating a 3d app for pharo, see also "blender")

So when I tried to run the demos I get an error with

NBMacGLContextDriver>>supportsCurrentPlatform
    "obviously, for Mac intel-32 only :)"
    ^ NativeBoost platformId = NativeBoostConstants mac32PlaformId

My mac is "obviously" not 32-bit but 64 bit, but I dont know if that matters since pharo is only 32 bit anyway. The bug is also obvious, it should be mac32PlatformId and not mac32PlaformId.

I correct and proceed and gives me a new error this time in

NBMacGlApi>>glApiCall: fnSpec index: fnIndex attributes: attributes context: contextToRetry

    ^[
        (NBCallFailureHandler for: contextToRetry) retryWith: [ :targetClass :targetMethod |
            (NBFFICallout
                targetClass: targetClass targetMethod: targetMethod fnSpec: fnSpec)
                stdcall;
                generate: [ :gen | self emitCall: fnIndex generator: gen ]
        ]
    ] on: NBNativeCodeError do: [:err :handler |
        err errorCode = ErrorFnNotAvailable ifTrue: [
            "Native code is installed, but function pointer not loaded yet.
            Try to load function and retry the call"  
            (self tryGetFunctionPointer: (self class glFunctions at: fnIndex)) ifFalse: [ ^ err pass ].
            ^ handler retrySend
            ].
        err pass      
    ]

The problem here is that NBCallFailureHandler is nowhere to be found. At first I thought my NB was lagging behind in version so I download the latest Configuration from smalltalk Hub and did

ConfigurationOfNativeboost loadStable.

it updated without errors but still that class is nowhere to be found.

So my question is this, does it really worth it to struggle with NBOpengl or will it better to learn how Nativeboost works and use Opengl myself ?


Solution

  • I would say yes. NBOpenGL is a pre-made wrapper to OpenGL using NativeBoost, so it saves you time by providing something that you will need to do manually otherwise. Better to spend some time fixing a configuration than spend a lot of time re-doing the binding.