nicholas_yue Posted December 12, 2014 Share Posted December 12, 2014 Hi, I am studying the tetprim example code. I see the following code and would like to find out if the returned GL buffer always expect one to fill them in with triangles ? Therefore if we have quads, we need to split it up into two triangles per quads ? If I have misunderstood the GL buffer returned by pos->map() and that it supports n-gon, where should one specify the per-polygon vertex count ? I have had a look at the GT code and it has the concept of vertex_order[] so I am fine with that. I want to test out a GR implementation hence the above question. ============= CODE ======================= // Initialize the number of points in the geometry. myGeo->setNumPoints( 12 * num_tets); // Fetch P (point position). If its cache version matches, no upload is // required. pos = myGeo->findCachedAttribOrArray(r, posname, RE_GPU_FLOAT32, 3, RE_ARRAY_POINT, true); if(pos->getCacheVersion() != p.geo_version) { // map() returns a pointer to the GL buffer UT_Vector3F *pdata = static_cast<UT_Vector3F *>(pos->map®); if(pdata) { for(int t=0; t<num_tets; t++) { pdata[0] = pt(t*4); pdata[1] = pt(t*4+1); pdata[2] = pt(t*4+2); pdata[3] = pt(t*4); pdata[4] = pt(t*4+2); pdata[5] = pt(t*4+3); pdata[6] = pt(t*4+1); pdata[7] = pt(t*4+2); pdata[8] = pt(t*4+3); pdata[9] = pt(t*4); pdata[10] = pt(t*4+3); pdata[11] = pt(t*4+1); pdata += 12; } Cheers Quote Link to comment Share on other sites More sharing options...
nicholas_yue Posted December 15, 2014 Author Share Posted December 15, 2014 Answering my own post. The usage of the points to draw geometry is determined in the call myGeo->connectSomePrimsI() There are a variety of options closely related to OpenGL primitives GL_* enums. Cheers Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.