Re: pfGetSize problem

New Message Reply Date view Thread view Subject view Author view

From: Marc Hehmeyer (hehmeyer++at++stn-atlas.de)
Date: 01/06/2000 05:52:35


Hi Andrew,

you should use pfMalloc instead of new to allocate the array.

pfVec3 *vert1 = (pfVec3 *) pfMalloc( 8*sizeof(pfVec3) );

Bye
    Marc

Andrew Preece wrote:

> Hi All,
>
> I have a small test case here that creates a list of pfVec3's and then
> requests
> the array size once before the array is populated and once afterwards. The
> first
> request returns the correct size. The second request returns 0.
>
> What have I done wrong ?
>
> Andy.
>
> #include <stdlib.h>
> #include <stdio.h>
>
> // Performer includes
> #include <Performer/pf/pfChannel.h>
> #include <Performer/pf/pfDCS.h>
> #include <Performer/pf/pfLightSource.h>
> #include <Performer/pf/pfGeode.h>
> #include <Performer/pr/pfTexture.h>
> #include <Performer/pr/pfGeoSet.h>
> #include <Performer/pfutil.h>
> #include <Performer/pfdu.h>
> #include <Performer/pfui/pfiXformer.h>
>
> int main (int argc, char *argv[])
> {
> pfInit() ;
> pfConfig() ;
>
> pfVec3 *verts = (pfVec3*) new(8*sizeof(pfVec3)) pfMemory;
> fprintf( stderr, "Verts: %d.\n", pfGetSize( verts )) ;
> verts[0].set(-3.0f, -3.0f, 3.0f);
> fprintf( stderr, "Verts: %d.\n", pfGetSize( verts )) ;
> verts[1].set( 3.0f, -3.0f, 3.0f);
> verts[2].set( 3.0f, 3.0f, 3.0f);
> verts[3].set(-3.0f, 3.0f, 3.0f);
> verts[4].set(-3.0f, -3.0f, -3.0f);
> verts[5].set( 3.0f, -3.0f, -3.0f);
> verts[6].set( 3.0f, 3.0f, -3.0f);
> verts[7].set(-3.0f, 3.0f, -3.0f);
> }
>
> Andy Preece
> SGI Professional Services
> Tel: (0118) 925 7061
> Fax: (0118) 925 7569
> mailto:apreece++at++reading.sgi.com
> http://www.sgi.co.uk
>
> -----------------------------------------------------------------------
> List Archives, FAQ, FTP: http://www.sgi.com/software/performer/
> Submissions: info-performer++at++sgi.com
> Admin. requests: info-performer-request++at++sgi.com

--
+----------------------------------------------------------------------+
| Marc Hehmeyer             |      Phone +49/421/457-1896              |
| STN-Atlas Elektronik      |      Fax   +49/421/457-4120              |
| Simulation Division       |      EMail hehmeyer++at++stn-atlas.de         |
| D-28305 Bremen            |                                          |
+----------------------------------------------------------------------+


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Thu Jan 06 2000 - 05:52:13 PST

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