Colours versus Textures

New Message Reply Date view Thread view Subject view Author view

Martin Roth (roth++at++poseidon.mti.sgi.com)
Wed, 11 Jan 1995 21:40:50 +0100


Hi,

I'd be very glad if anyone was able to explain the following misbehaviour.

    pfVec4 *colors;

    /* count is the number of triangles */
    colors = (pfVec4 *)pfMalloc(3*count*sizeof(pfVec4), arena);

    ... filling colors array ...

    pfGSetAttr(geoSet, PFGS_COLOR4, PFGS_PER_VERTEX, colors, NULL);

   /* works fine, the geometry appears coloured */

    ... elsewhere ...

    void **alist;
    ushort **ilist;

    /* next statement crashes with a segmentation violation */
    pfGetGSetAttrLists(geoSet, PFGS_COLOR4, alist, ilist);

    /* geoSet is sure to be a valid pointer (debugger told me), for
      all those who don't believe it: It crashed even when putting
      the statement sequence right below pfGSetAttr! */

I'd like to get the base address of the color array in 'alist'.

Why do I do such things? I'm still trying to get textured geometries shaded.
John Rohlf told me to use PFTE_MODULATE instead of PFTE_DECAL in my texture
environment. He's right when the geometry to be textured is white or grey.
In my case the geometry first is coloured in a per vertex way when defining
the geometry. Later when the database has prevented the necessary texture data
I'd like to *replace* the geometry colour with the texture bitmap but not to
lose the shading information. When using PFTE_DECAL the texture colour is ok
but I've got no shading, when using PFTE_MODULATE the resulting colour is ugly
to look at but I've got shading.

Because I found no way to globally override colour to white (I don't think it
is possible, isn't it?!) I decided to first change the colour of all geometries
to be textured to white and then set the local texture. This is a severe
perfor-
mance hit but it works. Now the user should be able to toggle texturing on
and off. That means I should not completely lose the colour information. That's
why I want to use pfGetGSetAttrLists to get the handle to the colour
information
in order to save it somewhere.

I don't know why it is the way it is but I'd like the order of rendering to be:

        1. Geometry colour
        2. Texturing colour (modulate or decal)
        3. Shading, Lighting
        4. Fog and other Stuff

instead of

        1. Geometry colour
        2. Shading, Lighting
        3. Texturing colour (modulate or decal => losing shade)
        4. Fog and other stuff

Any explanation of the above run time error? Any comments on colour replacement
without losing shading? Any comments on rendering order?

All answers are welcome. Thanks in advance

Martin

_______________________________________________________________________________
 /| /|) S. H. Martin Roth
/ |/ |\OTH Student in Computer Science

ETHZ, Swiss Federal Institute of Technology Zuerich email: sroth++at++iiic.ethz.ch
UniZh, University of Zuerich email: roth++at++ifi.unizh.ch


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:50:51 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.