Basic approach for large texture drawing

I have a triangle mesh (.obj format) textured to a large image. The resolution of the image (7216x5412) must be maintained since the goal is to produce a modified image of full resolution. Through another program I am modifying the mesh (flattening it through a physics simulation). So the x,y,z values of the mesh vertices have changed, though they are mapped to the same u,v coordinates in the texture image. My goal is to “redraw” the initial texture image, so that it is warped to correct for the flattening effect on the 3D mesh. I have been trying to redraw it by creating an OpenGL framebuffer of the desired image size, loading in the initial image as a texture, and then drawing the triangles of the 3D mesh one by one in 2D in the framebuffer before saving the buffer as an output image. Everything works except I get black images when I try to load the texture of the desired size (7216x5412) or anything above 4096*4096 (sometimes it works and sometimes it doesn’t above this size) even though the GL_MAX_TEXTURE_SIZE on my machine is 16384. Am I approaching this in the right way? Any advice is welcome on how I might break down the texture or get OpenGL to cooperate with what should be a reasonable texture size. I have not used OpenGL before this project and am not very familiar with what it has to offer or what else there might be for me to accomplish this task.

Are you checking for framebuffer completeness and for GL errors? If not, do that first. Post a code snippet creating and setting up the texture(s) and FBO(s) for comment if unsure about what to do.

What GPU do you have, and how much GPU memory is available on it? How much have you already used before go to create this huge texture?

I’m wondering if, though your driver says it could support it, you don’t have enough GPU memory to actually store it. Or the size is too large for FBO rendering on your GPU.

Let’s see: 7216*5412 = 37.2 Mpixels. Let’s say you’re using 4 bytes/texel (RGBA8). That’s 149MB just for the base map at 1XAA. And let’s say you’re creating a std 32-bit depth buffer for your FBO; that’s another 149MB. So 298MB. Are you using MSAA? If so, that’s considerably more memory.

Another thought comes to mind: the maximum renderable FBO resolution can differ from the maximum supported texture resolution. A snippet from ARB_framebuffer_no_attachments:

Here, GL_MAX_TEXTURE_SIZE == GL_MAX_FRAMEBUFFER_{WIDTH,HEIGHT} == 16384. But you might check and see what it is on your GPU.