Xojo Conferences
MBSSep2018MunichDE
XDCMay2019MiamiUSA

Re: Problem SpriteSurface double-buffering (Real Studio games Mailinglist archive)

Back to the thread list
Previous thread: REALbasic and QuickDraw
Next thread: 3DMF Workshop .4 wont build in RB2005


[ANN] Preview of RBD 2.4   -   Marc Zeedar
  Re: Problem SpriteSurface double-buffering   -   Ken Gish
   Re: Problem SpriteSurface double-buffering   -   John Balestrieri
   Re: Problem SpriteSurface double-buffering   -   John Balestrieri
    Re: Problem SpriteSurface double-buffering   -   Ken Gish
     Re: Problem SpriteSurface double-buffering   -   Asher Dunn
    Problem SpriteSurface double-buffering   -   Ken Gish
     Re: Problem SpriteSurface double-buffering   -   Joseph J. Strout
     Re: Problem SpriteSurface double-buffering   -   Asher Dunn
     Re: Problem SpriteSurface double-buffering   -   Asher Dunn
     Re: Problem SpriteSurface double-buffering   -   John Balestrieri
     Re: Problem SpriteSurface double-buffering   -   Troy Rollins
     Re: Problem SpriteSurface double-buffering   -   Joseph J. Strout
     Re: Problem SpriteSurface double-buffering   -   John Balestrieri
     Re: Problem SpriteSurface double-buffering   -   Troy Rollins
    Re: Problem SpriteSurface double-buffering   -   Ken Gish
    Re: Problem SpriteSurface double-buffering   -   Ken Gish
     Re: Problem SpriteSurface double-buffering   -   John Balestrieri
    Re: Problem SpriteSurface double-buffering   -   Ken Gish
    Re: Problem SpriteSurface double-buffering   -   Ken Gish

Re: Problem SpriteSurface double-buffering
Date: 01.07.05 13:53 (Fri, 01 Jul 2005 08:53:10 -0400)
From: Ken Gish
Does anyone know how if it is possible to get the REALbasic OpenGL plug-in
version 1.1.1 (from www.mac.com) without having a full membership (I only
have a trial membership)? I'd rather not pay $99 for a membership just to
get a "free" plug-in.

Has anyone had any luck with the SuperSpriteSurface? I can't get the demo
to run (just a black screen).

Also, the following link looks promising:

http://www.resexcellence.com/realbasic/articles/2004/11-20-04/

Any thoughts or suggestions would be appreciated.

Ken

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Re: Problem SpriteSurface double-buffering
Date: 01.07.05 15:01 (Fri, 1 Jul 2005 10:01:14 -0400)
From: John Balestrieri
Hi Ken, once you get the demo app running (with black screen) have
you tried running the different demos available from the menu?

John

On Jul 1, 2005, at 8:53 AM, Ken Gish wrote:

> Does anyone know how if it is possible to get the REALbasic OpenGL
> plug-in version 1.1.1 (from www.mac.com) without having a full
> membership (I only have a trial membership)? I'd rather not pay $99
> for a membership just to get a "free" plug-in.
>
> Has anyone had any luck with the SuperSpriteSurface? I can't get
> the demo to run (just a black screen).
>
> Also, the following link looks promising:
>
> http://www.resexcellence.com/realbasic/articles/2004/11-20-04/
>
> Any thoughts or suggestions would be appreciated.
>
> Ken

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Re: Problem SpriteSurface double-buffering
Date: 01.07.05 15:03 (Fri, 1 Jul 2005 10:03:20 -0400)
From: John Balestrieri
You can get it from version tracker:

http://www.versiontracker.com/dyn/moreinfo/macosx/10282

John

On Jul 1, 2005, at 8:53 AM, Ken Gish wrote:

> Does anyone know how if it is possible to get the REALbasic OpenGL
> plug-in version 1.1.1 (from www.mac.com) without having a full
> membership (I only have a trial membership)? I'd rather not pay $99
> for a membership just to get a "free" plug-in.
>

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Re: Problem SpriteSurface double-buffering
Date: 01.07.05 17:48 (Fri, 01 Jul 2005 12:48:57 -0400)
From: Ken Gish
John,

