1 Reply Latest reply on Nov 9, 2011 5:18 AM by messerli_mike

    problem with PBO


      I am having problem with using pixel buffer object for uploading data to textures . My code works fine in ATI machine but doesn't work in machine having


      Renderer Name     Intel(R) HD Graphics Family
      Renderer Version     3.0.0 - Build
      Renderer Type     Installable client


      I wanted to know whether there are some known issues related to this driver or my i m doing something wrong in my code . Please see the code snippet below . I checked before posting and gl_arb_pixel_buffer_object extension was available , and the glTexSubImage2d call was giving error GL_INVALID_OPERATION .



      GLuint InitializeTexturePBO(CPUInt16 bufferSize)
           GLuint pbo;
           (*m_glBindBufferARB)(GL_PIXEL_UNPACK_BUFFER_ARB, pbo);
                bufferSize , NULL , GL_STREAM_DRAW_ARB);
           (*m_glBindBufferARB)(GL_PIXEL_UNPACK_BUFFER_ARB, 0);
           return pbo;
      void* GetPBOBufferPointer(unsigned int identifier ,int width , int height)
           (*m_glBindBufferARB)(GL_PIXEL_UNPACK_BUFFER_ARB, identifier );
           (*m_glBufferDataARB)(GL_PIXEL_UNPACK_BUFFER_ARB, width*height*4 ,
            0, GL_STREAM_DRAW_ARB);
           return (void*)(*m_glMapBufferARB)(GL_PIXEL_UNPACK_BUFFER_ARB,
      void UnmapPBOBuffer()
                       throw CustomException();
           (*m_glBindBufferARB)(GL_PIXEL_UNPACK_BUFFER_ARB, 0);





      I call them in this order ->


      InitializeTexturePBO(); // removed the arguments
      GetPBOBufferPointer(); // take this pointer and decode video frames at this location
      glBindTexture(GL_TEXTURE_2D , textureObjectList[sourceID]);



        • 1. Re: problem with PBO

          Perhaps you could try to unmap the buffer before using the buffer data.


          Here is what the OpenGL Reference says about glMapBuffer / glUnmapBuffer:


          "... A mapped data store must be unmapped with glUnmapBuffer before its buffer

          object is used. Otherwise an error will be generated by any GL command that

          attempts to dereference the buffer object´s data store. ..."


          From the code snippet you provided it seems like you


          1. call your function GetPBOBufferPointer which maps the buffer

          2. write some data to the buffer

          3. bind your texture,

          4. call glTexSubImage2D

          5. and only then unmap and "unbind" the buffer object.


          So you could try the following:


          1. call your function GetPBOBufferPointer which maps the buffer

          2. write some data to the buffer

          3. unmap the buffer

          4. bind your texture

          5. call glTexSubImage2D

          6. and then "unbind" the buffer object


          Since I haven´t used PBOs myself, I could as well be completely off here.