Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

#ActualFXACE

Posted 24 March 2012 - 08:58 AM

For each screen size you need to set up a custom glViewport parameters which can be done manually or by formula...
usage:
'Width' - a full-screen window width.
'Height' - a full-screen window heght.
example#1:
I want to  do make my screen quadratic (adopting to window width and height) which aligned to center:
glViewport((Width-Height)/2,0,Height,Height); // I took 'Height' as minimal value, so I would have it work on displays which it's width is larget than height
result will look like this:
+-------+--------------+-------+ < my display
|*******|...............|*******|
|*******|.......my...|*******|
|*******|..viewport..|*******|
|*******|...............|*******|
+-------+--------------+-------+
'*' - black pixel.
example#2:
I want to make my screen like film look (let say: 800x320) to get a result like watching a video (with these dimensions) in media player full-screen mode:
float aspectToY = 320.0f/800.0f;
int w = Width;
int h = int(float(w)*aspectToY); //!!! correct me if this is wrong.
glViewport(0, (Height - h) / 2, w, h); // NOTE: this would work if 'height'(ex:320) <= 'width'(ex:800).
the result should be like this (for example if my display would be 800x600):
+---------------------------+ << my display
|************************|
+---------------------------+
|.............my...........|
|.........viewport........|
+---------------------------+
|************************|
+---------------------------+

extra information: OpenGL viewport coordinate system (for glViewport setup):
glViewport(x,y,width,height)
---------window top-------
^-height
|
|....+........+
|................\dimensions(width,height)
|....+........+
|......\offset (x,y)
------------------------> -width
---window bottom-----

As you see (in your screen-shots) screen always aligned on left-bottom corner.
Another thing can be happen:
when your display (monitor) first time using these WxH settings sometimes it could do some shift&amp;scale operation which produces strange screen results...
If this was happend, on LCD\LED monitors do: Menu->Settings->Reset:true

Best wishes, FXACE.

#10FXACE

Posted 24 March 2012 - 08:57 AM

For each screen size you need to set up a custom glViewport parameters which can be done manually or by formula...
usage:
'Width' - a full-screen window width.
'Height' - a full-screen window heght.
example#1:
I want to  do make my screen quadratic (adopting to window width and height) which aligned to center:
glViewport((Width-Height)/2,0,Height,Height); // I took 'Height' as minimal value, so I would have it work on displays which it's width is larget than height
result will look like this:
+-------+--------------+-------+ < my display
|*******|...............|*******|
|*******|.......my.....|*******|
|*******|..viewport..|*******|
|*******|...............|*******|
+-------+--------------+-------+
'*' - black pixel.
example#2:
I want to make my screen like film look (let say: 800x320) to get a result like watching a video (with these dimensions) in media player full-screen mode:
float aspectToY = 320.0f/800.0f;
int w = Width;
int h = int(float(w)*aspectToY); //!!! correct me if this is wrong.
glViewport(0, (Height - h) / 2, w, h); // NOTE: this would work if 'height'(ex:320) <= 'width'(ex:800).
the result should be like this (for example if my display would be 800x600):
+---------------------------+ << my display
|************************|
+---------------------------+
|.............my...........|
|.........viewport........|
+---------------------------+
|************************|
+---------------------------+

extra information: OpenGL viewport coordinate system (for glViewport setup):
glViewport(x,y,width,height)
---------window top-------
^-height
|
|....+........+
|................\dimensions(width,height)
|....+........+
|......\offset (x,y)
------------------------> -width
---window bottom-----

As you see (in your screen-shots) screen always aligned on left-bottom corner.
Another thing can be happen:
when your display (monitor) first time using these WxH settings sometimes it could do some shift&amp;scale operation which produces strange screen results...
If this was happend, on LCD\LED monitors do: Menu->Settings->Reset:true

Best wishes, FXACE.

#9FXACE

Posted 24 March 2012 - 08:57 AM

For each screen size you need to set up a custom glViewport parameters which can be done manually or by formula...
usage:
'Width' - a full-screen window width.
'Height' - a full-screen window heght.
example#1:
I want to  do make my screen quadratic (adopting to window width and height) which aligned to center:
glViewport((Width-Height)/2,0,Height,Height); // I took 'Height' as minimal value, so I would have it work on displays which it's width is larget than height
result will look like this:
+-------+--------------+-------+ < my display
|*******|..................|*******|
|*******|.......my.......|*******|
|*******|....viewport..|*******|
|*******|...................|*******|
+-------+--------------+-------+
'*' - black pixel.
example#2:
I want to make my screen like film look (let say: 800x320) to get a result like watching a video (with these dimensions) in media player full-screen mode:
float aspectToY = 320.0f/800.0f;
int w = Width;
int h = int(float(w)*aspectToY); //!!! correct me if this is wrong.
glViewport(0, (Height - h) / 2, w, h); // NOTE: this would work if 'height'(ex:320) <= 'width'(ex:800).
the result should be like this (for example if my display would be 800x600):
+---------------------------+ << my display
|************************|
+---------------------------+
|.............my...........|
|.........viewport........|
+---------------------------+
|************************|
+---------------------------+

extra information: OpenGL viewport coordinate system (for glViewport setup):
glViewport(x,y,width,height)
---------window top-------
^-height
|
|....+........+
|................\dimensions(width,height)
|....+........+
|......\offset (x,y)
------------------------> -width
---window bottom-----

As you see (in your screen-shots) screen always aligned on left-bottom corner.
Another thing can be happen:
when your display (monitor) first time using these WxH settings sometimes it could do some shift&amp;scale operation which produces strange screen results...
If this was happend, on LCD\LED monitors do: Menu->Settings->Reset:true

Best wishes, FXACE.

