PDA

View Full Version : Textures inside FBO



Jermye
06-20-2011, 12:32 PM
I have a FBO sized at 1024x1024. For this example, I render a texture that is 256x256 (all my textures will be this size) inside this FBO. The quad that I apply the texture to though does not take up a 256x256 area of the 1024x1024 of the FBO, it is smaller.

Now when I apply the FBO's texture to a quad of say 512x512 and I zoom in on it, the texture that I rendered inside it is very blurry. I render the same texture outside of the FBO on top just to compare and it is no where near as blurry.

Is there any way I can get rid of that blurriness? I attached two files, outlined in the skinny red line is the texture rendered outside of the fbo and the skinny blue line denotes the texture rendered inside the fbo. One picture is zoomed out where they look the same and the other is zoomed in where one is clearly too blurry.

I don't know if this helps but this is how I load the map texture (setting up the texture for my fbo is similar)


glBindTexture(GL_TEXTURE_2D, tex);
glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTE R,GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTE R,GL_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
glTexImage2D(GL_TEXTURE_2D, 0, img->bpp(), img->width(), img->height(), 0, GL_RGB, GL_UNSIGNED_BYTE, img->data());

Thanks