Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Render to Texture rendering at texture-size.

This topic is 5603 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

this is one of those stupid bugs that can probably be solved with one line of code, but i sure as hell can't do it! the effect i'm doing is to render the frame buffer (1024x768) to a texture (texture dimentions are 320x240. yes, that is allowed - i'm using TEXTURE_RECTANGLE_NV). The frame buffer renders to the texture perfectly, but when i try and draw a fullscreen quad with the texture, it doesn't take up the entire of the screen some images:

GLuint LowRes;
int LowResX = 320;
int LowResY = 240;

#define WIN_WIDTH 1024
#define WIN_HEIGHT 768

bool UseLowRes = true;

void App_Render ()
    glLoadIdentity ();

    if (UseLowRes)
        glViewport (0, 0, LowResX, LowResY);

// Render the world


    if (UseLowRes)
        glActiveTextureARB (GL_TEXTURE1_ARB);
        glBindTexture (GL_TEXTURE_2D, 0);

        glActiveTextureARB (GL_TEXTURE0_ARB);
        glEnable (GL_TEXTURE_RECTANGLE_NV);
        glBindTexture (GL_TEXTURE_RECTANGLE_NV, LowRes);
        glCopyTexSubImage2D (GL_TEXTURE_RECTANGLE_NV, 0, 0, 0, 0, 0, LowResX, LowResY);

        glViewport (0, 0, WIN_WIDTH, WIN_HEIGHT);

        glLoadIdentity ();

        glMatrixMode (GL_PROJECTION);
        glPushMatrix ();
        glOrtho (0, WIN_WIDTH, 0, WIN_HEIGHT, 0, -1);
        glMatrixMode (GL_MODELVIEW);
        glDisable (GL_DEPTH_TEST);

        glBegin (GL_QUADS);
            glTexCoord2f (0, 0);              glVertex3f (0,          0,          -0.1);
            glTexCoord2f (0, LowResY);        glVertex3f (0,          WIN_HEIGHT, -0.1);
            glTexCoord2f (LowResX, LowResY);  glVertex3f (WIN_WIDTH,  WIN_HEIGHT, -0.1);
            glTexCoord2f (LowResX, 0);        glVertex3f (WIN_WIDTH,  0,          -0.1);
        glEnd ();

        glMatrixMode (GL_PROJECTION);
        glPopMatrix ();
        glMatrixMode (GL_MODELVIEW);

        glEnable (GL_DEPTH_TEST);

        glDisable (GL_TEXTURE_RECTANGLE_NV);

thanks in advance [edited by - MENTAL on August 8, 2003 4:57:49 PM] [edited by - MENTAL on August 8, 2003 5:31:19 PM]

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!