A problem with this sample code that I pointed out to Tim in that
forum thread is that the error check is returning the *last* error,
not necessarily an error triggered by the GL setup - quoting the MSDN
docs: "some functions set the last-error code to 0 on success and
others do not." So basically some other code or library or the RB
framework itself might leave non-fatal errors dangling.
A quick fix:
// check for errors
if pixHandle = 0 then
err = winGetLastError()
if err <> 0 then msgBox "Error " + str(err) + "bla bla..."
end if
I believe that sample code made the same mistake in other areas, e.g.
when creating/attaching the context.
Perhaps a more "proper" fix would involve a declare to SetLastError
to manual reset the the error message prior to using any Windows APIs
that use this error mechanism.
I'm not sure this has anything to do with OpenGL working in Parallels
3 however...
Frank.
<http://developer.chaoticbox.com/>
On 29-Jun-07, at 12:54 PM, Michael Diehr wrote:
> Solved the problem. Turns out I was failing to set the global
> variable hdc properly -- I was using win.WinHWND, when I should have
> been using winGetDC(win.Handle).
>
> I also changed the cDepthBits value to 24 in the createpixel format
> code, not sure if this matters or not.
>
> In any case, it now works in Parallels 3... :)
>
> FYI, there is a great windows OpenGL demo w/source code here:
> http://forums.realsoftware.com/viewtopic.php?t=9717
>
> -mike
>
> On Jun 29, 2007, at 9:12 AM, Michael Diehr wrote:
>
>> I just tried RB3D and agree that it doesn't work in Parallels 3.
>>
>> Here is the OpenGL code that fails on widows under parallels 2.5
>> and 3.
>> I'm using Open GL Declare Library 1.3.
>>
>> If TargetWin32
>> pixFmt = newMemoryBlock(40)
>> pixFmt.short(0) = pixFmt.size//WORD nSize;
>> pixFmt.short(2) = 1//WORD nVersion;
>> pixFmt.long(4) = PFD_DRAW_TO_WINDOW + PFD_SUPPORT_OPENGL +
>> PFD_DOUBLEBUFFER//DWORD dwFlags;
>> pixFmt.byte(8) = PFD_TYPE_RGBA//BYTE iPixelType;
>> pixFmt.byte(9) = 24//BYTE cColorBits;
>> //the following values are all ignored (cRedBits through
>> cAccumAlphaBits)
>> pixFmt.byte(10) = 0//BYTE cRedBits;
>> pixFmt.byte(11) = 0//BYTE cRedShift;
>> pixFmt.byte(12) = 0//BYTE cGreenBits;
>> pixFmt.byte(13) = 0//BYTE cGreenShift;
>> pixFmt.byte(14) = 0//BYTE cBlueBits;
>> pixFmt.byte(15) = 0//BYTE cBlueShift;
>> pixFmt.byte(16) = 0//BYTE cAlphaBits;
>> pixFmt.byte(17) = 0//BYTE cAlphaShift;
>> pixFmt.byte(18) = 0//BYTE cAccumBits;
>> pixFmt.byte(19) = 0//BYTE cAccumRedBits;
>> pixFmt.byte(20) = 0//BYTE cAccumGreenBits;
>> pixFmt.byte(21) = 0//BYTE cAccumBlueBits;
>> pixFmt.byte(22) = 0//BYTE cAccumAlphaBits;
>> //32 bit depth buffer
>> pixFmt.byte(23) = 32//BYTE cDepthBits;
>> pixFmt.byte(24) = 0//BYTE cStencilBits;
>> pixFmt.byte(25) = 0//BYTE cAuxBuffers;
>> pixFmt.byte(26) = 0//BYTE iLayerType;
>> pixFmt.byte(27) = 0//BYTE bReserved;
>> pixFmt.byte(28) = 0//DWORD dwLayerMask;
>> pixFmt.byte(32) = 0//DWORD dwVisibleMask;
>> pixFmt.byte(36) = 0//DWORD dwDamageMask;
>>
>> pixHandle = winChoosePixelFormat(hdc, pixFmt)
>>
>> //check for errors
>> err = winGetLastError()
>> if err <> 0 then
>> msgBox "Error " + str(err) + " when attempting to create the
>> pixel format..."
>> end if
>>
>>
>> The code fails with error 6. Maybe I'm using a pixel format that
>> Parallels doesn't support?
>>
>>
>>
>> On Jun 28, 2007, at 12:17 AM, Lundstrom Design wrote:
>>
>>> RB3D does not work in the current version of Parallels (3.0). Worked
>>> before, even though it was a bit slow. TouchCAD displays the window,
>>> but no objects. On the OpenGL side, VectorWorks 12.5 for Windows
>>> does
>>> not work, whereas a beta for a later version does work.
>>>
>>> /Claes Lundstrom
>>>
>>>
>>> 27 jun 2007 kl. 19.02 skrev Michael Diehr:
>>>
>>>> Anyone out there have any luck testing OpenGL apps in Parallels?
>>>> I've tried both Parallels 2.5 and 3.0 with Win XP SP2 and Vista,
>>>> and
>>>> although RB3D seems to work, I can't get straight OpenGL calls to
>>>> work. I get errors in the CreatePixelFormat step, and subsequent
>>>> steps fail as well. This is using the OpenGL 1.3 libraries.
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>
|