Beginner question: OpenGL surface just as part of SDL window

Hi all,
is it possible to place in one window (or fullscreen) 4 different views
on some data? So 3 ones should display 2d slices and the fourth one
should be opengl rendered. Easy to do or are sluggish work-arounds required?

Thanks a lot,
J?rgen

I think the best way to do this (and the way many 3D modellers and
similar apps do it) is to do it all in OpenGL, one way or another.

With a “normal” GUI toolkit you’d use one OpenGL context for each view
(which has some advantages, at least if you have proper drivers and
threading), but other options include using one context for all
views, and using OpenGL for the entire window, GUI included. The
latter options can be done with SDL 1.2.

//David Olofson - Programmer, Composer, Open Source Advocate

.------- http://olofson.net - Games, SDL examples -------.
| http://zeespace.net - 2.5D rendering engine |
| http://audiality.org - Music/audio engine |
| http://eel.olofson.net - Real time scripting |
’-- http://www.reologica.se - Rheology instrumentation --'On Monday 19 February 2007 18:32, J?rgen Kornfeld wrote:

Hi all,
is it possible to place in one window (or fullscreen) 4 different
views on some data? So 3 ones should display 2d slices and the
fourth one should be opengl rendered. Easy to do or are sluggish
work-arounds required?

Not sure if there are other OpenGL/SDL examples, but NeHe has a lot of his
OpenGL tutorials converted over to SDL and one deals with multiple
viewports.

Look at: http://nehe.gamedev.net/

Note: When you click on one of the tutorials (#42 has the multiple
viewports) scroll down to the bottom of the page. That is where the link to
the source for the demo is.

  • Ken Rogoway
    Homebrew Software> ----- Original Message -----

From: sdl-bounces@lists.libsdl.org [mailto:sdl-bounces at lists.libsdl.org] On
Behalf Of J?rgen Kornfeld
Sent: Monday, February 19, 2007 11:33 AM
To: sdl at lists.libsdl.org
Subject: [SDL] Beginner question: OpenGL surface just as part of SDL window

Hi all,
is it possible to place in one window (or fullscreen) 4 different views
on some data? So 3 ones should display 2d slices and the fourth one
should be opengl rendered. Easy to do or are sluggish work-arounds required?

Thanks a lot,
J?rgen


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.441 / Virus Database: 268.18.2/692 - Release Date: 2/18/2007
4:35 PM


No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.441 / Virus Database: 268.18.2/692 - Release Date: 2/18/2007
4:35 PM

Unfortunately, there’s no really “clean” way to do this, and the
method required can potentially be as sluggish (relatively) as
however many views you have times the single view render time.

You basically have to use glViewport for each, ah, view port you want
to have, then set the viewing parameters (orthographic, perspective,
camera angle/location, etc…) and render the scene, rinse and repeat
for each view.

It seems to me that a more code-clean situation might keep track of
different view areas and draw to them all, but seeing as how OpenGL
was designed to be simple, powerful, and fast, I understand why this
kind of thing is lacking. And really if you code it right it can
still be kept very clean indeed.

I ramble, but the long-and-short of it is:

4 views = 4 renders of the whole scene.

You can of course only render/enable certain things in each view if
you want. Perhaps rendering everything in the perspective view, then
switching over to an overhead-map view which only renders players (as
triangles), landscape, and buildings, but without any textures. That
would drastically simplify both the rendering requirements and the
interface. I mean, who wants to see specular and normal mapping in
their overhead map anyway, right?

Just some thoughts,
– ScottOn Feb 19, 2007, at 10:32 AM, J?rgen Kornfeld wrote:

Hi all,
is it possible to place in one window (or fullscreen) 4 different
views
on some data? So 3 ones should display 2d slices and the fourth one
should be opengl rendered. Easy to do or are sluggish work-arounds
required?

Thanks a lot,
J?rgen


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org