Raspberry Pi2 OpenFrameworks Archlinux fullscreen tearing

Hello everybody,

I have this application made in OpenFrameworks trmxclient/trmxClient/src at master · Etza/trmxclient · GitHub
running on Archlinux on 3 raspberry pi2 which i configured about 10 years ago with wonderful help from @arturo, @jmcleave @theo and other people here and they have run perfectly ever since. (ofVideoPlayer crashes/freezes on RPi2 (news from Ecuador) - the problem was the video library of Raspbian, changing to Archlinux resolved the problem.)

however, i bought another raspberry pi2, exactly the same model, and on this one when i go into fullscreen (pressing f) the video tears.

I tried to solution it by using config-raspi but ended up breaking one of the pis that was working!

But anyway it is clear it’s not a problem with the software nor the pi itself but with the configuration of the pi

I have tried to see what is the difference in configuration between the Pis but can’t find any difference!

Does anyone have any clues? - the image is perfect in all ways when its not fullscreen but when i amplify it to fullscreen, it tears.

On the one Pi that works there is absolutely no problem - the fullscreen is perfect.
I am sure it must be some little tweak somewhere but I can’t find it!
I am with 128 MB assigned to the GPU on all of the Pis.

any ideas?
many thanks
pedro

Test using the same SD card in the other PI. if all works well you can clone the card itself, so you assure all config is properly ported.

yes, I am using the same card in all of them. I forgot to mention that the recently acquired Pi worked once in fullscreen yesterday without any configuration and then no more!

here is what my application tells me:
[pi@alarmpi trmxClient]$ make run
HOST_OS=Linux
checking pkg-config libraries: cairo zlib gstreamer-app-1.0 gstreamer-1.0 gstreamer-video-1.0 gstreamer-base-1.0 libudev freetype2 fontconfig sndfile openal openssl libpulse-simple alsa gtk±2.0 libmpg123 glesv1_cm glesv2 egl
[warning] ofInit: Couldn’t set UTF-8 locale, string manipulation functions
won’t work correctly for non ansi characters unless you specify a UTF-8 locale
manually using std::locale::global(std::locale(“locale”))
available locales can be queried with ‘locale -a’ in a terminal.
[notice ] ofAppEGLWindow: setupRPiNativeWindow(): screenRect: 1920x1200
[notice ] ofAppEGLWindow: setupRPiNativeWindow(): windowRect: 1280x720
[notice ] ofAppEGLWindow: createSurface(): setting up EGL Display
[notice ] ofAppEGLWindow: createSurface(): EGL Display correctly set 0x1
[notice ] ofAppEGLWindow: createSurface(): no current renderer selected
[notice ] ofAppEGLWindow: createSurface(): GLES2 renderer detected
[notice ] ofAppEGLWindow: createSurface(): surface created correctly
[notice ] ofAppEGLWindow: createSurface(): API bound correctly
[notice ] ofAppEGLWindow: createSurface(): -----EGL-----
[notice ] ofAppEGLWindow: createSurface(): EGL_VERSION_MAJOR = 1
[notice ] ofAppEGLWindow: createSurface(): EGL_VERSION_MINOR = 4
[notice ] ofAppEGLWindow: createSurface(): EGL_CLIENT_APIS = OpenGL_ES OpenVG
[notice ] ofAppEGLWindow: createSurface(): EGL_VENDOR = Broadcom
[notice ] ofAppEGLWindow: createSurface(): EGL_VERSION = 1.4
[notice ] ofAppEGLWindow: createSurface(): EGL_EXTENSIONS = EGL_KHR_image EGL_KHR_image_base EGL_KHR_image_pixmap EGL_KHR_vg_parent_image EGL_KHR_gl_texture_2D_image EGL_KHR_gl_texture_cubemap_image EGL_KHR_lock_surface
[notice ] ofAppEGLWindow: createSurface(): GL_RENDERER = VideoCore IV HW
[notice ] ofAppEGLWindow: createSurface(): GL_VERSION = OpenGL ES 2.0
[notice ] ofAppEGLWindow: createSurface(): GL_VENDOR = Broadcom
[notice ] ofAppEGLWindow: createSurface(): -------------
[notice ] ofAppEGLWindow: setupPeripherals(): peripheral setup complete
[notice ] ofAppEGLWindow: setupNativeUDev(): created udev object
[notice ] ofAppEGLWindow: setupMouse(): unabled to find mouse
[ error ] ofAppEGLWindow: setupMouse(): did not open mouse
[ error ] ofAppEGLWindow: setupMouse(): did not open mouse, mouse_fd < 0
[warning] ofAppEGLWindow: setupKeyboard(): unabled to find keyboard
[ error ] ofAppEGLWindow: setupKeyboard(): did not open keyboard
[ error ] ofAppEGLWindow: setupKeyboard(): did not open keyboard, keyboard_fd < 0
[notice ] ofAppEGLWindow: setupPeripherals(): native event setup complete
[warning] ofShader: GL_VERTEX_SHADER shader reports:
Compiled
[warning] precision mediump float;
#define IN attribute
#define OUT varying
#define TEXTURE texture2D
#define TARGET_OPENGLES
uniform mat4 modelViewMatrix; uniform mat4 projectionMatrix; uniform mat4 textureMatrix; uniform mat4 modelViewProjectionMatrix; uniform float usingTexture; uniform float usingColors; uniform vec4 globalColor; IN vec4 position; IN vec4 color; IN vec4 normal; IN vec2 texcoord; OUT vec4 colorVarying; OUT vec2 texCoordVarying; void main(){ gl_Position = modelViewProjectionMatrix * position; if(usingTexture>.5) texCoordVarying = (textureMatrix*vec4(texcoord.x,texcoord.y,0,1)).xy; if(usingColors>.5) colorVarying = color; else colorVarying = globalColor; }

