On 25 Lug, 00:30, "Alex Holkner" <[EMAIL PROTECTED]> wrote:
> On 7/25/08, FxIII <[EMAIL PROTECTED]> wrote:
>
>
>
> >  Hi to all,
> >   I'have to make a screen shoot of a window when it changes,  and make
> >  this image visible on another window.
> >   Once got the framebuffer image (or used the gl.glCopyTexImage2D) I
> >  have a fresh image ready to be paintend in the second window!
> >  Alas, it doesn't work.
> >  The problem is simple, the frist window (the observed one) is on a
> >  screen, the second ( the observer) is on another screen... (Why do you
> >  think i clone windows?:D) Often the graphics card does not share the
> >  textur (grrr) so notthing is painted in the second window!
> >  How to overcome this problem? possibly whitout a great loss of
> >  performance (not too much (slow)copies)
>
> pyglet shares the texture space of all window contexts by default (and
> as of 1.1, will give an error if it cannot do this due to a driver
> problem).
>
> Your problem might be that the texture copy hasn't completed by the
> time you need to flush.  You might need to insert a glFinish() in
> between.
>
> Otherwise, I suggest you post a code sample demonstrating the issue.
>
> Alex.

The problem is not resolved, it can not be a flush problem because
there is a strange behaviour: when I move the observer window so it is
between the two monitors, the half in the first monitor is not
textured, the second half it is...
Anyway:
        n=ctypes.c_uint()
        pyglet.gl.glGenTextures(1,ctypes.pointer(n))
 
t=pyglet.image.Texture(size[0],size[1],pyglet.gl.GL_TEXTURE_2D,n.value)
        #current view texture
 
self.texturecontainer=t.create_for_size(pyglet.gl.GL_TEXTURE_2D,size[0],size[1])
        pyglet.gl.glCopyTexImage2D(pyglet.gl.GL_TEXTURE_2D,
0,pyglet.gl.GL_RGB,
0,0,self.texturecontainer.width,self.texturecontainer.height,0)
is done when the window is created
        pyglet.gl.glBindTexture(pyglet.gl.GL_TEXTURE_2D,
self.texturecontainer.id)
        pyglet.gl.glCopyTexImage2D(pyglet.gl.GL_TEXTURE_2D,
0,pyglet.gl.GL_RGB,
0,0,self.texturecontainer.width,self.texturecontainer.height,0)
        pyglet.gl.glFinish()
when the observed change
the other windows puts observed.texturecontainer in self.pixmap and on
paint:
if self.pixmap:
            pyglet.gl.glEnable(pyglet.gl.GL_BLEND)
            pyglet.gl.glBlendFunc(pyglet.gl.GL_SRC_ALPHA,
pyglet.gl.GL_ONE_MINUS_SRC_ALPHA)
            pyglet.gl.glBindTexture(pyglet.gl.GL_TEXTURE_2D,
self.pixmap.id)
            pyglet.gl.glEnable(pyglet.gl.GL_TEXTURE_2D)
            pyglet.gl.glBegin(pyglet.gl.GL_QUADS)
            pyglet.gl.glTexCoord2f(0.0, 0.0);
pyglet.gl.glVertex2f(self.area.x,self.area.y)
            pyglet.gl.glTexCoord2f(self.textw, 0.0);
pyglet.gl.glVertex2f(self.area.x+self.area.w,self.area.y)
            pyglet.gl.glTexCoord2f(self.textw, self.texth);
pyglet.gl.glVertex2f(self.area.x+self.area.w,self.area.y+self.area.h)
            pyglet.gl.glTexCoord2f(0.0, self.texth);
pyglet.gl.glVertex2f(self.area.x,self.area.y+self.area.h)
            pyglet.gl.glEnd()
(I know I did not use the texture with region management... :( I
discovered it too late :D)
may be a texture id problem?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pyglet-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to