Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: Reshape function and multiple viewports

  1. #1
    Junior Member Newbie Perlice's Avatar
    Join Date
    Jan 2013
    Location
    Verona, Italy
    Posts
    10

    Reshape function and multiple viewports

    Hello everyone, I'm trying to learn OpenGl because I need it to pass an exam, but I don't understand how to write the right reshape function if I have two viewports. The first one is bigger and I use gluPerspective to draw in it, the second one is on the bottom of the window and I use gluOrtho2D.

    Alice
    sorry for my English. I'm Italian :-)

  2. #2
    Senior Member OpenGL Guru
    Join Date
    May 2009
    Posts
    4,948
    There is no "reshape function". Whether you have a "reshape function" at all is entirely up to you. And if you have one, what you do wihtin it is also entirely up to you.

    If you need to use a perspective projection sometimes and an orthographic projection other times, then you will need to set one first, do rendering with that, then set the other, and do rendering with that. How you accomplish this is entirely up to you; you will need to make sure that your rendering function has the information necessary to do this. This will often involve storing the window's size somewhere and using that size in your rendering function.

    You've made the mistake of thinking that the way a particular tutorial looks is somehow enforced or required. That there must be a "reshape function" and it must call either gluPerspective or gluOrtho or whatever. It's your code; do whatever you need to to make it work.

  3. #3
    Junior Member Newbie Perlice's Avatar
    Join Date
    Jan 2013
    Location
    Verona, Italy
    Posts
    10
    Thanks for your reply it's true that I was trying to follow too much a tutorial :-)

    Just out of curiosity.. Is there a way to write a reshape function while using two viewports or is it impossible?

  4. #4
    Junior Member Newbie Perlice's Avatar
    Join Date
    Jan 2013
    Location
    Verona, Italy
    Posts
    10
    Quote Originally Posted by Perlice View Post
    Thanks for your reply it's true that I was trying to follow too much a tutorial :-)

    Just out of curiosity.. Is there a way to write a reshape function while using two viewports or is it impossible?
    I reply to myself.. Now I think I understand what you meant, if I can't do it in the way I want i can always do it in another way, I just have to watch the problem from a different point of view

    problem solved :-D

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •