PDA

View Full Version : Render to texture



Andreas K
06-22-2010, 10:39 PM
For offscreen rendering I do the following:

glGenFramebuffersEXT(1, &myFBO);

2) Bind the framebuffer object
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, myFBO);

3) Attach a texture to the FBO
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, myTexture, 0);

Question: I saw that texture and buffer must be same size.
But my texture will be scaled. So can I then just do a

SDL_CurrentVideo->glBindTexture( GL_TEXTURE_2D, texture->Id() );
paintInfo->SetOpenGLTextureMode( Alpha(), cForm, xForm.IsScaled(), texture );

even if source texture (unscaled) is smaller than buffer?

andreas

lobbel
06-23-2010, 09:33 AM
Hi,
according to your post you only attached one texture to your framebuffer. Furthermore you have no renderbuffer attached.
In this case there should be no problem rescaling your texture
that's attached to the framebuffer, because it's the only target.

regards,
lobbel

Andreas K
06-24-2010, 12:08 AM
lobbel, thanks!

Now I noticed that glrotated() has no effect? Is this because
not renderbuffer is attached? The texture scaled well.

When I attach a renderbuffer, I get GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS.

What now?

andreas