openframeworks / openFrameworks

openFrameworks is a community-developed cross platform toolkit for creative coding in C++.
http://openframeworks.cc
Other
9.9k stars 2.55k forks source link

Discuss: Make programmable rendered default + Option for running GL/GLES Latest #7689

Open ofTheo opened 11 months ago

ofTheo commented 11 months ago

At the moment testing projects on the Pi, so many don't work because of mismatched GL Versions specified in main.cpp. But this affects other platforms too. Supporting emscripten for an example becomes quite messy and then there is no guarantee the example will work on RPI.

eg:

int main( ){
// PBR only works with the programmable renderer
#ifdef TARGET_EMSCRIPTEN
    ofGLESWindowSettings settings;
    settings.glesVersion = 3;
#else
    //Use ofGLFWWindowSettings for more options like multi-monitor fullscreen
    ofGLWindowSettings settings;
    settings.setSize(1200, 768);
    settings.setGLVersion(3,2);
#endif

    settings.windowMode = OF_WINDOW; //can also be OF_FULLSCREEN
    auto window = ofCreateWindow(settings);

    ofRunApp(window, std::make_shared<ofApp>());
    ofRunMainLoop();
}

What if we switched to programmable renderer by default and while still allowing GL and GLES versions we have something like this:

int main( ){

    ofWindowSettings settings; 
    settings.setRenderer(OF_GL_LATEST); //uses latest GL or GLES version supported, this could even be the default behavior
    settings.windowMode = OF_WINDOW; //can also be OF_FULLSCREEN
    auto window = ofCreateWindow(settings);

    ofRunApp(window, std::make_shared<ofApp>());
    ofRunMainLoop();
}

With legacy (current) behavior:

int main( ){

    ofGLWindowSettings settings; 
    settings.setRenderer(OF_GL_LEGACY); //can use this to use the old default 
    //settings.setGLVersion(3,2); //or uncomment to specify a specific version 
    settings.windowMode = OF_WINDOW; //can also be OF_FULLSCREEN
    auto window = ofCreateWindow(settings);

    ofRunApp(window, std::make_shared<ofApp>());
    ofRunMainLoop();
}
danoli3 commented 11 months ago

Yeah if we can decouple and clean up mains 100%, as long as legacy way also works, if we just run latest renderer and lastest type by default as long as logged by default sounds great

NickHardeman commented 11 months ago

+1 Yes, having the programmable renderer with the latest updated GL version by default would be incredible. Especially just setting it on ofWindowSettings.

dimitre commented 11 months ago

I'm good for having programmable as default with the option of using legacy (2,1) manually