ofFbo maximum size

Hello, I’m trying to write a image from an ofFbo for print, and it seems after 6600 x 6600 px it starts to fail and write glitch. Is there some way of increasing this maximum size? Thank you!

You may be running into a maximum texture size …

If you put this in your setup() method

    GLint maxTextureSize;
    glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTextureSize);
    std::cout <<"Max texture size: " << maxTextureSize << std::endl;

What does it tell you?

thanks @bakercp , it outputs:
Max texture size: 16384

Hmm … I was hoping it would say something like 6600 :slight_smile: not sure exactly what the problem would – could you share a minimal amount of code to reproduce the issue?

Great @bakercp, I’m sharing the minimum code to reproduce the issue.
if the variable “aresta” is lower than 6700 here it works.

    if (key == 'a') {
        cout << "begin saving" << endl;
        ofPixels pixelsTemp;
        ofFbo fboTemp;
        int aresta = 6800;
        fboTemp.allocate(aresta,aresta, GL_RGBA);
        pixelsTemp.allocate( fboTemp.getWidth(), fboTemp.getHeight(), OF_IMAGE_COLOR_ALPHA);
        fboTemp.begin();
        ofClear(0);
        ofSetColor(255,0,255);
        ofRect(0,0,fboTemp.getWidth(), fboTemp.getHeight());
        fboTemp.end();
        fboTemp.readToPixels(pixelsTemp);
        ofSaveImage(pixelsTemp, "test.tif");
        cout << "end saving" << endl;
    }

I have a similar issue relating to ofPixels: both on Win10 and Lubuntu the maximum size I can allocate is 8191x8191. Windows reports GL_MAX_TEXTURE_SIZE to be 16384.
In any case there would be no restriction for ofPixels dimensions relating to available texture memory, right? That is why I use ofPixels rather than ofImage. Is there a special reason for this limit? Thanks.

code:
static void testOfPixelsMemory()
{
// crashes 8192 on Win10 and Linux
ofPixels p;

    size_t numChannels = 4;
    size_t dim = 8100;
    size_t totalPixels;
    size_t totalBytes;
    for (size_t i = 0; i < 100000; ++i) {
        totalPixels = dim*dim;
        totalBytes = totalPixels * numChannels;
        ofLogNotice("testOfPixelsMemory") << "................................................";
        ofLogNotice("testOfPixelsMemory") << "GL_MAX_TEXTURE_SIZE: " << ofxImageHelpers::getMaxTextureSize();
        ofLogNotice("testOfPixelsMemory") << "dim       : " << dim << "x" << dim;
        ofLogNotice("testOfPixelsMemory") << "totalBytes: " << totalBytes << " b";
        ofLogNotice("testOfPixelsMemory") << "totalBytes: " << totalBytes / 1024 << " kb";
        ofLogNotice("testOfPixelsMemory") << "totalBytes: " << totalBytes / 1024 / 1024 << " mb";
        ofLogNotice("testOfPixelsMemory") << "totalBytes: " << totalBytes / 1024 / 1024 / 1024.0f << " gb";
        p.allocate(dim, dim, OF_IMAGE_COLOR_ALPHA);
        ofLogNotice("testOfPixelsMemory") << "allocated OK: OF_IMAGE_COLOR_ALPHA";
        dim += 1;
    }
}