Results 1 to 8 of 8

Thread: Partitioned display window, all looking at origin from different angle

  1. #1
    Junior Member Newbie
    Join Date
    Jan 2001
    Location
    Guelph
    Posts
    1

    Partitioned display window, all looking at origin from different angle

    I'm trying to partition a display window into four parts, that show a different side of an object, front, side, top... ( like 3d studio max ), anyway I cannot figure out how to have 4 cameras in one window, but in different regions, all looking at the origin, but from different angles

    if this was the window:

    -------------------- one would be top view, one would be side, one would be
    | | | front...
    | | |
    --------------------
    | | |
    | | |
    ---------------------

    any help would be greatly appreciated

  2. #2
    Senior Member Regular Contributor
    Join Date
    Jul 2000
    Location
    Augsburg, Germany
    Posts
    334

    Re: Partitioned display window, all looking at origin from different angle

    Supposing, you have a Draw() function, doing all your drawing. With glViewPort you define the region, where openGL should draw:

    int x, y; // Screen width and height.

    // Set projection:
    glOrtho or gluPerspective or glFrustum()...
    glViewPort(0, 0, x/2, y/2);
    Draw();

    glOrtho or gluPerspective or glFrustum()...
    glViewPort(0, y/2, x/2, y/2);
    Draw();

    glOrtho or gluPerspective or glFrustum()...
    glViewPort(x/2, 0, x/2, y/2);
    Draw();

    glOrtho or gluPerspective or glFrustum()...
    glViewPort(x/2, y/2, x/2, y/2);
    Draw();

  3. #3
    Senior Member Regular Contributor
    Join Date
    Nov 2000
    Location
    State College, PA
    Posts
    186

    Re: Partitioned display window, all looking at origin from different angle

    Actually, your best solution is probably to actually partition the window itself (not the drawing area) into the panes that you want. Then, create four drawing areas. That way, most expose events will only hit one or two of the drawing areas, not all of them. Then, the problem is easy.

    Chris

  4. #4
    Senior Member Regular Contributor
    Join Date
    Jul 2000
    Location
    Augsburg, Germany
    Posts
    334

    Re: Partitioned display window, all looking at origin from different angle

    Chennes,

    as I remember, you can specify which part of the screen is redrawn. Sure, in your solution it works automatically. But you have to switch the render contexts, which would be an extra effort.

    Kilam.

  5. #5
    Senior Member Regular Contributor
    Join Date
    Feb 2000
    Location
    Caracas/Venezuela
    Posts
    182

    Re: Partitioned display window, all looking at origin from different angle

    Two things:
    -You can render to diferent windows (diferent HDCs) using a single context. It's in the specs, I didn't invent this.
    -Multiple rendering contexts and sharing display lists and textures is a something I have nt been able to put to work in some cards.

    I choose one big window using various glViewport calls, or various windows with a single rendering context. It has worked very well for me, in multiple video cards, consumer and pro.

  6. #6
    Senior Member Regular Contributor
    Join Date
    Nov 2000
    Location
    State College, PA
    Posts
    186

    Re: Partitioned display window, all looking at origin from different angle

    How do you use the same rendering context in various windows? In my code, I think I've ended up with four different rendering contexts, but if I can avoid the overhead of switching contexts that'd be great. Primarily I use a partitioned window because it allows easy automatic resizing of the partitions, so I need to keep it that way.

    Chris

  7. #7
    Senior Member Regular Contributor
    Join Date
    Feb 2000
    Location
    Caracas/Venezuela
    Posts
    182

    Re: Partitioned display window, all looking at origin from different angle

    simply use wglMakeCurrent( MyGlobalRenderContext, MyWindow1) to render in window1, and so on. When you create the rendering context, use the hdc of any of the windows. The wglMakeCurrent documentation says:
    "It need not be the same hdc that was passed to wglCreateContext when hglrc was created, but it must be on the same device and have the same pixel format. "

    That's it.

  8. #8
    Senior Member Regular Contributor
    Join Date
    Nov 2000
    Location
    State College, PA
    Posts
    186

    Re: Partitioned display window, all looking at origin from different angle

    How much overhead does this actually avoid. I have to call glXMakeCurrent to switch contexts anyway - how is it faster to use it with the same context and a different drawable?

    Chris

    [This message has been edited by chennes (edited 01-27-2001).]

Similar Threads

  1. Replies: 4
    Last Post: 05-23-2012, 10:24 AM
  2. Angle in Degree to Euler Angle
    By bobGL in forum OpenGL: Advanced Coding
    Replies: 2
    Last Post: 11-07-2007, 07:04 AM
  3. How to display a sub window?
    By bubbaJr in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 02-10-2005, 04:32 PM
  4. Specifiying the View Origin of GLUT window
    By kabrit in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 01-02-2002, 11:19 AM
  5. Replies: 2
    Last Post: 06-17-2001, 12:44 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean