Skip to main content
gamedev.net
🔒 Locked

About glReadPixels

Started by chen884488shi Jul 10, 2008 at 1:39 AM 1 replies 600+ views
Original Post
chen884488shi
chen884488shi
In my program I want to use a picture as a texture. I load it like this: ///////////////////////////////////////////////////// data=(void*)pData; format = GL_BGRA; type = GL_HALF_FLOAT_NV; glDrawPixels(image_w, image_h, format, type, data);//image_w=4096,image_h=4096 ///////////////////////////////////////////////////////////// In fact,I can only see part of the picture.Most of the data out of screen. after render it ,I want to read the result data. I use glReadPixels(0, 0, image_w, 4096,GL_LUMINANCE, GL_UNSIGNED_BYTE,data1); But I can only get the data on the screen that I can see ,the other part of picture is black. How can it get all the data that I load? thanks.
ma_hty
ma_hty
Render to a FBO instead of render to the screen buffer directly.
Brother Bob
Brother Bob
OpenGL only guarantees correct values of visible pixels. That means, pixels outside the window, or pixels hidden by other windows, are not guaranteed to have correct values. You cannot get around that, other than rendering to an offscreen buffer. Check out pbuffer or FBO (frame buffer objects).

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.