<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small;color:rgb(0,0,0)"><span style="font-family:Arial,Helvetica,sans-serif;color:rgb(34,34,34)">On Mon, Oct 29, 2018 at 5:49 PM tim Rowledge <<a href="mailto:tim@rowledge.org">tim@rowledge.org</a>> wrote:</span><br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><br>
<br>
> On 2018-10-29, at 12:26 PM, Bert Freudenberg <<a href="mailto:bert@freudenbergs.de" target="_blank">bert@freudenbergs.de</a>> wrote:<br>
> <br>
> On Sat, Oct 27, 2018 at 4:42 PM tim Rowledge <<a href="mailto:tim@rowledge.org" target="_blank">tim@rowledge.org</a>> wrote:<br>
> Trying this out on a Raspberry Pi (obviously). <br>
> First major problem is that <br>
> <br>
> OGLUnix>>openGLLibraryName<br>
>         ^Smalltalk osVersion = 'linux'<br>
>                 ifTrue: ['libGL.so.1']<br>
>                 ifFalse: ['GL']<br>
<br>
It's actually a bit worse - the osVersion returned by Raspbian is 'linux-gnu' - so I tried changing that to <br>
openGLLibraryName<br>
        ^(Smalltalk osVersion beginsWith: 'linux')<br>
                ifTrue: ['libGL.so.1']<br>
                ifFalse: ['GL']<br>
which got a bit further.<br>
<br>
> has a #'' (apparently a ByteSymbol with just char value 0 in it) at the end of the method ; which of course a BlockClosure does not understand.<br>
> <br>
[snip]<br>
> <br>
> The" module: '#openGLLibraryName'>" looks a bit odd to me... shouldn't that have been recompiled to use the real library name?<br>
> <br>
> Yes, but it doesn't change the source code. Follow the senders of openGLLibraryName to see the magic.<br>
<br>
OK, so it's supposed to send #openGLLibraryName at some startup point. Very clever. </blockquote><div><br></div><div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small;color:rgb(0,0,0)">Yep, in OpenGL>>initialize it calls "self privateInstallLibrary: self openGLLibraryName." which patches the library name into all compiled FFI methods.</div></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">Unfortunately it appears something else goes wrong pretty quickly and OGLExtManager>>#loadExtension: uses glExtGetProcAddress: which even decompiled says <br>
        <cdecl: ulong 'glXGetProcAddressARB' (char*) module: 'GL'><br>
Which doesn't seem right. Should it also use the #openGLLibraryName thing?<br>
</blockquote><div><br></div><div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small;color:rgb(0,0,0)">Ah, that seems to be an actual bug.</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small;color:rgb(0,0,0)"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small;color:rgb(0,0,0)">#privateInstallLibrary: does not go into the subclasses. In OGLWin32, that method has the correct 'opengl32.dll'  module.  OGLMacOSX uses a different mechanism entirely. And OGLUnix relies on "GL" linking to the right thing. </div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small;color:rgb(0,0,0)"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small;color:rgb(0,0,0)">So I'd say in privateInstallLibrary: we need to patch both OpenGL and OGLUnix.</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small;color:rgb(0,0,0)"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small;color:rgb(0,0,0)">- Bert -</div><br></div><div> </div></div></div></div></div></div></div></div></div></div></div>