Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Thu Nov 14, 2019 4:20 pm
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Bug with OpenGLsurface
PostPosted: Wed Sep 28, 2011 8:02 pm 
Offline

Joined: Tue Dec 05, 2006 8:35 am
Posts: 37
Location: England
Hi - I've been experimenting with OpenGLSurface and find that it has a bug up to 2011r3 (Windows). If you move the OpenGLSurface away from the left edge of the window, the viewport is clipped to the right (see below using the FluidsDemo).

This can be solved by forcing the viewpoint using OpenGL.glViewport(0,0,me.width,me.height) at the beginning of a render.

The MouseDown and MouseDrag (not MouseMove) events return X,Y values that are also messed up; they return values relative to the Window and not the OpenGLSurface (Only when the OpenGLSurface is offset into the window).

Image


Top
 Profile  
Reply with quote  
 Post subject: Re: Bug with OpenGLsurface
PostPosted: Thu Sep 29, 2011 12:28 am 
Offline
Real Software Engineer

Joined: Fri Jan 28, 2011 5:24 pm
Posts: 145
The first issue I'm aware of and has been fixed in a future release. The second issue is not something I've heard about, so it'd be great if you could file a Feedback ticket so we can go about getting it fixed.

_________________
Joe Ranieri
Mac Frameworks & Compiler
REAL Software, Inc.


Top
 Profile  
Reply with quote  
 Post subject: Re: Bug with OpenGLsurface
PostPosted: Thu Sep 29, 2011 3:40 am 
Offline

Joined: Tue Dec 05, 2006 8:35 am
Posts: 37
Location: England
OK, here's a more comprehensive set of bugs that demonstrate problems more fully;

One OpenGLSurface, offset with mouse button X,Y values (MouseMove and MouseWheel are OK):
Image

Two OpenGLSurfaces ... textures just disappear! (Second surface only had a glClearColor in the render - simply add another surface will cause the problem):
Image

... Thanks Joe for all your help via Feedback although I still couldn't get the textures working with multiple OpenGLSurface's - I tried used glTextureBind in the render loop (as in the code submitted with Feedback) but I must be missing something??


Top
 Profile  
Reply with quote  
 Post subject: Re: Bug with OpenGLsurface
PostPosted: Wed Feb 01, 2012 5:49 am 
Offline

Joined: Fri Nov 06, 2009 5:20 am
Posts: 11
I gave up on OpenGLSurface a long time ago and hand coded my own AGL and WGL over a canvas control. However, with the oncoming of Cocoa, AGL is no longer an option. So for the past couple of weeks, I've been trying once again to make OpenGLSurface work so that I can compile in Cocoa mode. For the most part, I have been successful. However, the 'MouseWheel' event needs some more work. It seems to be returning X/Y of the parent window rather than the control. It can also get stuck in an endless firing loop where I have to kill the application to regain control. So for now, I remain stuck in Carbon/AGL if I want my OpenGL app to work. Any help or guidance would be greatly appreciated!!!

Someone needs to seriously improve the documentation of OpenGLSurface as well. There is basically nothing on the Configure event, and every time I try to configure an attrib array, it crashes. Below is my 'Configure' event code. I realize that the color bits and the depth bits can be set in the IDE, the alpha depth cannot.

Const NSOpenGLPFAAllRenderers          =   1
Const NSOpenGLPFADoubleBuffer = 5
Const NSOpenGLPFAStereo = 6
Const NSOpenGLPFAAuxBuffers = 7
Const NSOpenGLPFAColorSize = 8
Const NSOpenGLPFAAlphaSize = 11
Const NSOpenGLPFADepthSize = 12
Const NSOpenGLPFAStencilSize = 13
Const NSOpenGLPFAAccumSize = 14
Const NSOpenGLPFAMinimumPolicy = 51
Const NSOpenGLPFAMaximumPolicy = 52
Const NSOpenGLPFAOffScreen = 53
Const NSOpenGLPFAFullScreen = 54
Const NSOpenGLPFASampleBuffers = 55
Const NSOpenGLPFASamples = 56
Const NSOpenGLPFAAuxDepthStencil = 57
Const NSOpenGLPFAColorFloat = 58
Const NSOpenGLPFAMultisample = 59
Const NSOpenGLPFASupersample = 60
Const NSOpenGLPFASampleAlpha = 61
Const NSOpenGLPFARendererID = 70
Const NSOpenGLPFASingleRenderer = 71
Const NSOpenGLPFANoRecovery = 72
Const NSOpenGLPFAAccelerated = 73
Const NSOpenGLPFAClosestPolicy = 74
Const NSOpenGLPFARobust = 75
Const NSOpenGLPFABackingStore = 76
Const NSOpenGLPFAMPSafe = 78
Const NSOpenGLPFAWindow = 80
Const NSOpenGLPFAMultiScreen = 81
Const NSOpenGLPFACompliant = 83
Const NSOpenGLPFAScreenMask = 84
Const NSOpenGLPFAPixelBuffer = 90
Const NSOpenGLPFARemotePixelBuffer = 91
Const NSOpenGLPFAAllowOfflineRenderers = 96
Const NSOpenGLPFAAcceleratedCompute = 97
Const NSOpenGLPFAVirtualScreenCount = 128
Const END_OF_LIST = 0

