I am assuming Windows, because I had the same (or similar) issue, and my situation is also windowed.

The width/height made available in the reshape callback include extra window size information, but I didn't see a portable way to determine those sizes (outside of a define or the like to call windows functions to get various sizes).

For a non-portable solution, I'm just calling GetClientHeight and using those values (on the viewport call, and during calculations for mouse position) instead.

I would love to see a better solution though : )


On Sat, Oct 13, 2012 at 7:32 PM, Jean-Claude Gervais <> wrote:

When I first start my application, drawing coordinates correspond to mouse-reporting positions, meaning if I hover the mouse at (10,10) and issue a drawing command to draw a pixel at (10,10), the pixel appears right under the mouse pointer.

However, I have recently implemented a reshape function, if I grab the window by its lower-right-hand corner and generate lots of callbacks to the reshape function, the physical drawing coordinates gradually drift away from their original positions toward the bottom and right.

Whatever window size I specify originally, drawing and mouse coordinates line up, but after enough resizing of the window, they progressively drift apart, whether I am making the window bigger or smaller. The mouse-reporting positions seem to stay absolute and correct, but all drawing in the window seems to drift even if I hard-code coordinates.

The application is a simple 2D display.

What should I do to fix this?

Thank you

Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
Freeglut-developer mailing list