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: Simple pbo usage question

Hybrid View

  1. #1
    Intern Contributor
    Join Date
    Dec 2012
    Posts
    74

    Unhappy Simple pbo usage question

    Hi, Dear All!

    I've now stuck on a point of dealing with pbo object.

    I've written the following code,

    Code :
    GLubyte data[width*height];
     
    glGenBuffers(1,&pixelPackBuffer);
    glBindBuffer(GL_PIXEL_PACK_BUFFER,pixelPackBuffer);
    glBufferData(GL_PIXEL_PACK_BUFFER,width*height,data,GL_STATIC_READ);
    glReadPixels(0,0,width,height,GL_STENCIL_INDEX,GL_UNSIGNED_BYTE,BUFFER_OFFSET(0));

    but when I insert a breakpoint to view the content of the array data, found nothing was read. Any idea?
    Thanks in advance!

  2. #2
    Advanced Member Frequent Contributor
    Join Date
    Dec 2007
    Location
    Hungary
    Posts
    985
    You passed 'data' to glBufferData, which means that the buffer is initialized with the stuff in 'data', not that 'data' is your buffer object. Your buffer object's memory is in video memory, you have to read it with glGetBufferSubData or by reading the mapped pointer after a call to glMapBuffer[Range].

    If you want your own allocated memory (in this case 'data') to be the backing store of the buffer itself then you have to take a look at the AMD_pinned_memory extension, as that would allow you to do so. But I suppose that's not what you wanted to do here, just you misunderstood how buffer objects work.
    Disclaimer: This is my personal profile. Whatever I write here is my personal opinion and none of my statements or speculations are anyhow related to my employer and as such should not be treated as accurate or valid and in no case should those be considered to represent the opinions of my employer.
    Technical Blog: http://www.rastergrid.com/blog/

  3. #3
    Intern Contributor
    Join Date
    Dec 2012
    Posts
    74

    Talking

    Quote Originally Posted by aqnuep View Post
    You passed 'data' to glBufferData, which means that the buffer is initialized with the stuff in 'data', not that 'data' is your buffer object. Your buffer object's memory is in video memory, you have to read it with glGetBufferSubData or by reading the mapped pointer after a call to glMapBuffer[Range].

    If you want your own allocated memory (in this case 'data') to be the backing store of the buffer itself then you have to take a look at the AMD_pinned_memory extension, as that would allow you to do so. But I suppose that's not what you wanted to do here, just you misunderstood how buffer objects work.

    Hi, Dear aqneup!

    You solved my question. And you seem to be very familiar with AMD's opengl extension. Are you an employee of AMD? Can you tell me where to get ati cards' additional development kit or tools? I have searched the http://wwwd.amd.com but found no portal to such tools. Can you give me a linkage to that?


    Best Regards,


    newbiecow

Tags for this Thread

Posting Permissions

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