Is there a way other than playing with transformations to supply screen coordinates to render geometry, like in the Direct3D transformed format? What about glWindowPos?

I'm trying to implement a custom gui controls for in-game/demo, and was wondering what could be a more suitable to use creen or 3D coordinates. I though the later would give much better control esepcially when need to preserve the contol size independently of the screen resolution.

Thanks.

Korval

03-06-2007, 06:14 PM

Is there a way other than playing with transformations to supply screen coordinates to render geometry, like in the Direct3D transformed format?Why would you want one?

By "playing with transforms," not only can you get what you want, you can get it in such a way as to be resolution independent. That is, you can pretend the screen is, say, 800x600 internally in your GUI, even if the user has it set at 1280x960. Or whatever.

santyhamer

03-08-2007, 12:55 PM

Originally posted by glfreak:
[QB] Hello

Is there a way other than playing with transformations to supply screen coordinates to render geometry, like in the Direct3D transformed format? What about glWindowPos?
Use glOrtho with your screen size as paramenters. Then render your gUI parts in screen coordinates using glVertex, glTextureCoord, etc like in Direct3D.

need to preserve the contol size independently of the screen resolution.
From my experience is better to use "docking" than a fixed screen resolution factor. First I did some in 16:9 format... the problems came with a guy using my app with a 34'' TFT positioned.... vertically! so my horizontal 16:9 was not good... neither the usual 4:3... using "docking" is better I think...

Hope it helped.

knackered

03-08-2007, 01:01 PM

Go on then I'll ask....what do you mean by the word "docking"?

glfreak

03-08-2007, 05:28 PM

Thanks. I guessed another way. Using a real values to express a position in a screen raher than expressing the pixels. It works like this.
Specifying (0.25, 0.25) for a GUI position means that the gui will be posiitoned in the first quarter of the screen independent of the resolution or display dimensions.

ScottManDeath

03-08-2007, 07:38 PM

But be careful of the aspect ratio of your screen....

santyhamer

03-09-2007, 08:11 PM

Originally posted by knackered:
what do you mean by the word "docking"?.NET WinForms/WPF control docking... You can align left, right, top or bottom the UI panel containers. For example, a Docking.Right means the UI panel will be moved to the right of the screen. If any other control is painted with other Docking.Right then will be aligned immediatly to the left of the already-docked element and on the right of the screen.

You can mix that with UI layouts(Java,wxWidgets approach) to automatically position the UI elements in the screen without having to assume a fixed screen aspect ratio ( which I think is bad for the reasons I mentioned before )

Originally posted by glfreak:
Specifying (0.25, 0.25) for a GUI position means that the gui will be posiitoned in the first quarter of the screen independent of the resolution or display dimensions.
Seriously, that will be a bad idea. To make that to work you need to assume a constant screen aspect ratio.

The problem is that usually the people use horizontal-major ratios ( 4:3, 16:9 ), then a creative artist decides that wants to use the wonderful TFT in a vertical way and then all your UI will be bad located. A more common example can be a guy using 3 monitors. Then you (0.25,0.25) will be ok in the vertical axis but terrible bad positioned horizontally because the width/height ratio will be laaaaaaaaaaarge, so all your buttons and controls in the UI will be horizonally-expanded too much.

Also you will have problems with super-small device screens(like mobile phones). If your UI is designed for 1024x768 and you scale down your UI elements will be really bad displayed ( specially the button corners and bitmap text ). Mobile phones are too different between them.. for example, the Apple iPhone uses more height than width but my Motorola uses a square screen.

You can avoid all these problems using a 1:1 bitmap-screen fit to avoid sub-pixel aliasing and with docking/layouts. Also, try to use "vector graphics" where possible and avoid bitmapped buttons/text. Just my opinion.

Korval

03-09-2007, 08:19 PM

There are a thousand different ways of having resolution-independent UI schemes. The WinForm method of "docking" is only one, and by itself, it isn't even that good of one.

santyhamer

03-09-2007, 08:23 PM

Originally posted by Korval:
There are a thousand different ways of having resolution-independent UI schemes. The WinForm method of "docking" is only one, and by itself, it isn't even that good of one. Yep, probably the Java/wxWidgets layouts one will be better, but can be a bit difficult to program ( specially if you use the "desiredSize"/pack() feature )