Dim attr As New MemoryBlock(128)


// Define Apple pixel format structure and either Create a pixel structure
// or allow the system to Choose one for us.
//
attr.UInt32Value( 0) = NSOpenGLPFADoubleBuffer
attr.UInt32Value( 4) = NSOpenGLPFAAccelerated
attr.UInt32Value( 8) = NSOpenGLPFAColorSize
attr.UInt32Value(12) = 24
attr.UInt32Value(16) = NSOpenGLPFADepthSize
attr.UInt32Value(20) = 32
attr.UInt32Value(24) = NSOpenGLPFAAlphaSize
attr.UInt32Value(28) = 8
attr.UInt32Value(32) = END_OF_LIST

Return attr


Thanks in advance for anyone's help!!
--Barry


Top
 Profile  
Reply with quote  
 Post subject: Re: Bug with OpenGLsurface
PostPosted: Wed Feb 01, 2012 5:53 am 
Offline

Joined: Fri Nov 06, 2009 5:20 am
Posts: 11
Btw, I'm running 2011r4.


Top
 Profile  
Reply with quote  
 Post subject: Re: Bug with OpenGLsurface
PostPosted: Wed Feb 01, 2012 10:27 am 
Offline
Real Software Engineer

Joined: Fri Jan 28, 2011 5:24 pm
Posts: 145
ebsanford wrote:
I gave up on OpenGLSurface a long time ago and hand coded my own AGL and WGL over a canvas control. However, with the oncoming of Cocoa, AGL is no longer an option. So for the past couple of weeks, I've been trying once again to make OpenGLSurface work so that I can compile in Cocoa mode. For the most part, I have been successful. However, the 'MouseWheel' event needs some more work. It seems to be returning X/Y of the parent window rather than the control. It can also get stuck in an endless firing loop where I have to kill the application to regain control. So for now, I remain stuck in Carbon/AGL if I want my OpenGL app to work. Any help or guidance would be greatly appreciated!!!
Quote:

Please file a Feedback case about the MouseWheel event. I was unaware of it being broken.

ebsanford wrote:
Someone needs to seriously improve the documentation of OpenGLSurface as well. There is basically nothing on the Configure event, and every time I try to configure an attrib array, it crashes. Below is my 'Configure' event code. I realize that the color bits and the depth bits can be set in the IDE, the alpha depth cannot


Please file a Feedback case for this too. I don't know offhand how the Configure event works.

_________________
Joe Ranieri
Mac Frameworks & Compiler
REAL Software, Inc.


Top
 Profile  
Reply with quote  
 Post subject: Re: Bug with OpenGLsurface
PostPosted: Sat Feb 04, 2012 12:17 pm 
Offline

Joined: Fri Nov 06, 2009 5:20 am
Posts: 11
Hi Joe,

This morning at 3 am I cranked up the coffee pot, and after several hours of intense debugging I have discovered a couple of things. For one, the OpenGLSurface MouseWheel event does indeed incorrectly report the X,Y of the mouse. But this is easily fixed at the top of the event by the following:
X = X - Me.Left
Y = Y - Me.Top

The other Mouse... events do not have this issue and their X/Y parameter values are already correct.

The other major problem I was having is what *seemed* at first to be runaway event firing. However, I subsequently discovered that the MouseWheel event can sometimes fire with BOTH <deltaX> and <deltaY> having a 0 value!!! Inside my event code this was not considered. Now I have the following at the top of the event:
X = X - Me.Left
Y = Y - Me.Top

If (deltaX = 0) AND (deltaY = 0) _
Then Return False

To me, a MouseWheel event with no change in wheel position (both deltaX & deltaY = 0) makes no intuitive sense. But, for what it's worth, this simple fix does make everything right in my OpenGLSurface world!! My code is using the MouseWheel event to zoom in/out or fit (side wheel) my view to the viewport and assumed that either <deltaX> OR <deltaY> was non-zero. My event didn't know what to do in the unexpected case that both were zero.

--Barry


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group