Results 1 to 2 of 2

Thread: glReadPixels error

  1. #1
    Senior Member Regular Contributor
    Join Date
    Aug 2010
    Posts
    114

    glReadPixels error

    Code :
    /*Read values back*/
    /*Set the target framebuffer to read*/
    glReadBuffer(GL_FRONT);
    /*Read the packet payload from framebuffer to PBO*/
    glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, pboread);
        	glReadPixels(0,0,size,noOfpacket,GL_RED,GL_UNSIGNED_BYTE,0);
    checkError("Readpixel");
    printf("Data after roundtrip:\n");
     
    /*Map the PBO to process the data by CPU*/
    glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, pboread);
    	glBufferDataARB(GL_PIXEL_PACK_BUFFER_ARB,noOfpacket*size,result,GL_STREAM_READ_ARB);
    for (i=0; i<noOfpacket*size; i++)
            printf("%c",result[i]);
    printf("\n\n");
    glUnmapBufferARB(GL_PIXEL_PACK_BUFFER_ARB);

    It returns me GL Error: Invalid enumerant. I cant find this error from the glReadPixels functions.

    Here is the function check code:

    Code :
    void checkError(char *str)
    {
    	GLenum error;
     
    	if ((error = glGetError()) != GL_NO_ERROR)
    		printf("GL Error: %s (%s)\n", gluErrorString(error), str);
    }

    This is GL error but not the function error right? Why?

  2. #2
    Newbie OpenGL Pro
    Join Date
    Jan 2007
    Posts
    1,789

    Re: glReadPixels error

    Read the documentation - glGetError doesn't necessarily return an error from the function immediately preceding it. There's no evidence that it was glReadPixels that threw the error; in fact if this is the only place you call glGetError in your code the function that caused the error could be anywhere.

Similar Threads

  1. Shader Compile Error: ERROR: 0:1: '' : syntax error #version
    By Blakeasd in forum OpenGL: Basic Coding
    Replies: 12
    Last Post: 07-25-2013, 07:35 PM
  2. ERROR: 0:17:'f' : syntax error parse error
    By hopeless in forum OpenGL: GLSL
    Replies: 1
    Last Post: 08-23-2010, 01:05 PM
  3. Replies: 1
    Last Post: 09-24-2007, 04:02 AM
  4. Error with glReadPixels
    By yage0832 in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 02-04-2004, 03:31 AM
  5. Replies: 3
    Last Post: 02-07-2003, 05:06 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