• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 798
  • Last Modified:

glOrtho problems - Wrap ?

I have a COM component which draws a WorldMap on CView and the point values on the world map ranges from (x1, x2, y1, y2) (-180, 180, -90, 90). The component has the facility to zoom pan etc. Also since this is a world map the edges are wrapped around, for eg after +180 and next point is 180. So I set the full ortho as (-180, 180, -90, 90) for the whole worldmap. In zoom/pan i change the ortho values.
The problem starts when the pan window hits the 'edges' of the world map so the ortho values may become (170, -170, -20, 20). Since x1 > x2 the drawing gets inverted/mirrored etc and opengl does not support an ortho setting like glOrtho(170, -170, 10, -10, -1000, 1000). I am at my wits end to find a elegant solution.
Any help would be greatly appreciated.
1 Solution
I think you're depending on OpenGL for some application-level functionality it's not going to give you.  You need to manage the scaling and wraparound in your own code, without calling glOrtho on every update.  glOrtho just helps you do a simple linear coordinate mapping.

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now