OpenGL in MacOS browser plugin

Josh Gargus schwa at fastmail.us
Sun Mar 19 06:34:06 UTC 2006


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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20060319/afca38b6/attachment.htm


More information about the Vm-dev mailing list