Ortho help!

I have a major problem here. I have made two programs separetly one is to display the stereo images and then second one is two draw a mouse cursor on the two images. Now when I have come to integrate the two programs together I have realised that the ortho projections for both the programs is different.

  1. For stereo image it is : glOrtho(0.0, (GLfloat)width, 0.0, (GLfloat)height, -1.0, 1.0);
  2. For the mouse is : glOrtho(0, width, height, 0, -1.0, 1.0);

I know that the only difference is of float and integer but that is causing alot of trouble.

  1. If I use the ortho projection for the stereo image then to control the mouse cursor( drwan) is very difficult and the image that are being displayed are very dark infact you cant see them properly.

  2. If I use the ortho projection for the mouse cursor then the images are not displayed at all but the mouse cursor is displayed fine.

I was wondering if anyone could give me suggestions as to how to go about it now.

Many thanks
pranay

Passing integers to glOrtho isn’t a problem, because it’s parameters are float and integers will be converted automatically.

The only difference between the two glOrtho calls you provided is that the y coordinates are flipped. Your images are probably disappearing because they are flipped, and are now facing away from you.

I can’t say why it is dark, since this has nothing to do with the projection. I’ll need to see some code to help any more.

Previous poster is dead right.

I’d like to recommend keeping the 2D origin in the bottom-left corner of the screen - it seems a bit confusing at first, but you’ll soon get used to it. The fact is that so much in graphics is oriented to work this way, that attempts to change things just get messy.

So, go with the first glOrtho call you mention.