DirectFB - Home of the pragmatist Roadmap


[directfb-users] Re: Portrait mode display.
Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[directfb-users] Re: Portrait mode display.



On Thu, Aug 12, 2004 at 12:31:26PM +0800, Rob Kramer wrote:
> Hi,
> 
> On Thursday 12 August 2004 01:23 am, Denis Oliver Kropp wrote:
> > texture mapping could be used to rotate the image.
> >
> > Have a look at IDirectFBSurface::TextureTriangles().
> > I haven't tested it for a while on a CLE266, but it's
> > working great on Matrox now.
> >
> > The vertices and texture coordinates for such a rotation
> > are fairly simple.
> 
> Ah, thanks! The df_texture demo is very promising and works perfectly on the 
> CLE266. Now I better get some 3D skills, the ve.c source is hard to 
> understand due to all the matrix math. Any idea where I could get a start at 
> reading up on what for example W, S, T coordinates mean in DFBVertex?

Some OpenGL / D3D tutorial maybe. The OpenGL specification may have some 
useful information too.

S and T and are normalized texture coordinates.

W is used for the perspective divide. For 2D it's always 1.0.

> Hmm, I don't even see how a rectangle is drawn in df_texture, if the entire 3D 
> system works with triangles. 3D newbie for sure..

This small example should draws a rectangle with the full texture mapped 
on it.

DFBVertex vertices[4] = {
 { x,     y,     0.0, 1.0, 0.0, 0.0 },
 { x+w-1, y,     0.0, 1.0, 1.0, 0.0 },
 { x+w-1, y+h-1, 0.0, 1.0, 1.0, 1.0 },
 { x,     y+h-1, 0.0, 1.0, 0.0, 1.0 }
};

surf->TextureTriangles( surf, tex, vertices, NULL, 4, DTTF_FAN );

If you don't want to use DTTF_FAN for some reason you can draw it as two 
triangles like so:

int indices[6] = { 0, 2, 3, 0, 1, 2 };
surf->TextureTriangles( surf, tex, vertices, indices, 6, DTTF_LIST );

-- 
Ville Syrjälä
syrjala@sci.fi
http://www.sci.fi/~syrjala/




Home | Main Index | Thread Index


directfb.org / Development / Old Archives