Author Topic: Screen Aspect Ratio  (Read 3591 times)

0 Members and 1 Guest are viewing this topic.

Offline va!n

  • Pentium
  • *****
  • Posts: 1435
  • Karma: 109
    • View Profile
    • http://www.secretly.de
Screen Aspect Ratio
« on: February 14, 2008 »
Quote
Please consider making the demo's target resolution and aspect ratio selectable.  Widescreen displays with 16:10 aspect ratio and HDTV screens with 16:9 aspect ratio are increasingly common - your demo should support this properly if possible.

Atm i am working on a windows project, using DX9 and 800x600 on a widescreen notebook, where the screen looks good.

Some mins ago, i saw my program on an older 4:3 monitor and i was really shocked because the screen looks like shit due fact of the aspect ratio changing to a widescreen.

I would like to add a setup where the user can select screenmode and aspect ratio but i dont really know how to manage this.

As example we have following PsydoCode:

Code: [Select]
InitScreen( 800, 600, 32 )                ; width, height, depth
Repeat
    DrawTexture(   0,   0, 800, 120 )     ; x,y,width, height
    DrawTexture(   0, 480, 800, 120 ) 
    DrawText   ( 100, 100,  50, "Text" )  ; x, y, FontSize, String
Until

The question is, how and where must i change the psydocode to fit my screens on any aspect ratio like ( 4:3, 16:9, 16:10 ) ? Does someone has experience with this and know how to solve this problem on an easy way? thanks
- hp EliteBook 8540p, 4 GB RAM, Windows 8.1 x64
- Asus P5Q, Intel Q8200, 6 GB DDR2, Radeon 4870, Windows 8.1 x64
http://www.secretly.de
Challenge Trophies Won:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: Screen Aspect Ratio
« Reply #1 on: February 15, 2008 »
First, decide whether you are designing your demo in widescreen or 4:3.  Then you need to fix the viewport accordingly.  So if you are widescreen and the user selects 4:3, you need to set the viewport to leave black borders at the top and bottom.  Otherwise if you do a 4:3 demo and you're running on a 16:9 display, you need to pillar box.  I would say that only in special cases do you need to distinguish between 16:9 and 16:10, just bear in mind if you're doing a demo based around circles they'll get all stretched.

Jim
Challenge Trophies Won:

Offline taj

  • Bytes hurt
  • DBF Aficionado
  • ******
  • Posts: 4810
  • Karma: 189
  • Scene there, done that.
    • View Profile
Re: Screen Aspect Ratio
« Reply #2 on: February 16, 2008 »
Re circles: if you match your field of view to your aspect ratio, circles wont get distorted.

Do you have glu in Basic? If so have a look at gluPerspective command. One of the parameters is the aspect ratio of your field of view. You can set this to either SCREENY/SCREENX, or SCREENX/SCREENY ... I forget which right now.

http://www.cs.utk.edu/~vose/c-stuff/opengl/gluPerspective.html
Challenge Trophies Won:

Offline va!n

  • Pentium
  • *****
  • Posts: 1435
  • Karma: 109
    • View Profile
    • http://www.secretly.de
Re: Screen Aspect Ratio
« Reply #3 on: February 19, 2008 »
thanks guys. i will take a look later to this stuff. atm i will work first on some other important parts of my projects ^^
- hp EliteBook 8540p, 4 GB RAM, Windows 8.1 x64
- Asus P5Q, Intel Q8200, 6 GB DDR2, Radeon 4870, Windows 8.1 x64
http://www.secretly.de
Challenge Trophies Won: