Results 1 to 7 of 7

Thread: get image from scene

  1. #1
    Junior Member Newbie
    Join Date
    Jan 2011
    Posts
    18

    get image from scene

    hey,I'm trying using glReadPixels() to get image from my scene.My goal is getting a image from arbitrary view point in the scene,e.g.there is a moving bird in my scene,I want to get image about what the bird sees, while I still can see the whole scene on screen.
    however I found glReadPixels() only can get image about what windows show at that moment,just like a screenshot.How can I achieve my goal?
    thanks for any reply.

  2. #2
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,574

    Re: get image from scene

    Move your camera to the bird's place, render, then glReadPixels it.

  3. #3
    Senior Member Regular Contributor
    Join Date
    Nov 2010
    Location
    Brazil, Rio de Janeiro
    Posts
    147

    Re: get image from scene


  4. #4
    Junior Member Newbie
    Join Date
    Jan 2011
    Posts
    18

    Re: get image from scene

    thanks!
    but I don't want show what the bird see on the sreen.as I know,move my camera to the bird's place,render,then the screen also will show what the bird see,which is not my goal.

  5. #5
    Junior Member Newbie
    Join Date
    Jan 2011
    Posts
    18

    Re: get image from scene

    thanks McLeary!I'm reading it.

  6. #6
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,574

    Re: get image from scene

    Not a problem, as soon as you don't show it.
    example :

    :loop
    glClear
    draw view from bird's position
    glReadPixels that
    glClear
    draw normal view
    swapbuffers
    goto :loop

    FBO is a safer way to do that, but you can easily try first on the default frame buffer.

  7. #7
    Junior Member Newbie
    Join Date
    Jan 2011
    Posts
    18

    Re: get image from scene

    it's great!I'll try it.thanks,ZbuffeR!

Similar Threads

  1. Multithreading: Loader image while loading scene assets
    By zaldivar.alvarez in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 07-08-2016, 05:01 AM
  2. Background image behind 3D scene
    By Ivan_j_147 in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 11-23-2012, 08:12 AM
  3. Display 2D image overtop of 3D scene
    By CaptainOatz in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 11-21-2007, 12:25 PM
  4. Move an Image with mouse on the scene?
    By mehdi in forum OpenGL: Advanced Coding
    Replies: 0
    Last Post: 10-27-2003, 04:35 AM
  5. how to display 2d scene on top of 3d scene???
    By immy in forum OpenGL: Advanced Coding
    Replies: 4
    Last Post: 03-26-2002, 04:13 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean