Results 1 to 2 of 2

Thread: Get the pixels from the OpenGL context.

  1. #1
    Junior Member Newbie
    Join Date
    Aug 2001
    Posts
    25

    Get the pixels from the OpenGL context.

    when I use :
    GLFloat* buffer=NULL;

    glReadPixels(0, 0, width, height, GL_RGB, GL_FLOAT, buffer );

    to get openGL frame, the variable buffer remains NULL. what's wrong with it?

    I am using MFC windows to display OpenGL view. the OpenGL viewport is set larger than the window size.

    please help me

  2. #2
    Senior Member Regular Contributor
    Join Date
    Jul 2001
    Posts
    442

    Re: Get the pixels from the OpenGL context.

    Originally posted by huangzl99:
    when I use :
    GLFloat* buffer=NULL;

    glReadPixels(0, 0, width, height, GL_RGB, GL_FLOAT, buffer );

    to get openGL frame, the variable buffer remains NULL. what's wrong with it?

    I am using MFC windows to display OpenGL view. the OpenGL viewport is set larger than the window size.

    please help me
    Try this:

    GLFloat buffer[WIDTH*HEIGHT*3];

    glReadPixels(0, 0, width, height, GL_RGB, GL_FLOAT, buffer );


    glReadPixels will ignore the entire command because the buffer you passed in is NULL. You need to pass in a pointer to a block of memory within which to place the pixel data.

    I've never used glReadPixels, so the above might not quite be right -

Similar Threads

  1. Replies: 2
    Last Post: 07-23-2018, 10:14 PM
  2. Replies: 1
    Last Post: 06-22-2013, 09:31 PM
  3. Replies: 9
    Last Post: 12-31-2012, 04:20 PM
  4. Replies: 2
    Last Post: 04-26-2010, 09:38 PM
  5. Replies: 1
    Last Post: 06-26-2003, 12:53 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