speeding up copying World using dirty rectangles?

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

speeding up copying World using dirty rectangles?

LawsonEnglish
in my Gui to OpenGL code, I'm doing a very naive procedure to copy the
World to an OpenGL at every #step. I know that there's many ways to
speed this up (I get only 10fps with a saturated core when I do it the
simplest way). Suggestsion on how to make the following more efficient?
THanks.


getLatestImageFromWorld


     |format form  tempTextures|

     pasteUpFormCanvas ifNil: [^self].
     self hide.
     myPasteUp fullDrawOn: pasteUpFormCanvas.
     self show.
     form := pasteUpFormCanvas form.
     fPUWidth := form width.
     fPUHeight := form height.

     tempTextures := WordArray with:   (textureIntNames at: 1).
     ogl glDeleteTextures: 1 with: tempTextures.
     ogl glBindTexture: GLTexture2d with: (textureIntNames at: 1).
     ogl checkForError.
     format := ogl textureInternalFormat.

     ogl glEnable: GLTexture2d.


     ogl glTexParameteri: GLTexture2d with: GLTextureMinFilter with:
GLLinear.
     ogl glTexParameteri: GLTexture2d with: GLTextureMagFilter with:
GLLinear.





     ogl glTexImage2D: GLTexture2d
             with: 0
             with: format
             with: form width
             with: form height
             with: 0
             with: ogl texturePixelFormat
             with: ogl texturePixelType
             with: form bits.


Reply | Threaded
Open this post in threaded view
|

Re: speeding up copying World using dirty rectangles?

marcel.taeumel (old)
Hi.

You should not draw the full scene graph into a buffer that will be copied to your OGL stuff in every step/loop. This is slow. You should make use of the default world redraw optimization with dirty rectangles. Maybe like this:

1. Modify WorldState>>displayWorldSafely: to draw into a buffer form and NOT into the DisplayScreen.
2. Add a postprocessing step to WorldState>>doOneCycleFor: or use #step in a Morph (with stepTime == 0) to copy this buffer to your OGL stuff.

I don't know how specific the form DisplayScreen is. Maybe you can directly copy its contents into your OGL world.

Marcel
Reply | Threaded
Open this post in threaded view
|

Re: speeding up copying World using dirty rectangles?

LawsonEnglish
thanks, I'll experiment. Igor's NBOpenGl and GLDisplay would be the best
route to use for this, but the Mac interface for it doesn't work with
partial screen areas yet. In the meantime, I get to learn more about
OpenGL and such.

Lawson

On 1/21/12 10:19 AM, Marcel Taeumel wrote:

> Hi.
>
> You should not draw the full scene graph into a buffer that will be copied
> to your OGL stuff in every step/loop. This is slow. You should make use of
> the default world redraw optimization with dirty rectangles. Maybe like
> this:
>
> 1. Modify WorldState>>displayWorldSafely: to draw into a buffer form and NOT
> into the DisplayScreen.
> 2. Add a postprocessing step to WorldState>>doOneCycleFor: or use #step in a
> Morph (with stepTime == 0) to copy this buffer to your OGL stuff.
>
> I don't know how specific the form DisplayScreen is. Maybe you can directly
> copy its contents into your OGL world.
>
> Marcel
>
> --
> View this message in context: http://forum.world.st/speeding-up-copying-World-using-dirty-rectangles-tp4313876p4316471.html
> Sent from the Squeak - Dev mailing list archive at Nabble.com.
>
>