View unanswered posts | View active topics It is currently Thu Jun 24, 2021 10:09 am

Reply to topic  [ 1 post ] 
 Support color of points in a point cloud 
Author Message

Joined: Tue Apr 19, 2011 3:35 pm
Posts: 5
Location: Bremen, Germany
Post Support color of points in a point cloud
would it be possible to let have points in GLC_Pointclouds to have a per vertex color?

You could just interleave the color data with the vertex data in the internal buffer:

//first some data structure for my points
typedef struct
   float pos[3];
   float color[3];
   inline float x() const { return pos[0]; }
   inline float y() const { return pos[1]; }
   inline float z() const { return pos[2]; }
   inline float r() const { return color[0]; }
   inline float g() const { return color[1]; }
   inline float b() const { return color[2]; }
} Point;

//get my points from somewhere
Point pointArray[numOfPoints] = getMyPoints();

//create GLC_Pointcloud
GLfloatVector v(numOfPoints * 6);
for (int i = 0; i < numOfPoints; i++)
     v << pointArray[i].x() << pointArray[i].y() << pointArray[i].z() << pointArray[i].r() << pointArray[i].g() << pointArray[i].b();
GLC_3DViewInstance pointCloud(GLC_Factory::instance()->createPointCloud(v)); //material not needed anymore?

//add to world etc.

Then you would probably just have to enable the corresponding client state and set the offset when rendering the point cloudsin GLC_Wiredata::glDraw(..):
if (GL_POINTS==mode)
    glColorPointer(3, GL_FLOAT, 3, BUFFER_OFFSET(12));

That feature would be very appreciated :-)


Thu May 26, 2011 8:18 pm
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 1 post ] 

Who is online

Users browsing this forum: No registered users and 1 guest

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.