Grambo (graham++at++beast)
Mon, 2 Jan 1995 13:12:10 -0800
void DownloadTex(long n, pfTexture **texList, long drawFlag)
{
long foo, ncomp, xs, ys, i;
fprintf(stderr, "Downloading textures");
if(!drawFlag)
{
for (i = 0; i < n; i++)
{
fprintf(stderr, ".");
pfApplyTex(texList[i]);
}
}
else
{
float xc, yc;
static pfMatrix ident = {{1., 0., 0., 0.},
{0., 1., 0., 0.},
{0., 0., 1., 0.},
{0., 0., 0., 1.}};
pfPushState();
pfEnable(PFEN_TEXTURE);
pfDisable(PFEN_FOG);
getsize(&xs, &ys);
ortho2(-.5, xs-.5, -.5, ys-.5);
viewport(0, xs-1, 0, ys-1);
xc = xs / 2.;
yc = ys / 2.;
pushmatrix();
loadmatrix(ident);
for (i = 0; i < n; i++)
{
long tx, ty;
pfVec2 v;
static pfVec2 t[] = {{0., 0.,}, {1., 0.,}, {1., 1.,}, {0., 1.,}};
fprintf(stderr, ".");
pfGetTexImage(texList[i], (ulong**)&foo, &ncomp, &tx, &ty, &foo);
pfApplyTex(texList[i]);
cpack(0);
clear();
cpack(0xffffffff);
bgnpolygon();
t2f(t[0]);
PFSET_VEC2(v, xc - tx/2., yc - ty/2.);
v3f(v);
t2f(t[1]);
PFSET_VEC2(v, xc + tx/2., yc - ty/2.);
v3f(v);
t2f(t[2]);
PFSET_VEC2(v, xc + tx/2., yc + ty/2.);
v3f(v);
t2f(t[3]);
PFSET_VEC2(v, xc - tx/2., yc + ty/2.);
v3f(v);
endpolygon();
swapbuffers();
}
popmatrix();
pfPopState();
}
fprintf(stderr, "\n");
fprintf(stderr, "Textures successfully down-loaded\n");
}
On Dec 31, 7:42am, Kent Watsen wrote:
> Subject: D/L-ing textures in draw space
>
> Hello,
>
> I've just recently parallelized my DIS simulation
> application , it took less then a day, but I still
> have one nasty issue to address...
>
> In the unparallelized version, I would load all geometry
> from disk at load time. This geometry included the
> terrain and an instance of each moving model likely to
> be needed. Also at this time I would d/l the textures
> associated with the geometry into hardware texture memory.
>
> When parallelized, the above code is considered to be in the
> app process space, but the d/l-ing of textures must be in
> draw process space.
>
> I have considered several approaches to this, but they all
> seem kludgy (having to use a first-time static variable to
> indicate the need to do the work). I figure that there must
> be some support or, at least, a commonly accepted approach
> to do this work efficiently.
>
> Anybody?
>
> Kent Watsen
> DCS Corporation
> Simulation Branch
> 703.683.8430 x369
>
>
>-- End of excerpt from Kent Watsen
--"It is often easier to fight for one's principles than to live up to them." , be good..
---------------------------------------------------------------------- Graham (Grambo) Beasley Silicon Graphics, Inc. MTS (Simulator Guy) (415) 390-5420 graham++at++sgi.com ----------------------------------------------------------------------
This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:50:48 PDT