Hi Guys, sorry for my bad english
I’m quite of a beginner in C++/OpengGl. My task is to implement a zoom-blur in a video stream. I have to do this for work, so i really hope you can help me.
I have a running VS Project (2008) where YUV-images are bind to gl_texture_rectangle and then rendered and I planned to use this code for a zoom-blur:
http://mierendo.com/software/3d_filter_blurring/
I thought it would be quite a copy/paste thing, but actually i got problems with the gl_texture_rectangle.
The filter blurring example works with gl_texture_2d and my source code with 3 layers (yuv) of gl_texture_rectangle.
The streamed image is black/white anywhere, so i tried to manipulate the first layer, representing the Y value but failed.
int i;
int passes = 20;
glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_RECTANGLE,1); glTexImage2D(GL_TEXTURE_RECTANGLE,0,GL_LUMINANCE,WIDTH,HEIGHT,0,GL_LUMINANCE,GL_UNSIGNED_BYTE,0); glEnable (GL_BLEND); glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
while (passes > 0) { for (i = 0; i < 2; i++) { glColor4f (1.0f,1.0f,1.0f,1.0 / (i+1)); glBegin (GL_TRIANGLE_STRIP); glTexCoord2f (0 - (i*0.5)/WIDTH, 1 + (i*0.5)/HEIGHT); glVertex2f (0, 0); glTexCoord2f (0 - (i*0.5)/WIDTH, 0 - (i*0.5)/HEIGHT); glVertex2f (0, HEIGHT); glTexCoord2f (1 + (i*0.5)/WIDTH, 1 + (i*0.5)/HEIGHT); glVertex2f (WIDTH, 0); glTexCoord2f (1 + (i*0.5)/WIDTH, 0 - (i*0.5)/HEIGHT); glVertex2f (WIDTH, HEIGHT); glEnd (); } glCopyTexImage2D (GL_TEXTURE_RECTANGLE, 0, GL_LUMINANCE, 0, 0, WIDTH, HEIGHT, 0); passes--; } glDisable (GL_BLEND);
It seems like Texture_Rectangle can’t handle the float values (i also tested integer but failed)
I get a picture black and white, perhaps u can call it blurry, but no grey in it any more. Like there are just 1 or 0.
I also tried to read pixels from the Pixelbuffer (glReadPixels) but i got a error in the Dissasembly, no matter how big data is.
uint8_t data[640*480];
glReadPixels(0,0,640,480,GL_LUMINANCE,GL_UNSIGNED_BYTE,data);
Is there any possibility to get the gl_texture_2d into a gl_texture_2d, so i can use the code from above?
If not, can i read the texture data from the framebuffer into a gl_texture_2d, manupulate it and then write the data to framebuffer?
I’m dealing with this problem since 3 weeks and really tried, but I’m no computer scientist and meanwhile a little bit depressed.
Because i’m not shure whether i’m allowed to post all the code, someone who is interessted in helping me, just pn me.
Apart from that i hope for any help.