[warning] ofShader: GL_FRAGMENT_SHADER shader reports:
Compiled
[warning] precision mediump float;
#define IN varying
#define OUT
#define TEXTURE texture2D
#define FRAG_COLOR gl_FragColor
#define TARGET_OPENGLES
uniform sampler2D src_tex_unit0; uniform float usingTexture; uniform float bitmapText; IN vec4 colorVarying; IN vec2 texCoordVarying; void main(){ vec4 tex; if(usingTexture>.5){ tex = TEXTURE(src_tex_unit0, texCoordVarying); if(bitmapText>.5 && tex.a < 0.5){ discard; }else{ FRAG_COLOR = colorVarying*tex; } }else{ FRAG_COLOR = colorVarying; } }

and this: ofGstVideoUtils: allocating with 1280x720 I420

I am happy to inform that the problem was faulty Pi power supply!

too hasty :frowning:
sometimes it tears, sometimes it doesn’t …

A few things to try:

  • ofSetVerticalSync(true); in ofApp::setup
  • Start the app in fullscreen and set the fullscreen dimensions in main.cpp
  • Make sure any pixels stuff you are doing in ofApp::update is inside a: if( myVideo.isFrameNew() ){
  • ofSetFramerate(30); or you might want to play around with that and see if it helps.

Are you using OF 0.11.2 an older version or the latest one ( Release nightly · openframeworks/openFrameworks · GitHub ) ?

thank you so much for this excellent advice @theo

will work on it and let you know how it goes!

so this will be the first thing i try in the main.cpp:

ofGLESWindowSettings settings;
settings.setGLESVersion(2);
settings.width = 1280;
settings.height = 720;
settings.windowMode = OF_FULLSCREEN

ofCreateWindow(settings);
ofHideCursor();
ofRunApp(new ofApp);

not sure where the : if( myVideo.isFrameNew() ){ would go - this is my ofApp::update in ofApp.cpp

//

ofApp::update(){

// OSC receiver queues up new messages, so you need to iterate
// through waiting messages to get each incoming message

// check for waiting messages
while(receiver.hasWaitingMessages()){
	// get the next message
	ofxOscMessage m;
	receiver.getNextMessage(&m);
	// Process the osc message
	processOSCMessage(&m);

}

//this is purely workaround for a mysterious OSCpack bug on 64bit linux
// after startup, reinit the receivers
// must be a timing problem, though - in debug, stepping through, it works.
if(ofGetFrameNum() == 60){
	receiver.setup(recvPort);
}

//Update Media Frames

for (int i = 0; i < (int)mediaFrames.size(); ++i){
	mediaFrames[i].update();
}

}

Hey @pedruski , I think .isFrameNew() can be used anyplace where you want some code to run if the video player has a new frame to process, draw, etc.

1 Like