As for the SSS demo, you are correct. The "problem" was that I didn't
select any of the demos from the menu. Geez.....

As for the plugin, when I click on the link to download it takes me to a
.mac error page saying "We're sorry" and following message:

"Our records show that the account you're attempting to connect to either
does not exist or is currently inactive."

Do you need a full .mac membership to download the plugin? Also, the
alternate link appears to be dead. Isn't this something that RB can provide
on their web site? After all, it is supposed to be free.

To Everyone:

I read that the global ticks variable is synchronized to the VBL (vertical
blanking) interval:

http://developer.apple.com/documentation/mac/Processes/Processes-76.html#HEADING76-0

So, it seems like a quick and easy thing (without requiring additional
software - such as another plugin or the OpenGL library) to do would be to
set a timer to a period of 1 and monitor when the tick value changes.
Shouldn't this work (in theory)?

Or, am I forced to learn OpenGL? Ugh. In OpenGL, doing what seems like a
simple task (namely, just loading a 50x50 graphic into the OpenGL window)
is a chore.

Ken

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Re: Problem SpriteSurface double-buffering
Date: 03.07.05 02:15 (Sat, 2 Jul 2005 21:15:16 -0400)
From: Asher Dunn

On Jul 1, 2005, at 12:48 PM, Ken Gish wrote:

> Or, am I forced to learn OpenGL? Ugh. In OpenGL, doing what seems
> like a simple task (namely, just loading a 50x50 graphic into the
> OpenGL window) is a chore.

Well, it depends on what you want to do with that graphic. If you just
want to draw a picture in 2D, it is relatively simple. If you want a
full 3D rotatable thingy, it is more work.

Asher Dunn
--------------------------------------------------------
President and Head Developer of Fireye Software
<http://www.fireyesoftware.com/>
AIM and Yahoo: fireye7517

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Problem SpriteSurface double-buffering
Date: 29.06.05 16:17 (Wed, 29 Jun 2005 11:17:38 -0400)
From: Ken Gish
RB Game Experts,

I am using REALbasic 2005 on a MacMini running OS X 10.3.9 with a 1.25GHz
PowerPC G4 processor, 256MB RAM, 40GB hard drive, and ATI Radeon 9200
graphics processor with 32MB of DDR video memory.

I am trying to get precise control of the duration of Sprites on a
SpriteSurface. Duration is the time that two separate 50x50 sprites are
visible within a 600x600 spritesurface; smallest duration I need is 1 frame
at a 60 Hz frame rate.

The built-in double-buffering seems to be doing its job correctly most of
the time. Occasionally, a 50x50 sprite - that is displayed for 1 frame - is
displayed partially, with uneven brightness, or in some rare instances not
at all. It seems that the display is getting updated during the vertical
blanking interval which, in turn, means that double-buffering isn't always
working or maybe it isn't working at all.

If I do a simple test program where all I do is move the sprite right and
down by 1 pixel each frame, there is a "hiccup" or "tear" (jerky motion,
jagged edges) about once every 3 times (for a 3 second duration) but whether
or not it occurs seems to be random. It seems like there is a background
process that is interrupting the spritesurface timing (Would adjusting the
thread priority help?). The example program I am using has a PushButton1
and a SpriteSurface1. Here is code for PushButton1 Action event (add
properties to window1: i as integer, S as sprite, SmallPicture as picture
which is 50x50):

iS = SpriteSurface1.NewSprite(SmallPicture,-50,0)
SpriteSurface1.Run

In SpriteSurface1 NextFrame event (SpriteSurface1 width and height are 300):

if ithen S.xif i%0 then
S.x=-50
S.y me.stop
end
i=i+1
S.x=S.x+1
S.y=S.y+1

I am aware that the screen only updates AFTER the NextFrame event has
completed. Does that mean that RB waits for the beginning of a retrace
cycle, then updates the display with the changes made in the just-completed
NextFrame event? Shouldn't this guarantee that the display is only updated
during the blanking interval? What happens if the updates take longer than
1 frame to complete? In any event, in my case at least, something seems to
be interfering with this.

