Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 10 of 10

Thread: GLX data Copying

Hybrid View

  1. #1
    Junior Member Newbie
    Join Date
    Feb 2013
    Posts
    5

    GLX data Copying

    I am very new to GLX, i have created a xwindow as a drawable, i have a glxpixmap, i need to copy a bytearray data to this pixmap.
    Is there any mechanism by which i can do this.
    Last edited by Tan_has; 02-05-2013 at 09:52 PM.

  2. #2
    Can you show some code ?

  3. #3
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    3,220
    Have you looked at XCopyArea?

    Also, if you don't need the window, you can create your GLXContext to target the pixmap directly.

  4. #4
    Junior Member Newbie
    Join Date
    Feb 2013
    Posts
    5
    Thanks!!!
    I looked at XCopyArea, it says both drawables to be of same root window, my drawable is window.
    I did one thing now by creating a XcreatepixmapfromBitmap, then copying, but it looks it would be very costly. My code architecture is such that i can use window only as drawable. So looking out for some thing which can directly copy the data into this window.

  5. #5
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    3,220
    I dug up a Green Book ("OpenGL Programming for the X Window System") and it describes rendering into XPixmaps (not what you want exactly, but potentially useful).

    Basically, glXCreateContext, XCreatePixmap to create an XPixmap, pass that to glXCreateGLXPixmap to create a GLXPixmap wrapper around the XPixmap, and then glXMakeCurrent on the GLXPixmap to make it active for rendering.

    You might be able to use this to copy window data off to a PBO or somewhere, switch to the GLXPixmap, and then copy the data back to it. Or possibly copy between contexts with sharing enabled.

    Here's the paraphrased code snippets:

    Code cpp:
    cx = glXCreateContext( dpy, vi, NULL, False );
    if ( !cx )
      ouch;
    pmap = XCreatePixmap( dpy, RootWindow( dpy, vi->screen ), imageWidth, imageHeight, vi->depth );
    glxpmap = GLXCreateGLXPixmap( dpy, vi, pmap );
    glXMakeCurrent( dpy, glxpmap, cx );

  6. #6
    Junior Member Newbie
    Join Date
    Feb 2013
    Posts
    5
    Thanks!!!...
    i am trying by making making current context to GLX ,at that time my process is giving a segmentation fault.
    I also tried by creating a ximage and then putting that image into the pixmap and then doing a xcopy to the window, but my xcopy is giving a bad request.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •