I’ve been reading around trying to understand how a (SDL + OpenGL) 3D engine hangs together, and I’ve come across many concepts and many implementations. I know what most of the do, but I was hoping to get some comments on the following.
Window - Window management functions such as OpenWindow, CloseWindow and SetCaption. One window per application.
Render Target - Provides functions for accessing OpenGL’s API, such as SDL_GL_SwapBuffers. One render target per window.
Viewport - Multiple viewports per render target.
Camera - One camera per viewport.
Does this sound about right? Is there anything else that should be in here?
you can have multiple windows and multiple viewports to a window and multiple cameras to a viewport.
a window is a drawable surface. An application can have more than one window open at once, although most applications only have one window.
I am unfamiliar wiht a “render target”, but your description sounds like what I’d call a rendering context. You have one of these per window – it is the opengl state-machine (ie. the stuff that lets the opengl application interface with a window).
You can have multiple viewports per window. A viewport describes a mapping from what the opengl statemachine thinks is its entire viewable surface to the actual viewable surface on the window. Put it this way: the opengl context has a local coordinate system which is fixed and independant of the coordinate system of the window. THe viewport is the mechanism which transfers the opengl coordinate system to pixels on the window. The viewport usually—but not always—maps the ogl coordinate system to the entire window. You can have multiple viewports per window — you set the viewport, render something, set the viewport again, render some more, and so on.
there will always be at least one camera per viewport, but there is nothing stopping you from adding more cameras. A viewport just maps what is seen to the window; a camerra maps what is IN the scene to the viewport. There is nothing stopping you from defining one camera and rendering stuff, then redefining the camera and rendering some more stuff.
Perhaps some of your thinking stems from the fact that only one window, context, viewport and camera are available ~at once~. There is nothing stopping you from arbitarily defining more windows/viewports/cameras. (The only exception, I think, is the context/target: only one can be bound to a window at once.)
does this make sense?
Actually it makes good sense. Thanks a lot.
Greetings, I think this thread answered what I was looking for, but let me ask anyway to get your opinions =):
Is it feasible in OpenGL to have one program draw 4 separate windows, and have each of those 4 windows fed by 4 cameras, placed on different sides of an object? What I’m trying to do is to get each of the 4 sides of an object to be rendered on 4 different monitors.
From your reply I would think yes, so what I would really be looking for is the difficulty involved.