How to copy/render a Pixel Buffer to the back buffer in OpenGL 3.X

I am trying to perform something like the old glDrawPixels: I have a Pixel buffer created with text and I would like to apply it to the back buffer (where all the scene is already rendered).

unsigned char a[] = {255, 255, 255, 255, 0, 0, 255, 255, 255, 255, 0, 0};

// What I would
//glDrawPixels(2, 2, GL_RGB, GL_UNSIGNED_BYTE, (GLvoid*)pixels);

// What I am trying
GLuint pbo = 0;
glGenBuffers(1, &pbo);
glBindBuffer( GL_PIXEL_UNPACK_BUFFER, pbo);
glBufferData(GL_PIXEL_UNPACK_BUFFER, 12, a, GL_STREAM_DRAW);
// Blit pbo to back buffer, but how?

// Release all
....

Most tutorial[1] seem to copy the pixel buffer to a texture and then apply this texture to a quad, but this solution seem to perform lot of unnecessary operations: copy the data, create filtering for the texture, draw a quad (which mean a new VBO), etc...

Other answers[2] speak about "Blitting", but I am unable to get it working.

Also, most information about OpenGL still use glDrawPixels which is deprecated (and unavailable) for OpenGL 3.X.

[1] http://www.songho.ca/opengl/gl_pbo.html

Render TTF SDL2.0 opengl 3.1

[2] https://devtalk.nvidia.com/default/topic/453751/cuda-programming-and-performance/direct-access-to-frame-buffer-/

链接地址: http://www.djcxy.com/p/45742.html

上一篇: 如何在Qt OpenGL中使用PBO

下一篇: 如何在OpenGL 3.X中将像素缓冲区复制/渲染到后台缓冲区