Is there any way to read the vertical retrace status bit directly? This
approach might work better (for me) but not sure it would solve the problem
(even if it is possible.

Thanks in advance for your help.

Ken

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Re: Problem SpriteSurface double-buffering
Date: 29.06.05 16:45 (Wed, 29 Jun 2005 10:45:33 -0500)
From: Joseph J. Strout
At 11:17 AM -0400 6/29/05, Ken Gish wrote:

>I am trying to get precise control of the duration of Sprites on a
>SpriteSurface. Duration is the time that two separate 50x50
>sprites are visible within a 600x600 spritesurface; smallest
>duration I need is 1 frame at a 60 Hz frame rate.

You probably can't get that. For this level of control, and for such
a simple display, I'd recommend taking control of the display
yourself as much as possible -- at a minimum, by using a Canvas.

>The built-in double-buffering seems to be doing its job correctly
>most of the time. Occasionally, a 50x50 sprite - that is displayed
>for 1 frame - is displayed partially, with uneven brightness, or in
>some rare instances not at all. It seems that the display is
>getting updated during the vertical blanking interval which, in
>turn, means that double-buffering isn't always working or maybe it
>isn't working at all.

No, it's working fine (the double-buffering is done by the OS itself,
and always works). The effect you describe is called "tearing" and
it happens when the display is updated during the physical display
redraw (and NOT during the vertical blanking interval).

Neither the OS nor REALbasic makes any attempt to sync display
updates with the physical display anymore; this is rather hard to do
on modern hardware.

>Is there any way to read the vertical retrace status bit directly?

Well, yes, in the sense of "anything is possible if you work hard
enough at it," but no, in the sense of "probably not practical."
Even in classic MacOS, syncing display updates to the vertical
refresh required snippets of assembly language and lots of low-level
mucking about. On OS X, you have much more varied hardware, a
preemptive operating system, and about a zillion more layers of OS
between you and the physical screen (or screens).

But, I suppose it's possible that one of those zillion layers of OS
has some facility for doing this sort of thing for you. I wouldn't
want to discourage you from further investigation. But if it exists,
I'm not aware of it.

Best,
- Joe

Re: Problem SpriteSurface double-buffering
Date: 29.06.05 17:30 (Wed, 29 Jun 2005 12:30:40 -0400)
From: Asher Dunn

On Jun 29, 2005, at 11:45 AM, Joseph J. Strout wrote:

> Neither the OS nor REALbasic makes any attempt to sync display updates
> with the physical display anymore; this is rather hard to do on modern
> hardware.

This is considered hard? It requires a single function call when using
OpenGL.

Asher Dunn
--------------------------------------------------------
President and Head Developer of Fireye Software
<http://www.fireyesoftware.com/>
AIM and Yahoo: fireye7517

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Re: Problem SpriteSurface double-buffering
Date: 29.06.05 17:41 (Wed, 29 Jun 2005 12:41:45 -0400)
From: Asher Dunn

On Jun 29, 2005, at 12:30 PM, Asher Dunn wrote:

>> Neither the OS nor REALbasic makes any attempt to sync display
>> updates with the physical display anymore; this is rather hard to do
>> on modern hardware.
>
> This is considered hard? It requires a single function call when using
> OpenGL.

At least, it requires a single function call to make it look as if it
is synced with the display retrace. I don't know how far down (towards
hardware) this actually goes, but it looks good.

Asher Dunn
--------------------------------------------------------
President and Head Developer of Fireye Software
<http://www.fireyesoftware.com/>
AIM and Yahoo: fireye7517

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Re: Problem SpriteSurface double-buffering
Date: 29.06.05 19:23 (Wed, 29 Jun 2005 14:23:14 -0400)
From: John Balestrieri
SuperSpriteSurface (which uses OpenGL) supports vertical blank
syncing -- and can fix the frame tearing problem.

http://www.tinrocket.com/products/superspritesurface/

John

On Jun 29, 2005, at 12:30 PM, Asher Dunn wrote:

