Quantcast
Channel: arm - openFrameworks
Viewing all articles
Browse latest Browse all 147

Reported display display size with 320x240 TFT on Raspberry Pi

$
0
0

pizthewiz wrote:

Smaller TFT displays for the Raspberry Pi like this 3.5" one from Adafruit
3.5" TFT

have smaller resolutions (this one is 320x240) and force the console size by using the framebuffer_width and framebuffer_height values in /boot/config.txt. Strangely when running an oF application with these displays, oF reports a display size of 720x480:

[…]
[notice ] ofAppEGLWindow: setupRPiNativeWindow(): screenRect: 720x480
[notice ] ofAppEGLWindow: setupRPiNativeWindow(): windowRect: 320x240
[…]

which results in the content being draw as if it were really on a larger display - in this case both scaled and horizontally squashed since it isn't the same aspect ratio. I poked through the code a little and came upon ofAppEGLWindow.cpp

ofPoint ofAppEGLWindow::getScreenSize(){
  unsigned int screenWidth = 0;
  unsigned int screenHeight = 0;

  if(isUsingX11) {
    […]      
  } else {
    #ifdef TARGET_RASPBERRY_PI
      int success = graphics_get_display_size(settings.screenNum, &screenWidth, &screenHeight);
      if(success < 0) {
        ofLogError("ofAppEGLWindow") << "getScreenSize(): tried to get display size but failed";
      }

    #else
      ofLogError("ofAppEGLWindow") << "getScreenSize(): no native window type for this system, perhaps try X11?";
    #endif

  }

  return ofPoint(screenWidth, screenHeight,0);
}

and debugging that (I couldn't get gdb to print local variables so I added a log and rebuilt cry) I could see the values out of graphics_get_display_size were 720 and 480. This function seems to be declared in bcm_host.h

int32_t graphics_get_display_size( const uint16_t display_number,
                                                    uint32_t *width,
                                                    uint32_t *height);

which seems like VideoCore stuff, so I'm guessing maybe the GL context has some sort of minimum size it'll support?

Have others run into this? Could the viewport be used to compensate for the transforms that are being applied?

Posts: 11

Participants: 4

Read full topic


Viewing all articles
Browse latest Browse all 147

Trending Articles