Results 1 to 6 of 6

Thread: deconstruct the Renderer and the Window

  1. #1
    Junior Member Newbie
    Join Date
    Nov 2008
    Posts
    13

    deconstruct the Renderer and the Window

    Hello,

    question about the framework using opengl renderer.
    do the renderer class have information about the Window(Win32Window, QMainWindow for example), using maybe pointer to it, to perform the actions like:
    SwapBuffer(), Resize().

    Actually, what i want is a clear opengl renderer, which can be reused in the Qt window framework with the QGLWidget class or other window framework. but if the renderer need to have a pointer to that window, then it seems ... not so loosely couple.

    Any information appreciated, thank you in advance.

  2. #2
    Senior Member Frequent Contributor scratt's Avatar
    Join Date
    May 2008
    Location
    Thailand
    Posts
    555

    Re: deconstruct the Renderer and the Window

    Is this any help?

    http://www.digitalfanatics.org/proje...chapter14.html

    Typically in most implementations OpenGL has a view which resides inside another window. Any clear functions you do in OpenGL apply to it's view only, and when you resize the window containing it etc. you need to tell OpenGL to resize it's window.

    If you take a look at a HelloWorld GLUT example you can see this control structure and interface between windowing systems quite clearly in the various functions. In my experience almost all windowed solutions work basically the same way.

  3. #3
    Junior Member Newbie
    Join Date
    Nov 2008
    Posts
    13

    Re: deconstruct the Renderer and the Window

    thank you scratt.

    actually, what the "view" means? is it somewhat like the QGLWidget?
    It encapsulate most of the opengl commands, does it can be seen as the "view" resides inside the QMainWindow/QApplication, and it can be seen as the opengl renderer?

  4. #4
    Senior Member Frequent Contributor scratt's Avatar
    Join Date
    May 2008
    Location
    Thailand
    Posts
    555

    Re: deconstruct the Renderer and the Window

    This will probably describe it conceptually better than I can:

    http://www.opengl.org/wiki/Creating_an_OpenGL_Context


  5. #5
    Junior Member Newbie
    Join Date
    Nov 2008
    Posts
    13

    Re: deconstruct the Renderer and the Window

    thank you again
    it has more details in chapter2 of [Beginning Opengl game programming].

    another question:
    what is the relation between GDI and device context and render context?

  6. #6
    Junior Member Newbie
    Join Date
    Nov 2008
    Posts
    13

    Re: deconstruct the Renderer and the Window

    ok, i got some info:

    Device Contexts:
    a windows data structure containing information about the drawing attributes of a device
    - Each window has a device context to receive the graphics output
    - Device contexts allow device-independent drawing in Windows
    - Can be used to draw to the screen, to the printer, or to a metafile


    graphics output --> DC --> device-independent drawing
    /\
    || hRC = wglCreateContext(hDC);
    || OpenGL use this rendering context to draw to the DC.
    |
    | GDI calls.

    The DC is used to create an OpenGL rendering context, This rendering context is used by OpenGL to draw to the DC and ultimately the device surface.

    GDI is the original Windows 2D graphics interface.
    All GDI calls pass through a DC
    - All GDI functions include the device context as the first parameter. the dc must be specified in the GDI call, while the rc is implicit in an OpenGL call.
    - GDI functions cannot be used when the window is enabled for OpenGL double buffering.

Similar Threads

  1. GDI Generic renderer
    By Insignificant in forum OpenGL: User Software
    Replies: 0
    Last Post: 05-26-2013, 02:39 PM
  2. How to get the current renderer?
    By Duncan Champney in forum OpenGL: macOS
    Replies: 1
    Last Post: 03-28-2008, 04:42 AM
  3. toggle between hw/sw renderer?
    By in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 09-10-2003, 05:48 PM
  4. Renderer design
    By kaysoft in forum OpenGL: Advanced Coding
    Replies: 18
    Last Post: 11-26-2002, 08:46 PM
  5. Milkshape 3D renderer
    By coredump in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 09-13-2002, 04:48 AM

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