Hello Guest

FBO and OpenGL

  • 19 Replies
  • 19711 Views
*

Offline bobjob

  • ****
  • 394
  • LWJGL: WOW SO GOOD
Re: FBO and OpenGL
« Reply #15 on: June 24, 2009, 18:16:57 »
I attached an FBO demo with an explination to this thread
http://lwjgl.org/forum/index.php/topic,2745.0.html

Re: FBO and OpenGL
« Reply #16 on: June 24, 2009, 20:43:52 »
will follow up that.. thanks :).. i have a FBO with render buffers and textures attached to it.. now if i want to change the dimensions of them in such a way that the data contained in them is just scaled to the new dimensions.. how do it ? is it possible ?? and really thanks guys.. great work in this forum.. :) :)

*

Kai

Re: FBO and OpenGL
« Reply #17 on: June 26, 2009, 11:04:01 »
There is no standard easy way to scale a texture by a given factor. It depends on what you are trying to achieve. If you want to have the texture being displayed larger, you would just use either different texture co-ordinates on the primitive the texture should be mapped on, or use another modelview transformation or projection.
If you really want to build a (let's say) 512x512 texture out of a 256x256 one, you would need to scale the texels yourself in the host program and create a new texture from it with the new size.
Then, to scale the texture yourself, you would need some sort of filter (not just nearest neighbour) so that the result looks good.
Another (faster) way to scale a texture would be to render a fullscreen quad with the original texture mapped to it into another FBO that has a texture with the new bigger size attached to it (as well as an appropriate viewport with the new size being active).
That way, you use the hardware texture filtering (which is LINEAR by default).
The FBO with the bigger attached texture can even be the same as the one you created the original smaller texture with. You just need to create a new texture of the bigger size and attach that to the FBO and then render the fullscreen quad with the original smaller texture.

Re: FBO and OpenGL
« Reply #18 on: June 27, 2009, 16:37:25 »
hi. thanks for the previous reply. i have textures of size 256x256 and i will be requiring a resize of 2x or 4x only.. thanks a lot.. i have an FBO with a rendering done on it, i detach it and trying to draw the texture to the screen (screen in my problem is a small rectangle inside a big window).. i guess my matrix mode settings are a bit messed up. can anyone suggest me how do i achieve the correct transformations to draw the scene ?? the window is 640x480 and the screen(is a 400x400 rectangle from (0,0)). thanks

Re: FBO and OpenGL
« Reply #19 on: June 28, 2009, 17:58:49 »
Hi.. another problem on native rendering. i hv a FBO with texture having some drawing on it.. I need to render it to the screen natively affecting the screen buffer rather than giving it to OpenGL.. Is there a way in which i can do it ??