Is it possible to save a screenshot of the active window somehow? I'm
using opengl primitives, but when I try to do something like
CopyTexImage2D then call textureçsaveö ı get a weird, skewed image.
Can anyone help me?

The drawing method is as follows:

def draw():
        global std
        global win
        win.switch_to()
        global tex
        glClear(GL_COLOR_BUFFER_BIT)
        global image
        glEnable(GL_TEXTURE_2D)
        glBindTexture(GL_TEXTURE_2D,tex.id)
        #colorBits = GLchar()
        #glTexImage2D(GL_TEXTURE_2D,0 ,3 , 640, 480, 0 , GL_RGB,
GL_UNSIGNED_BYTE, colorBits)
        glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,
GL_LINEAR)
        glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,
GL_LINEAR)
        glViewport(0,0,640,480)

        if image:
           glBindTexture(GL_TEXTURE_2D,image.id)
           #tex.blit_into(image,0,0,0)
        glBindTexture(GL_TEXTURE_2D,0)

        for item in std:
            if item[0] == 'line':
               glLineWidth(item[5])
               glColor3f(item[6][0],item[6][1],item[6][2])
               pyglet.graphics.draw(2, pyglet.gl.GL_LINES,('v2i',
(item[1], item[2], item[3], item[4])))
            elif item[0] == 'brush':
               glPointSize( item[3] )
               glColor3f(item[4][0],item[4][1],item[4][2])
               pyglet.graphics.draw(1, pyglet.gl.GL_POINTS,('v2i',
(item[1], item[2])))
        global drag
        if drag:
           global begpt
           global endpt
           global color
           global ptsize
           glColor3f(color[0],color[1],color[2])
           glLineWidth(ptsize)
           pyglet.graphics.draw(2, pyglet.gl.GL_LINES,('v2i',
(begpt[0], begpt[1], endpt[0], endpt[1])))

        glBindTexture(GL_TEXTURE_2D,tex.id)
        glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA,0,0, 640, 480, 0)
        glFinish()
        glViewport(0,0,640,480)
        glDisable(GL_TEXTURE_2D)
        glFlush()

and I call tex.save() when the user presses a key.

Can it be related to me dispatching events before calling draw() ? I
don't think so though...
--~--~---------~--~----~------------~-------~--~----~
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