Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2004:
[Freeciv-Dev] Re: (PR#7124) [FS] Drawing abstraction layer for OpenGL
Home

[Freeciv-Dev] Re: (PR#7124) [FS] Drawing abstraction layer for OpenGL

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: i-freeciv-lists@xxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#7124) [FS] Drawing abstraction layer for OpenGL
From: "Vasco Alexandre da Silva Costa" <vasc@xxxxxxxxxxxxxx>
Date: Mon, 2 Feb 2004 13:59:53 -0800
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=7124 >

On Mon, 2 Feb 2004, Raimar Falke wrote:

> <URL: http://rt.freeciv.org/Ticket/Display.html?id=7124 >
>
> On Sat, Dec 20, 2003 at 10:53:20AM -0800, Raimar Falke wrote:
>
> X11 without extensions as a backend is quite slow if transparency is
> used. OpenGL may be an alternative here. Note that OpenGL is used here
> only for 2D drawing. Not 3D stuff even when OpenGL was designed for
> this.
>
> I haven't coded any OpenGL applications till now except some 5 liner
> in Python. So I want to ask about some general concepts.
>
> I know that GLUT is an abstraction on the things which are around the
> actual OpenGL context like events and window management. GLX is the
> interface between OpenGL and X11 and as such a more specialized
> alternative to GLUT. GLUT has no events but callbacks. This is not
> compatible with the general design of the FS client. It looks like I
> will for now use OpenGL+GLX+X11. Bad?

GLUT is too constrained for anything but quick prototypes. GLX is too
X11 specific. I advise you to use SDL+OpenGL. Many games use this
combination.

> The FS client makes extensive use of off-screen-drawing-areas
> (OSDAs). There are drawing primitives which draw into these
> OSDAs. There is no such concept as (non-screen buffers) in OpenGL. I

Actually, there is. But I think you need to use an extension. I don't
remember if higher versions of OpenGL have it by default or not.

> plan to use call-lists here. Each drawing opertion will create a
> call-lists which will queue the drawing primitive. Than these
> call-lists are recursively executed when actual drawing is requested.

Usually OpenGL applications have a datastructure in memory which
represents the scene. Every time a scene needs to be refreshed or drawn, a
function is called which traverses this datastructure and draws the
enviroment. Fixed bitmaps are stored in the graphics card memory. If they
don't fit, texture management must be used as well.

The datastructure's name in CG lingo is scene graph.

Some 3D APIs support scene graphs by default, OpenGL is kind of low-level
in the regard it doesn't support such things, you need to roll your own.
But that is part of the reason why OpenGL is more popular, while such
APIs faded. OpenGL is more flexible in what it allows you to do.

> Bitmaps (sprites, rendered text) have to be transferred to the
> server. There are several alternatives: glBitmap, glDrawPixels and
> textures. I only have the feeling that OpenGL may scale textures and
> so blur it. Any advise on this issue?

Yes, OpenGL scales textures. Hence the need for things like bilinear
filtering, etc. OpenGL supports these features. You have to remember that
in 3D graphics the position of the camera can vary and things will
need to be scaled/rotated.

For text and other variable/peculiar bitmaps, you probably should use
glDrawPixels to superimpose it over the rest of the graphics.

---
Vasco Alexandre da Silva Costa @ Instituto Superior Tecnico, Lisboa




[Prev in Thread] Current Thread [Next in Thread]