Results 1 to 3 of 3

Thread: how to assign an framebuf larger than screen size?

  1. #1
    Junior Member Newbie
    Join Date
    Sep 2008
    Posts
    15

    how to assign an framebuf larger than screen size?

    I want to render a texture offscreen, and the texture is larger than current screen. for example: a rotating teapot map on a cube.
    but the texture can only show a portion(as big as the windows)
    // first I render the teapot
    glViewport(0, 0, TEXTURE_WIDTH, TEXTURE_HEIGHT);
    ...drawTeapot();
    // bind the rendered image to texture
    glBindTexture(GL_TEXTURE_2D, textureId);
    glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, TEXTURE_WIDTH, TEXTURE_HEIGHT);
    glBindTexture(GL_TEXTURE_2D, 0);

    // then I render the cube
    glViewport(0, 0, screenWidth, screenHeight);
    ...draw();

    when running it, everything is ok but the texture of the cube can only show a part, when I resize the windows to bigger than texture-size, then it goes right.

    Is their any way to tell the openGL how big the size I need, rather than the screen size? It seems glViewport doesnt work

  2. #2
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,574

    Re: how to assign an framebuf larger than screen size?

    The OpenGL spec explicitely says that out-of-window and covered-by-other-windows parts are undefined.
    Instead, you have to render to an offscreen framebuffer designed for this :
    http://www.gamedev.net/reference/art...rticle2331.asp
    http://www.gamedev.net/reference/art...rticle2333.asp

  3. #3
    Junior Member Newbie
    Join Date
    Sep 2008
    Posts
    15

    Re: how to assign an framebuf larger than screen size?

    thankyou. gl_extention works good!

Similar Threads

  1. viewport fine, larger screen display blank
    By technologist in forum OpenGL: Basic Coding
    Replies: 9
    Last Post: 12-04-2017, 10:50 PM
  2. size of screen depends on what?
    By somnath in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 04-24-2011, 07:45 AM
  3. API for finding screen size
    By freddie in forum OpenGL: Basic Coding
    Replies: 6
    Last Post: 06-15-2008, 12:48 PM
  4. Replies: 10
    Last Post: 01-04-2007, 12:02 AM
  5. how to set up window larger than current screen size
    By xueming1164 in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 05-08-2006, 01:54 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean