OpenGL in MacOS browser plugin

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

OpenGL in MacOS browser plugin

Joshua Gargus-2
Hi,


After failing with the latest subversion sources, I was finally successful in compiling a MacOS browser plugin based on the VMM38b4 sources.  However, I can't get OpenGL to work.  I've traced the problem to sqMacOpenGL.c.  The call to GetWindowGreatestAreaDevice() fails with an error code of -5600 ("Invalid Window Pointer").  I assume that this is because getSTWindow() doesn't work when Squeak is running in a browser plugin.

I hacked it by avoiding all the GDH stuff if we are in a browser, like so:

#ifdef BROWSERPLUGIN
swAttrib[2] = 32;
#else
#ifdef INTERNAL
    #if TARGET_API_MAC_CARBON
DPRINTF(5, (fp, "Getting GDH (Carbon):  %d\n", getSTWindow(), flags));
        stat = GetWindowGreatestAreaDevice(getSTWindow(),kWindowContentRgn,&tempGDH,&ignore); 
if (stat) DPRINTF(1, (fp, "ERROR: failed call to GetWindowGreatestAreaDevice (code: %d)\n", stat, flags));
    #else 
DPRINTF(5, (fp, "Getting GDH (non-Carbon)\n", flags));
        tempGDH = getDominateDevice(getSTWindow(),&ignore);
    #endif
        if (tempGDH == nil) {
DPRINTF(1, (fp, "ERROR: tempGDH is nil (whatever that means)\n", flags));
            return -1;
}
swAttrib[2] = (*(*tempGDH)->gdPMap)->pixelSize;
#else
swAttrib[2] = (*(*GetMainDevice())->gdPMap)->pixelSize;
#endif
if(swAttrib[2] < 16) swAttrib[2] = 16;
#endif


Obviously, this is crap, but I don't know the right thing to do.

Anyway, this allows me to successfully create an OpenGL context ("OpenGL newIn: aRect").  Adding an external FFI plugin to the  browser plugin directory lets me make OpenGL calls.  But something is still wrong: it seems like the OpenGL buffers are never swapped (although DPRINTF assures me that they are: "### Swapping renderer buffers"). 

I've had enough of this for tonight; I need some sleep.  But in the meantime, I'll take any advice I can get (eg: "stop working on that, the latest sources will do everything you need RSN").

Thanks,
Josh

Reply | Threaded
Open this post in threaded view
|

Re: OpenGL in MacOS browser plugin

johnmci
Well this has been all re-written in the 3.8.11 source.
Let me recompile things with openGL in the plugin with the current  
source and see what happens.

The reason why opengl was not in the plugin is because Internet  
Explorer would change the window port coordinates on each draw of a port
thus making it impossible to swap the openGL buffer into the right  
place on the window. However perhaps with Safari this problem is  
solvable.


On 18-Mar-06, at 10:34 PM, Josh Gargus wrote:

> Hi,
>
>
> After failing with the latest subversion sources,

> I've had enough of this for tonight; I need some sleep.  But in the  
> meantime, I'll take any advice I can get (eg: "stop working on  
> that, the latest sources will do everything you need RSN").
>
> Thanks,
> Josh
>

--
========================================================================
===
John M. McIntosh <[hidden email]> 1-800-477-2659
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
========================================================================
===