[Kde-games-devel] Ksudoku, Kubrik 3D background
Ian Wadham
ianw2 at optusnet.com.au
Thu May 15 15:06:32 CEST 2008
On Thu, 15 May 2008 08:17 am, Matthew Woehlke wrote:
> Ian Wadham wrote:
> > On Fri, 9 May 2008 12:21 am, Eugene Trounev wrote:
> > I think it is possible to do a background but I have not read up on the
> > programming requirements yet. Also I think the requirements for
> > the graphics-file format might be a bit limiting, so better not draw
> > anything yet.
>
> I thought Qt allowed you to turn any QPixmap/QImage into an OpenGL texture?
>
Yes, but then what? As I said, I have not read up on this yet, but as far as
my present understanding goes, a texture has to be a power of 2 pixels
in each dimension (e.g. 512x1024). Then the whole thing, or bits of it, can
be applied to any triangle, rectangle, etc. in 3-D. So it gets re-projected,
stretched, re-computed regarding lighting, etc. depending on the position
and orientation of the underlying surface in 3-D space.
> > And OpenGL calculates lighting and shading, which
> > changes the colors and reflections as the objects move around. So
> > I think the background graphics would have to follow some rules :-(
>
> Well, the background won't change. Do you mean that the background must
> play nice with the cube under arbitrary lighting? (I'm not sure I'm
> reading this right...)
>
AFAIK there is no concept of a "background" in OpenGL and certainly no
reliance on pixel-based co-ordinates. I think a background would have to
be a rectangle, perpendicular to the Z-axis and some distance behind the
cubes (which are centred at Z = -5.0). Its size and position, in OpenGL
X, Y co-ordinates, would have to be calculated so as to fill the current
perspective view. It might then turn out to be too far from the light and
therefore a bit dim. Also, when the texture is applied, the artwork might
get stretched or clipped in undesirable ways and its perspective might
clash with the perspective in which the cubes are drawn.
I need to play with this a little, maybe using a background from KGoldrunner
or KMahjongg, but I don't have time to experiment with it right now. We
have a big deadline coming up and I am trying to get another feature into
Kubrick before then. However, I am sure there will have to be some rules
or restrictions re the SVG artwork if it is to survive the transformations
OpenGL might put it through and still look as good as the 2-D work we
provide in other games.
Cheers, Ian W.
More information about the kde-games-devel
mailing list