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
// 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);

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

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 :

thankyou. gl_extention works good!