[Freeciv-Dev] Using opengl in ftwl
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
I'm looking at how hard it would be to combine what I am working on with
OpenGL with the ftwl client. Here are some thoughts.
For OpenGL I would upload every graphics element as a texture to video
memory. These would then be drawn onto the video memory back buffer. The
z-dimension indicates the drawing order. Freeciv's built-in double buffer
would be skipped.
ftwl has a z-dimension for windows, which is nice. However, ftwl uses a
'pixel buffer' method for drawing which is hard to use with OpenGL. The
changes necessary to fix this may not be very large, though. All we need
is to turn the 'off-screen drawing area' which is blitted onto a final
composite in a z-order into an 'on-screen drawing area with a
z-dimension'.
This means we need a clear separation and abstraction between unchangable
graphics sources (textures) and the destination (the OpenGL back buffer).
In ftwl this separation is not yet present.
The functions be_copy_osda_to_osda() and be_is_transparent_pixel() would
have to be removed. Where the former is used to draw graphics,
be_draw_sprite() should be used instead. There are some uses I just do not
understand. Whenever it is used draw into the ftwl back buffer, this
should back buffer should not be just any osda, but be handled specially,
so that OpenGL can draw into the OpenGL back buffer instead.
The code using be_is_transparent_pixel() needs a different mechanic
altogether (it is used to find click-throughs on windows).
be_multiply_alphas() needs to be combined with be_crop_sprite(), as it is
already in the Freeciv common code, since that has to be done before the
graphics is uploaded as a texture, which would typically be done in
be_crop_sprite().
PS be_set_transparent() no longer exists and should be removed from
back_end.h.
- Per
- [Freeciv-Dev] Using opengl in ftwl,
Per Inge Mathisen <=
|
|