One (of many) details that's not obvious is the accounting of vertices inside the GeoInfo and its importance in maintaining any vertex attribute arrays. If you add additional vertices to a primitive *after* the primitive has already been added to the GeoInfo (via GeoInfo::add_primitive()) then vertex attribute array sizes can get out of sync possibly causing a crash.
So until that's fixed make sure to completely build your primitive first before adding it to the GeoInfo. -jonathan On Apr 19, 2011, at 11:55 AM, Nhat Phong Tran wrote: > Well first you need to add an object which holds your primitives (i.e. > a polygon) to your output GeometryList. You can do this like this: > > out.addObject(yourObjectID); > > Now that you have an object created, you can add your primitives to > it, in your case a polygon. > > out.add_primitive(obj, new Polygon(0, 1, 2, 3)); > > So this allocates a polygon class and assigns points 0-3 to be its > vertices. But this doesn't mean that the polygon's shape has been > defined yet, because the points 0-3 have not a set position yet. To do > this you create a pointer to the pointlist that contains the points of > your object, then you need to resize the pointlist to fit all of your > primitives points. Then you iterate through the points of the polygon > of your interest and set the coordinates of each point. > > PointList* points = out.writable_points(yourObjectID); > points->resize(num_points); > > for(unsigned int p=0; p<4; p++){ > (*points)[p].set(x_pos, y_pos, z_pos); > } > > Hope this helps! > > > Nhat > > > ---------------------------------------------------------- > nhat phong tran > dipl. digital artist (FH) > computer graphics & visual effects > > m_us: +1 (310) 866-6871 > m_de: +49 (176) 24 26 34 27 > fax: +49 (321) 213 25 866 > > santa monica, ca 90401 > > sent via iPhone > ---------------------------------------------------------- > > > On 19 April 2011 09:07, Stephen Newbold <stephe...@moving-picture.com> wrote: >> Hi. Anybody know of any easy to understand documentation on how to create >> polygons using the NDK? I had a look through the Sphere.cpp example that >> ships with Nuke and like most things it went completely over my head. I'm >> hoping to be able to create something simple, just a four sided poly defined >> by 4 corner points, but have zero idea on how to go about it. >> >> Cheers, >> Steve >> >> -- >> Stephen Newbold >> Senior Compositor - Film >> MPC >> 127 Wardour Street >> Soho, London, W1F 0NL >> Main - + 44 (0) 20 7434 3100 >> www.moving-picture.com >> >> _______________________________________________ >> Nuke-dev mailing list >> Nuke-dev@support.thefoundry.co.uk >> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-dev >> > _______________________________________________ > Nuke-dev mailing list > Nuke-dev@support.thefoundry.co.uk > http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-dev _______________________________________________ Nuke-dev mailing list Nuke-dev@support.thefoundry.co.uk http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-dev