I’m using a PC and visual studio, and toggling between a window and full screen using ofToggleFullscreen.
It looks as though when in window mode, there are pixels cropped out of the window to the top left. About 10-15 in the x axis from the left and about 40-60 in the y axis from the top. Small, but enough to have caused me a headache with setting out from the top left corner.
Does anyone know what causes this and how to stop it?
This seems like a really basic issue to me, is there a simple fix that I don’t know about? Surely 0,0 for drawing and interaction should always be within the window?!
I realise that I could just work out the difference and translate by that, but it is still causing me some really buggy setout and interaction issues when using ofxDatGui…
As in the note I posted to this other question , it seems to me this is not the case. That is, 0,0 should be in the upper-left corner for 2-D drawing with z = 0.
But I think things drift a bit relative to the screen plane when they have a z coordinate, or perhaps for other reasons.
I’ve tried with just drawing a rectangle from 0,0, and after toggling from fullscreen to window, the rectangle is about 38 pixels displaced off the screen.
Oh you are toggling it while the program is running… do you start your program in full-screen or in windowed mode?
Hmm, I just added toggling to one of my 2D games, and it doesn’t do that to me, neither when I start in windowed or full screen mode. I wonder what is different between your program and mine?
I’m using a really basic test example; just setup, drawing a square at 0,0, and a bool to toggle the full screen mode.
It doesn’t make any difference wether the startup is full screen or not; the square is in the correct position in full screen mode and about -10,-38 from the top left location when not.
Meanwhile ofGetMouseX() etc returns the correct coordinates ie 0,0 at top left in both modes
This puts a small square at 0,0, and if you press the [ key, it will toggle window and full screen mode. On my computer, the square appears there even after toggling back and forth. I’d be curious if you see a different result?
In the circle case, the third parameter isn’t width but z coordinate. The 2D effect only works when everything is at z=0. If you set the third parameter in each ofDrawCircle to 0, the white circle should be centered in the black one. Otherwise you get a perspective effect.
I get this:
But you presumably get your display cut off by the Windows framing.
I notice your Windows framing has rather a different styling from mine, which I don’t recognize. Perhaps your desktop settings are not being understood well by OF? Is the size of the window you get including the framing the same size you request in the program, or is it larger (to include the framing outside) like mine is?
Hmm. Putting your screenshot in Photoshop, I see the size of the window under the title bar as 246 x 246, which matches what your mouse X,Y reports.
When I tell my sample to use a 250 x 250 window… I get a 250 x 250 window with the Windows 7 framing outside that area.
It looks like your window is 250 wide but includes 2 pixels of frame on all sides but the top, which since the window is 289 high including the frame and seems to cut off all but 26 rows of your 50 x 50 rectangle, seems to overlay the top of the display window another 22 pixels or so.
That does seem rather irregular, since yes that does mean that it’s not just overlaying the edges with the frame, and it’s not just taking a thick strip off the top, but it’s also stretching the height of the display by some amount, messing up the aspect ratio as well.
I assume if you run it, it will show like yours does on your computer, confirming it’s Windows 10’s way of showing the program that is the issue.
In which case, the question is how to get OF to respond and get Windows 10 to behave itself. I have so far avoided programming for Windows 10, so I’m not familiar with this issue or what can be done about it.
Edit: Googling a bit for “windows 10 stretching display”, I see there are quite a few pages going on about display stretching issues, but they’re all pretty primitively written so I haven’t yet found one that makes it clear whether it’s the same thing or some other issue.
The worst part is the origin being under the title bar, and the stretching.
It’s also peculiar to me that the screenshot you sent from running my version does have a 250 x 250 apparent window under the title bar, but the screenshot you sent of yours was 246 x 246.
What do ofGetHeight() and ofGetWidth() return at run-time when the request was for ofSetupOpenGL(250,250,OF_WINDOW) ?
This seems like we may need an expert to help… @arturo ?
Not sure what’s going on, sounds like a bug in the custom code we use to switch between full screen and not full screen, perhaps something that only happens on latest versions of windows. Can you open a bug in github?
In the meantime, I have been mashing my face against my keyboard in an despairing attempt to find a solution.
I’ve discovered (don’t ask how, it is a lost 5 hours of my life) that if I use the ofxMSAOpenCl addon by @memo (i.e. link it all in) and then include the following two lines:
then hey presto, neither the origin offset nor the pixel stretch is an issue any more in windows mode. waaa!
This isn’t really a practical solution, as it is an entire (quite complex) addon dependency for no real reason. But, I assume that the declaration must be doing something of which I am unaware. So is it a hint as to what might be a fix??
How could I chase this up further? /or are there any other possible routes to a solution that I could try and hunt down?
hmmm, I wonder if it has to do with your graphics card and maybe when add that line it uses a different card (for example on mac, I have an intel and an ATI graphics card).
You can try the example in
examples/gl/glinfo
to get more info about your card – for example, this is what mine says: