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 3 of 3

Thread: Transfer of a Direct Draw surface to OpenGl

  1. #1
    Intern Newbie
    Join Date
    Dec 2000
    Location
    Czech Republic
    Posts
    30

    Transfer of a Direct Draw surface to OpenGl

    I need to do a very fast transfer of a
    Direct Draw surface to the OpenGL buffer.
    The reason - I use Direct Show for video
    decompression witch us a DirectDraw
    surface (off screen) as the result.
    I need to transfer the content of this
    buffer to OpenGl at video framerate.
    Is it possible to get e.g. the pointer to
    the RGB values in the DirectDraw surface
    and to transfer them by glCopyPixels or
    so to OpenGL ? Sample code will be highy apreciated ...
    GALI-3D Inc. CEO
    http://www.gali-3d.com

  2. #2
    Junior Member Newbie
    Join Date
    Oct 2000
    Location
    Cracow, Poland
    Posts
    2

    Re: Transfer of a Direct Draw surface to OpenGl

    DirectDrawSurface has a method called Lock which allows you to access its properties. Lock() fills DDSURFACEDESC* structure with informations about surface. Look at its description in DXSDK help. There is void *lpSurface in DDSURFACEDESC which is a pointer to the pixels table. But remember to unlock surface after locking it, and that you have an access to the RGB values only between Lock() - Unlock() calls. DirectDraw surface's RGB format depends on video card's pixel format so make sure to check its bit depth and RGB order. And before calling Lock() set DDSURFACEDESC to 0 and set its dwSize to sizeof(YOUR_DDSURFACEDESC).

    I hope this will help, but I cannot guarantee it will work.

    PS. Don't remember about DDSURFACEDESC.lPitch

  3. #3
    Intern Newbie
    Join Date
    Dec 2000
    Location
    Czech Republic
    Posts
    30

    Re: Transfer of a Direct Draw surface to OpenGl

    Thank . The method described by you works perfectly !
    GALI-3D Inc. CEO
    http://www.gali-3d.com

Posting Permissions

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