Jump to content
  • Advertisement
Sign in to follow this  
bukiyou

manipulating display sizes with FBO

This topic is 2683 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi,

This may be a simple question, but I cannot for the life of me figure out the answer.

I have an image that is rendered in perspective mode where there is a teapot 1 unit large. The rendered image is put into one of the colour fbo buffers.

I want to display the image in glortho(0, 1000, 0, 800, -10, 10) on a rectangle that is rect(0,0, 512, 512) large. The larger I try to make glortho, the smaller the teapot becomes relative to the drawn quad. At my desired size, the teapot is no longer visible. Also, glortho(0,1000, 0, 800, -10, 10) only shows the top right quadrant of the fbo texture image. If I use a normal texture instead of the fbo texture, then the texture does what it's supposed to do. What am I doing wrong? Is there something I should do with the renderobjects so that they'll be treated like proper textures?





glClearColor(1.0f, 0.0f, 0.0f, 1.0f); // Clear the background of our window to red
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); //Clear the colour buffer (more buffers later on)
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0,10, 0, 10, -10, 10); <------------at this size teapot is already two times smaller
glMatrixMode(GL_MODELVIEW);

glLoadIdentity();// Load the Identity Matrix to reset our drawing locations

glTranslatef(0.0f, 0.0f, -2.0f);

glBindTexture(GL_TEXTURE_2D, fbo_texture); // Bind our frame buffer texture

glBegin(GL_QUADS);

glTexCoord2f(0.0f, 0.0f);
glVertex3f(0, 0, 0.0f); // The bottom left corner

glTexCoord2f(0.0f, 1.0f);
glVertex3f(0, 5.0f, 0.0f); // The top left corner

glTexCoord2f(1.0f, 1.0f);
glVertex3f(5.0f, 5.0f, 0.0f); // The top right corner

glTexCoord2f(1.0f, 0.0f);
glVertex3f(5.0f, 0.0f, 0.0f); // The bottom right corner

glEnd();

glBindTexture(GL_TEXTURE_2D, 0); // Unbind any textures



any sort of help would be well appreciated. thanks for your time.

Share this post


Link to post
Share on other sites
Advertisement
My gut is that you're missing a glViewport call when you bind your FBO to draw to it, but I'd need to see your full FBO code to be sure. Can you post the section of your code where you draw the teapot into the framebuffer?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!