I think the problem with placement (ui or otherwise) has less to do with resolution than aspect ratio. Assuming a fixed aspect ratio for the view port or window (not necessarily matching the aspect ratio of the physical screen), it's pretty easy to fix placement using absolute values, such as floating point positions between [0, 1.0] for each axis, rounding to the nearest "pixel" when rendering if desired. Of course this works best with vector graphics, but even with textures for gui elements it could be acceptable if they are sufficiently large.
Pyglet's desire to map the coordinates directly to pixels is conceptually simpler on the one hand, but it makes the application responsible for any scaling required to support multiple resolutions. Plus OpenGL doesn't guarantee pixel-perfect mapping is even possible, though it typically is; except when it isn't, then it sucks as you've found out 8^) -Casey On Thu, Mar 25, 2010 at 7:58 AM, Jonathan Hartley <[email protected]> wrote: > > > On Mar 25, 12:46 pm, Tristam MacDonald <[email protected]> wrote: >> On Thu, Mar 25, 2010 at 5:41 AM, Jonathan Hartley <[email protected]>wrote: >> >> >> >> > I don't understand that stretching is happening post-rendering. I >> > don't *think* this is the case using the modified params to gluOrtho2D >> > that I describe. Obviously I'd love to hear more about it if I've >> > misunderstood that. >> >> Lets say you have a 5:3 widescreen display, with a native resotultion of >> 1280x768, and the user has chosen a 'stretched' 4:3 resolution of 1024x768. >> >> As far as OpenGL is concerned, the framebuffer is 1024x768, since that is >> the advertised display resolution, and this is the size image it will >> render. Once the frame is fully rendered and sent to the display, the >> display hardware stretches the image to 1280x768. >> > > Ah, I see! That stretching! Of course. Thanks for clarifying for me. > > Acknowledged on your other points. My intention is to give the user > total freedom to choose whichever resolution they like best - although > defaulting to whatever their initial desktop resolution is. If the > user changes resolution, either in game or before starting the game, > then I aim to display my game's objects on-screen at the same > positions and sizes regardless. So I definitely don't intend to force > any resolution on anyone - quite the opposite, I'm aiming to support > whatever the user's choice is as best I can, even if they choose a > dumb stretched resolution, perhaps because they want higher > framerates. > > Acknowledged also that placement of GUI elements will also incur extra > wrinkles because of this. On reflection, this may be the part where I > will really suffer from edges not falling on pixel boundaries. More > thought required as to whether I can really pull that off. > > Many thanks - I find chatting these things over with you guys very > helpful. > > -- > You received this message because you are subscribed to the Google Groups > "pyglet-users" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/pyglet-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "pyglet-users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/pyglet-users?hl=en.
