View Full Version : best way to store, blit, and render pixel data
01-09-2011, 05:59 PM
ok so i finely got glew working so i have access to all these new(well new to me) features like FBO's PBO's and other stuff. i want to make a class in witch i can blit small images to a larger image and display that on the screen. i want to be able to have the class blit 1 things to another and then later have another class render this image quickly. how might i do that?
01-09-2011, 06:51 PM
ok i think frame buffers will actually work well here, i didn't realize you could blit them like that. alright i have it working so that i can blit images to the screen but i can't get the alpha Chanel to blit.
01-10-2011, 01:50 AM
Are you sure both source FBO and on screen framebuffer have alpha channel ?
01-10-2011, 09:22 AM
no, i know the on screen one dose but i don't know about the source frame buffer.
here is how i set it up
glBindRenderbuffer(GL_RENDERBUFFER,rbo); glRenderbufferStorage(GL_RENDERBUFFER,GL_RGBA,zomb ie->getWidth(),zombie->getHeight());
glFramebufferRenderbuffer(GL_FRAMEBUFFER,GL_COLOR_ ATTACHMENT0,GL_RENDERBUFFER, rbo);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, zombie->tex, 0);
and here is how i blit it to the screen
edit: fbo is the frame buffer object and rbo is the render buffer object in case that wasn't clear.
also i think the ortho is set up differently becuase when i blit it to (0,0) it blits it to (0,800) with the width going the wrong way. ill post a picture of what i mean if want
01-10-2011, 01:34 PM
how do i check if my frame buffer supports an alpha channel?
01-10-2011, 02:13 PM
When frame buffer is bound, you can glDrawPixels on it with specific alpha values, then glReadPixels that to check alpha values are the same.
Do not forget to disable depth test, blending, stencil test etc.
01-10-2011, 08:34 PM
ok so i used the following to try and display the data, did i do something wrong because it's not showing up anywhere?
unsigned int* data = new unsigned int[(zombie->getWidth()+1)*(zombie->getHeight()+1)];
delete  data;
Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.