#8FXACE

Posted 24 March 2012 - 08:56 AM

For each screen size you need to set up a custom glViewport parameters which can be done manually or by formula...
usage:
'Width' - a full-screen window width.
'Height' - a full-screen window heght.
example#1:
I want to  do make my screen quadratic (adopting to window width and height) which aligned to center:
glViewport((Width-Height)/2,0,Height,Height); // I took 'Height' as minimal value, so I would have it work on displays which it's width is larget than height
result will look like this:
+-------+--------------+-------+ < my display
|*******|....................|*******|
|*******|.......my.........|*******|
|*******|....viewport....|*******|
|*******|.....................|*******|
+-------+--------------+-------+
'*' - black pixel.
example#2:
I want to make my screen like film look (let say: 800x320) to get a result like watching a video (with these dimensions) in media player full-screen mode:
float aspectToY = 320.0f/800.0f;
int w = Width;
int h = int(float(w)*aspectToY); //!!! correct me if this is wrong.
glViewport(0, (Height - h) / 2, w, h); // NOTE: this would work if 'height'(ex:320) <= 'width'(ex:800).
the result should be like this (for example if my display would be 800x600):
+---------------------------+ << my display
|************************|
+---------------------------+
|.............my............|
|.........viewport........|
+---------------------------+
|************************|
+---------------------------+

extra information: OpenGL viewport coordinate system (for glViewport setup):
glViewport(x,y,width,height)
---------window top-------
^-height
|
|....+........+
|................\dimensions(width,height)
|....+........+
|......\offset (x,y)
------------------------> -width
---window bottom-----

As you see (in your screen-shots) screen always aligned on left-bottom corner.
Another thing can be happen:
when your display (monitor) first time using these WxH settings sometimes it could do some shift&amp;scale operation which produces strange screen results...
If this was happend, on LCD\LED monitors do: Menu->Settings->Reset:true

Best wishes, FXACE.

#7FXACE

Posted 24 March 2012 - 08:55 AM

For each screen size you need to set up a custom glViewport parameters which can be done manually or by formula...
usage:
'Width' - a full-screen window width.
'Height' - a full-screen window heght.
example#1:
I want to  do make my screen quadratic (adopting to window width and height) which aligned to center:
glViewport((Width-Height)/2,0,Height,Height); // I took 'Height' as minimal value, so I would have it work on displays which it's width is larget than height
result will look like this:
+-------+--------------+-------+ < my display
|*******|..............|*******|
|*******|.......my.....|*******|
|*******|....viewport..|*******|
|*******|..............|*******|
+-------+--------------+-------+
'*' - black pixel.
example#2:
I want to make my screen like film look (let say: 800x320) to get a result like watching a video (with these dimensions) in media player full-screen mode:
float aspectToY = 320.0f/800.0f;
int w = Width;
int h = int(float(w)*aspectToY); //!!! correct me if this is wrong.
glViewport(0, (Height - h) / 2, w, h); // NOTE: this would work if 'height'(ex:320) <= 'width'(ex:800).
the result should be like this (for example if my display would be 800x600):
+---------------------------+ << my display
|************************|
+---------------------------+
|.............my...........|
|.........viewport.........|
+---------------------------+
|************************|
+---------------------------+

extra information: OpenGL viewport coordinate system (for glViewport setup):
glViewport(x,y,width,height)
---------window top-------
^-height
|
|....+........+
|................\dimensions(width,height)
|....+........+
|......\offset (x,y)
------------------------> -width
---window bottom-----

As you see (in your screen-shots) screen always aligned on left-bottom corner.
Another thing can be happen:
when your display (monitor) first time using these WxH settings sometimes it could do some shift&amp;scale operation which produces strange screen results...
If this was happend, on LCD\LED monitors do: Menu->Settings->Reset:true

Best wishes, FXACE.

#6FXACE

Posted 24 March 2012 - 08:55 AM

For each screen size you need to set up a custom glViewport parameters which can be done manually or by formula...
usage:
'Width' - a full-screen window width.
'Height' - a full-screen window heght.
example#1:
I want to  do make my screen quadratic (adopting to window width and height) which aligned to center:
glViewport((Width-Height)/2,0,Height,Height); // I took 'Height' as minimal value, so I would have it work on displays which it's width is larget than height
result will look like this:
+-------+--------------+-------+ < my display
|*******|..............|*******|
|*******|.......my.....|*******|
|*******|....viewport..|*******|
|*******|..............|*******|
+-------+--------------+-------+
'*' - black pixel.
example#2:
I want to make my screen like film look (let say: 800x320) to get a result like watching a video (with these dimensions) in media player full-screen mode:
float aspectToY = 320.0f/800.0f;
int w = Width;
int h = int(float(w)*aspectToY); //!!! correct me if this is wrong.
glViewport(0, (Height - h) / 2, w, h); // NOTE: this would work if 'height'(ex:320) <= 'width'(ex:800).
the result should be like this (for example if my display would be 800x600):
+---------------------------+ << my display
|************************|
+---------------------------+
|.............my...........|
|.........viewport.........|
+---------------------------+
|************************|
+---------------------------+

extra information: OpenGL viewport coordinate system (for glViewport setup):
glViewport(x,y,width,height)
---------window top-------
^-height
|
|....+........+
|................\dimensions(width,height)
|....+........+
|......\offset (x,y)
------------------------> -width
---window bottom-----

As you see (in your screen-shots) screen always aligned on left-bottom corner.
Another thing can be happen:
when your display (monitor) first time using these WxH settings sometimes it could do some shift&amp;scale operation which produces strange screen results...
If this was happend, on LCD\LED monitors do: Menu->Settings->Reset:true

Best wishes, FXACE.

PARTNERS