OF_fullscreen + RPI woes

Hi everyone,

Does enabling OF_FULLSCREEN affect displaying an ofImage in any way? This code that flips over half the image works fine when I’m using OF_WINDOW, but doesn’t draw anything but a black box when I enable OF_FULLSCREEN.

right.allocate(w, h, OF_IMAGE_COLOR);

right.clone(pic); //a picture taken from the camera

ofPixels rightPix = right.getPixelsRef();

  //flip one half of the image 
    for (int y = 0; y < h; y++) {
        for (int x = 0; x < w/2; x++) {
            int index = y*(w*3)+x*3;
            int rightIndex = ((w*3-(1*3)) -x*3) + y*(w*3);
            rightPix[rightIndex] = rightPix[index];
            rightPix[rightIndex + 1] = rightPix[index + 1];
            rightPix[rightIndex + 2] = rightPix[index + 2];
        }
    }

   //set the pixels to the OFImage
    right.setFromPixels(rightPix);

right.draw(0, 0);

It’s also worth noting that I run a variation on this code that takes the opposite side of the image and flips it – that works 100% fine even when using OF_FULLSCREEN! I’m going bonkers trying to debug this and could use some advice.

I’m on a Raspberry Pi running Raspbian, using the ofxRPiCameraVideoGrabber and WiringPi to talk to an attached Arduino.

Also, i know that OF_GAME_MODE is an alternative but it doesn’t seem to be working for me – it doesn’t stretch the canvas to fill the entire screen. Does it have something to do with the Pi’s display settings? I have tried fiddling around with them but I can’t seem to get the right combination.

Any advice would be most appreciated.

Did you ever see this example? it doesn’t display an ofImage but maybe can help you…

Thanks kalwalt! I did look that over (and still am) but am not really finding the solution yet.

I tried another approach, and that is enabling just OF_WINDOW and then toggling with ofToggleFullScreen(), or just using ofSetWindowShape(ofGetScreenWidth(), ofGetScreenHeight());

The ofImages are drawing again, but the get the weird effect below (the first picture is not fullscreen, the second is)

This is in fullscreen mode. Notice the canvas tiles and there is a weird flickering happening at the top.

Does it behave the same with the desktop disabled? If you are able to do without X11 you can save some GPU memory.

I don’t think OF_FULLSCREEN/OF_WINDOW has much effect on the RPi. I usually just set the width/height to the size of the monitor and use OF_WINDOW

The relevant code is here:

As you can see (and correctly noted) OF_GAME_MODE is not supported on RPI.

Unlike other windows (GLFW, etc), Raspberry Pi “fullscreen” mode does not enter any special display mode. It simply keeps track to two rectangles, the current non-full-screen-size and the size of the attached monitor screen (it queries the hardware for this info). When you toggle between fullscreen and non-fullscreen, it remakes the EGL context.

If you care, here’s the code for grabbing the monitor dimensions for the full-screen rect.

I have tested this extensively outside of the X11 environment (i.e. on the command line) and it has always worked great (toggling back and forth, starting in fullscreen, etc). But I have not tested it extensively inside of the X11 environment. I don’t know why it would make a difference, but it could be related to video memory (as @jvcleave suggested). It looks strangely like there is something going on on the hardware side of things …

I’d try existing from X11 and running it in from the terminal.

Also, just make sure that you are clearing any fbos, the background, textures, etc. visually it looks like you’re getting some glitches compliments of improperly allocated gpu memory … (which could be happening for any number of reasons).

Keep us posted!

1 Like

Interesting - if the camera is being used in texture mode (which if @lia pulled from the default github master branch that is the only mode is supports) it requires an EGL context when the texture is generated. My addon isn’t smart enough to detect this change and I bet that is memory artifacts being displayed on the screen. I am pretty surprised it doesn’t crash.

@jvcleave I am sending the windowResized() event, so if your addon subscribes to that, it might be a solution. (ofAddListener(...))

I will def look into it - the develop branch is much farther along but I
also have a bunch of stuff in there most don’t need

Hello. Sorry for reopen this old post…

I’m having this kind of ‘glitches’ when switching the RPi to fullscreen.
After reading this post, I am trying to use the OF_WINDOW mode, but fixing it to 1920x1080. (my native resolution)

ofSetupOpenGL(1920,1080,OF_WINDOW);
ofRunApp(new ofApp());

But I get a full grey screen. It’s strange, but if I set the window to 1900x1000 (smaller) it shows all correctly.
EDIT: but I have some strange behavior with the mouse.

Any idea of how to get the native full HD resolution?

EDIT: I am not using X, just compiling from OSX with ssh, and making the ‘sudo make run’ from RPi command line.

What memory split are you using? Try increasing the memory for gpu…

1 Like

I am using the same used for installing (following the tutorial).
I’ll try to change it. What is a good increase or config to use after the install for “normal use”?

I personally use a 128 or 256 split with my Raspberry Pi model B. It depends on what kind of things you are doing. It is easy to chance the split so you set it to a value and if you need more then chance it again.

1 Like

Did anyone figure out the solution to this yet? I’m having the exact same problem