First issue, from
https://openframeworks.cc/setup/raspberrypi/raspberry-pi-getting-started/
Select 7 Advanced Options and hit Enter
Select GL Driver and hit Enter
Select either GL Driver Fake KMS or GL Driver Full KMS or from the options and hit Enter
I believe this conflicts with the previous paragraph
Select 3 Boot Options
Select B1 Console or B2 Console Autologin
The above advice will result in
pi@RPI4:~/OF_11/openFrameworks/apps/myApps/emptyExample/bin $ ./emptyExample
[ error ] ofAppGLFWWindow: 65544: X11: Failed to open display :0
[ error ] ofAppGLFWWindow: couldn't init GLFW
[ error ] ofAppGLFWWindow: 65537: The GLFW library is not initialized
[notice ]
emptyExample: /build/glfw3-UExs5r/glfw3-3.2.1/src/window.c:412: glfwWindowShouldClose: Assertion `window != NULL' failed.
[verbose] ofSignalHandler: Aborted
emptyExample: /build/glfw3-UExs5r/glfw3-3.2.1/src/window.c:421: glfwSetWindowShouldClose: Assertion `window != NULL' failed.
Aborted
Main issue/Question
Should ofGetEGLDisplay/ofGetEGLContext work with the below?
I have things setup as
Driver: GL (Fake KMS) OpenGL desktop driver with fake KMS
Boot Options: Desktop AutoLogin
Single file sample code:
#include "ofMain.h"
class ofApp : public ofBaseApp{
public:
void setup()
{
ofLog() << glGetString(GL_VERSION);
}
void update() { }
bool hasProbed = false;
void draw()
{
if (!hasProbed)
{
bool hasDisplay = false;
bool hasContext = false;
ofAppGLFWWindow* winptr = static_cast<ofAppGLFWWindow*>(ofGetWindowPtr());
GLFWwindow* glfwWindow = winptr->getGLFWWindow();
EGLContext eglDisplay = ofGetEGLDisplay();
if (eglDisplay == EGL_NO_DISPLAY)
{
ofLog() << "EGL_NO_DISPLAY";
}else
{
hasDisplay = true;
}
EGLContext eglContext = ofGetEGLContext();
if (eglContext == EGL_NO_CONTEXT)
{
ofLog() << "EGL_NO_CONTEXT";
}else
{
hasContext = true;
}
hasProbed = true;
ofLog() << "hasDisplay: " << hasDisplay;
ofLog() << "hasContext: " << hasContext;
auto x11Window = ofGetWindowPtr()->getX11Window();
if(x11Window)
{
ofLog() << "HAS X11 WINDOW";
}
}
}
};
int main( )
{
bool isTARGET_OPENGLES = false;
bool isTARGET_LINUX = false;
#if defined(TARGET_OPENGLES)
isTARGET_OPENGLES = true;
#endif
#if defined(TARGET_LINUX)
isTARGET_LINUX = true;
#endif
ofSetLogLevel(OF_LOG_VERBOSE);
ofLog() << "isTARGET_OPENGLES: " << isTARGET_OPENGLES;
ofLog() << "isTARGET_LINUX: " << isTARGET_LINUX;
#if 1
ofGLESWindowSettings settings;
settings.setSize(1280, 720);
settings.setGLESVersion(2);
ofCreateWindow(settings);
ofRunApp( new ofApp());
#else
ofSetupOpenGL(1280, 720, OF_WINDOW);
ofRunApp( new ofApp());
#endif
}
Using the default ofSetupOpenGL
path I get a blank X11 window and the following
[notice ] isTARGET_OPENGLES: 1
[notice ] isTARGET_LINUX: 1
[verbose] GL Version:OpenGL ES-CM 1.1 Mesa 19.2.0-rc1
[notice ] OpenGL ES-CM 1.1 Mesa 19.2.0-rc1
[notice ] EGL_NO_DISPLAY
[notice ] EGL_NO_CONTEXT
[notice ] hasDisplay: 0
[notice ] hasContext: 0
If I switch to using ofGLESWindowSettings I get
[notice ] isTARGET_OPENGLES: 1
[notice ] isTARGET_LINUX: 1
[verbose] GL Version:OpenGL ES 3.0 Mesa 19.2.0-rc1
[verbose] ofShader: checkAndCreateProgram(): creating GLSL program
[verbose] ofShader: setupShaderFromSource(): GL_VERTEX_SHADER shader compiled
[verbose] ofShader: setupShaderFromSource(): GL_FRAGMENT_SHADER shader compiled
[verbose] ofShader: linkProgram(): attaching GL_FRAGMENT_SHADER shader to program 1
[verbose] ofShader: linkProgram(): attaching GL_VERTEX_SHADER shader to program 1
[verbose] ofShader: checkProgramLinkStatus(): program 1 linked
[notice ] OpenGL ES 3.0 Mesa 19.2.0-rc1
[notice ] EGL_NO_DISPLAY
[notice ] EGL_NO_CONTEXT
[notice ] hasDisplay: 0
[notice ] hasContext: 0