> On Jun 29, 2005, at 11:45 AM, Joseph J. Strout wrote:
>
>> Neither the OS nor REALbasic makes any attempt to sync display
>> updates with the physical display anymore; this is rather hard to
>> do on modern hardware.
>>
> This is considered hard? It requires a single function call when
> using OpenGL.
>
> Asher Dunn
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Re: Problem SpriteSurface double-buffering
Date: 29.06.05 19:32 (Wed, 29 Jun 2005 14:32:52 -0400)
From: Troy Rollins

On Jun 29, 2005, at 2:23 PM, John Balestrieri wrote:

> SuperSpriteSurface (which uses OpenGL) supports vertical blank syncing
> -- and can fix the frame tearing problem.

Good lord, once SSS supports Windows... that is gonna be just... Super.

And also - (Included on the list in case others have the same issue.)

John, could you consider adding eSellerate or Kagi as a payment method?
My corporate AMEX will not process PayPal.

Re: Problem SpriteSurface double-buffering
Date: 29.06.05 19:47 (Wed, 29 Jun 2005 13:47:42 -0500)
From: Joseph J. Strout
At 12:30 PM -0400 6/29/05, Asher Dunn wrote:

>>Neither the OS nor REALbasic makes any attempt to sync display
>>updates with the physical display anymore; this is rather hard to
>>do on modern hardware.
>
>This is considered hard? It requires a single function call when using OpenGL.

A single function call that does what? Delays until the next
vertical refresh of the specified monitor? That would indeed be
useful. (It's certainly been a a few years since the guys at Apple
told me that this was very hard to do in OS X; maybe they've added
something since then.)

If you mean, something that only affects OpenGL rendering, then
that's not as useful. We need to actually know when we're in the
blanking interval, so we can change the display.

Re: Problem SpriteSurface double-buffering
Date: 29.06.05 19:49 (Wed, 29 Jun 2005 14:49:28 -0400)
From: John Balestrieri
Yes. I know that the current PayPal system is a bit restricting -- in
terms of who is willing to use it as well as the non-automation/
processing of payments. My hope is to use eSellerate or Kagi for the
next release.

John

On Jun 29, 2005, at 2:32 PM, Troy Rollins wrote:

> And also - (Included on the list in case others have the same issue.)
>
> John, could you consider adding eSellerate or Kagi as a payment
> method? My corporate AMEX will not process PayPal.

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Re: Problem SpriteSurface double-buffering
Date: 29.06.05 20:01 (Wed, 29 Jun 2005 15:01:19 -0400)
From: Troy Rollins

On Jun 29, 2005, at 2:49 PM, John Balestrieri wrote:

> Yes. I know that the current PayPal system is a bit restricting -- in
> terms of who is willing to use it as well as the
> non-automation/processing of payments. My hope is to use eSellerate or
> Kagi for the next release.

OK thanks. As a (very) little incentive, I'll be placing my order as
soon as that happens. ;-)

Re: Problem SpriteSurface double-buffering
Date: 29.06.05 19:21 (Wed, 29 Jun 2005 14:21:37 -0400)
From: Ken Gish
Asher (or anyone else that wants to reply):

Thanks for everyone's responses. Well, I didn't know that the OpenGL call
was even necessary if using SpriteSurfaces but it looks as though it IS
necessary based on the responses so far and the Apple web site. Can someone
confirm this?

Would someone mind posting an example using canvas1 and OpenGL to
synchronize to vertical retrace? Here is the information that is needed but
that's about as far as I can get:
____________________________________________________________________________

Retrace synchronization can be achieved by using the AGL_SWAP_INTERVAL
constant. Normally OpenGL does not synchronize swaps to monitor vertical
retraces. This open loop design allows the shortest delays when calling
aglSwapBuffers but may result in visible “tearing” as the retrace frequency
interacts with the context swap frequency. To force aglSwapBuffers to
synchronize with the next vertical retrace the following code can be used:

GLint sync = 1;
aglSetInteger (ctx, AGL_SWAP_INTERVAL, &sync);

______________________________________________

I copied the above text from the from the following link:

http://developer.apple.com/documentation/GraphicsImaging/Reference/AGL_OpenGL/Intro/chapter_1_section_1.html

