Cannot render to entire DocumentWindow/Component

I am trying to render data in an entire DocumentWindow, but am unable to properly achieve it. The rendered data appears in the lower, left part of the window and is always the same portion of the window in both x- and y-direction. I have a custom class for the DocumentWindow and an OpenGLAppComponent to render to. I have tried to resize things to my best knowledge, but I cannot get it to work. What am I doing wrong? I am on a 4k screen, but that should not matter.

Here are the relevant parts from the cpp files. I have bolded the things that might be of interest. Please let me know if you need anything else.

QAWindow.cpp (relevant parts only). I do nothing to DocumentWindow::resized().

QAWindow::QAWindow(const int& width, const int& height, QAHandler* qaHandler, const QARun& qaRun, const unsigned int& compositeIndex) :
    DocumentWindow(qaRun.QAComposites[compositeIndex]["QACompositeName"], Colours::lightgrey, DocumentWindow::allButtons),
    markedForDeletion(false),
    mQAView(nullptr)
{
    setFullScreen(true);
    setUsingNativeTitleBar(true);
        
    mQAView = juce::ScopedPointer<QAView>(new QAView(getWidth(), getHeight(), this, qaHandler, qaRun, compositeIndex));

    setContentOwned(mQAView, true);
    setResizable(true, true);
    centreWithSize(getWidth(), getHeight());
    setVisible(true);
}

QAView.cpp

QAView::QAView(const int& width, const int& height, QAWindow* qaWindow, QAHandler* qaHandler, const QARun& qaRun, const unsigned int& compositeIndex) :
    mQAWindow(qaWindow, false),
    mQAHandler(qaHandler, false),
    mQASettings(qaRun.QASettings),
    mQACaseState(ReadyForNextCase),
    mQACompositeName(qaRun.getQACompositeName(compositeIndex)),
    mQACompositeCommands(qaRun.getQACompositeCommands(compositeIndex)),
    mQACases(qaRun.getQACaseDeque()),
    mInitialized(false)
{
    setSize(width, height);
}

QAView::~QAView()
{
    shutdownOpenGL();
}

// initialise() is called on OpenGL context creation.
void QAView::initialise()
{
    std::string out;
    myVR::initialize(juce::JSON::toString(mQASettings).toStdString(), this);
    mQACompositeId = myVR::createComposite();
    LOGQAi("Create composite with id %i.", mQACompositeId);
    myVR::execute(mQACompositeId, juce::JSON::toString(mQACompositeCommands).toStdString(), out);


    myVR::setCompositeWindow(mQACompositeId, 0, 0, mQAWindow->getWidth(), mQAWindow->getHeight());
    mInitialized = true;
}

// Called on OpenGL context closing.
void QAView::shutdown()
{
}

void QAView::render()
{
    if (mInitialized)
    {
        myVR::render(mQACompositeId);
        runCases();
    }
}

void QAView::paint(Graphics& g)
{
}
        
void QAView::resized()
{
    myVR::setCompositeWindow(mQACompositeId, 0, 0, mQAWindow->getWidth(), mQAWindow->getHeight());
}

Here is an image describing the situation:

After resizing/squashing the window, this is the result:

Can't see how this is a juce problem.. You're using some kind of other embedded window thing, and presumably it's not handling the screen resolution correctly when it draws?

The `myVR` part is our own rendering engine which renders directly to the OpenGLContext. The call to myVR::setCompositeWindow sets the area to which the SDK will render. At the point myVR::setCompositeWindow is called, the juce::DocumentWindow returns width and height smaller than the actual window is. On my 4k screen (3840 x 2160) DocumentWindow::getWidth() and DocumentWindow::getHeight() returns 3072 x 1661. These values are then passed onto our SDK, thus it does not render the whole window. I also called getTransform() to check if something was there, but there is no transform set (Identity is returned).

So the question is: why does the DocumentWindow give me values that are lower than the actual window size? I suspect some scaling issues with 4k screens or Windows 8.1 scaling effects that are propagated into code. Are these kind of settings read in somewhere in the framework? How can I get them to check their values?

I have verified this behavior in two Windows 8.1 dekstops with 4k screens and on a MacBook Pro running Windows 8.1. The behavior is indepenedent on which window size I set.

A strange thing that happened was the following, but I am not able to reproduce:

1. Changed my system language from Norwegian to English.

2. Reboot.

3. Now it rendered fullscreen!

4. Change language back to Norwegian.

5. Reboot.

6. Now it renders part of the window again.

7. Change language to English.

8. Reboot.

9. Now it renders a part of the screen only.

I have no idea what happened here, but this behavior makes me suspect something quirky in Windows 8.1.

Alright, bug/behavior confirmed. In Windows 8, go to control panel --> Appearance and Persolaisation --> Display. Click "Let me choose one scaling for all my displays". Here, the default value is "Larger - 150% (default)". Change this to "Smaller - 100%" and everything renders as expected. That is, DocumentWindow::getWidth() and DocumentWindow::getHeight() now returns the actual size of the window. Choosing Larger values in the Windows settings makes this behavior worse, while 100 % keeps it "normal". Maybe something to look into? I guess the issue is resolved on my part anyway.

All the component sizes are reported in device-independent pixels. If you're doing something where you need to deal with physical pixels, you'll need to look at things like Component::getDesktopScaleFactor()

Using Component::getDesktopScaleFactor() works perfect.

Cheers!

All juce coordinates are device-independent. If you need to deal with physical pixels in some kind of custom code then you'd need to look at things like Component::getDesktopScaleFactor()