views:

79

answers:

2

I'm using GLOrtho to set up a 2D view that I can render textures onto. It works really well, up until I try to zoom in on the image. If I pass half the width and half the height of the viewport to GLOrtho, I end up with all my textures displayed twice as big as normal, which is exactly what I expect.

But then I try to draw a box around part of the image and it all falls apart. I call glBegin(GL_LINE_LOOP), place the four vertices, and call glEnd, and I expect to see the same thing I would see if I drew it at normal zoom level, doubled. Instead, I get lines that are all the right length, but they all come out one pixel wide, instead of two, and it looks really bad.

What am I missing?

+3  A: 

Well you can either scale it yourself using glLineWidth or you can emulate the line as 2 triangles.

Goz
2 triangles! Probably will have to enable anti-aliasing also. Great idea.
Xavier Ho
Good answer. GL lines always have a fixed width.
Bahbar
A: 

glScale would be a better solution for scaling instead of changing glOrtho parameters. That way anything drawn will scale as expected.

tafa
Actually, glScale won't give twice the width.
Xavier Ho
Now I realize that it would not work for lines.
tafa