The following text was copied from another REALbasic support message.

_____________________________

Dim swap As Integer = 1
Const AGL_SWAP_INTERVAL = 222
Soft declare function aglGetCurrentContext lib "OpenGLLibrary" () as integer
declare sub aglSetInteger lib "OpenGLLibrary" (ctx as integer, pname as
integer, ByRef params as integer)
______________________________

Will this work (I added the "Soft" to "Soft Declare Function"; is that
needed on REALbasic 2005 in this case)? If not, can anyone work up an
example on how to use these settings in RB?

Much appreciated.

Ken

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Re: Problem SpriteSurface double-buffering
Date: 29.06.05 19:22 (Wed, 29 Jun 2005 14:22:49 -0400)
From: Ken Gish
Asher (or anyone else that wants to reply):

Thanks for everyone's responses. Well, I didn't know that the OpenGL call
was even necessary if using SpriteSurfaces but it looks as though it IS
necessary based on the responses so far and the Apple web site. Can someone
confirm this?

Would someone mind posting an example using canvas1 and OpenGL to
synchronize to vertical retrace? Here is the information that is needed but
that's about as far as I can get:
____________________________________________________________________________

Retrace synchronization can be achieved by using the AGL_SWAP_INTERVAL
constant. Normally OpenGL does not synchronize swaps to monitor vertical
retraces. This open loop design allows the shortest delays when calling
aglSwapBuffers but may result in visible “tearing” as the retrace frequency
interacts with the context swap frequency. To force aglSwapBuffers to
synchronize with the next vertical retrace the following code can be used:

GLint sync = 1;
aglSetInteger (ctx, AGL_SWAP_INTERVAL, &sync);

______________________________________________

I copied the above text from the from the following link:

http://developer.apple.com/documentation/GraphicsImaging/Reference/AGL_OpenGL/Intro/chapter_1_section_1.html

The following text was copied from another REALbasic support message.

_____________________________

Dim swap As Integer = 1
Const AGL_SWAP_INTERVAL = 222
Soft declare function aglGetCurrentContext lib "OpenGLLibrary" () as integer
declare sub aglSetInteger lib "OpenGLLibrary" (ctx as integer, pname as
integer, ByRef params as integer)
______________________________

Will this work (I added the "Soft" to "Soft Declare Function"; is that
needed on REALbasic 2005 in this case)? If not, can anyone work up an
example on how to use these settings in RB?

Much appreciated.

Ken

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Re: Problem SpriteSurface double-buffering
Date: 29.06.05 19:46 (Wed, 29 Jun 2005 14:46:37 -0400)
From: John Balestrieri
Unfortunately, you can't use these calls with the Canvas or
SpritesSurface, as OpenGL is not used for onscreen display with both
of these controls (Though OpenGL is used behind the scenes, iirc, in
Rb2005 for off-screen drawing/compositing -- but that's "a horse of a
different feather" ;)

John

On Jun 29, 2005, at 2:22 PM, Ken Gish wrote:

> Asher (or anyone else that wants to reply):
>
> Thanks for everyone's responses. Well, I didn't know that the
> OpenGL call was even necessary if using SpriteSurfaces but it looks
> as though it IS necessary based on the responses so far and the
> Apple web site. Can someone confirm this?
>
> Would someone mind posting an example using canvas1 and OpenGL to
> synchronize to vertical retrace? Here is the information that is
> needed but that's about as far as I can get:

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Re: Problem SpriteSurface double-buffering
Date: 29.06.05 22:35 (Wed, 29 Jun 2005 17:35:13 -0400)
From: Ken Gish
I will try out SuperSpriteSurface tomorrow.

It seems like this is something that should be built into RB. Any plans to
incorporate it in the future?

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Re: Problem SpriteSurface double-buffering
Date: 30.06.05 13:10 (Thu, 30 Jun 2005 08:10:10 -0400)
From: Ken Gish
Does anyone know if it is possible to do this in RB without third-party
software?

Also, is OpenGL installed by default on Mac OS X 10.2 and above?

Can RB detect the version of OpenGL installed on the computer? An example
using glGetString (GL_VERSION) would be helpful.

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>