Jump to content

  • Log In with Google      Sign In   
  • Create Account

opengl 3d point cloud render from x,y,z 2d array with texture


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 headbanger   Members   -  Reputation: 101

Like
0Likes
Like

Posted 10 October 2012 - 12:34 AM

Hello everyone. Need some direction on 3d point cloud display using openGl in c++ (vs2008). I am brand new to openGl and trying to do a 3d point cloud display with a texture. I have 3 2D arrays (each same size 1024x512) representing x,y,z of each point. I think I am on the right track with


> glBegin(GL_POLYGON);
> for(int i=0; i<1024; i++)
> {
> for(int j=0; j<512; j++)
> {
> glVertex3f(x[i][j], y[i][j], z[i][j]);
> }
> }
> glEnd();

EDIT: SORRY for putting in code in the text like this. for some reason only first two line of my code were showing using the code tags.

Now this loads all the vertices in the buffer (i think) but from here I am not sure how to proceed. Or I am completely wrong here.
Then I have another 2D array (same size) that contains color data (values from 0-255) that I want to use as texture on the 3D point cloud and display.

I understand that this maybe a very basic opengl implementation for some but for me this is a huge learning curve. So any pointers, nudge or kick in the right direction will be appreciated.

Edited by headbanger, 10 October 2012 - 01:41 AM.


Sponsor:

#2 RulerOfNothing   Members   -  Reputation: 1160

Like
0Likes
Like

Posted 10 October 2012 - 05:40 AM

When you say that the color data consists of values from 0 to 255, do you mean that you have red, green and blue values for each point? In that case you can use glColor3b(red[i][j],green[i][j],blue[i][j]); (if your color arrays are called red,green and blue). I'm actually not sure how to do non-RGB colours in OpenGL so I don't think I can help you if my assumption is incorrect.

#3 headbanger   Members   -  Reputation: 101

Like
0Likes
Like

Posted 10 October 2012 - 11:34 AM

When you say that the color data consists of values from 0 to 255, do you mean that you have red, green and blue values for each point? In that case you can use glColor3b(red[i][j],green[i][j],blue[i][j]); (if your color arrays are called red,green and blue). I'm actually not sure how to do non-RGB colours in OpenGL so I don't think I can help you if my assumption is incorrect.


No I don't have RGB for each point. I am tring to use the last array as my texture for the 3D point cloud. But first I need to generate the point cloud. That' where I am stuck at. How would I go about generating the point cloud (creat a mesh or a surface????) using the 3 array I have. That's the main question.

#4 RulerOfNothing   Members   -  Reputation: 1160

Like
0Likes
Like

Posted 12 October 2012 - 03:56 AM

Alright then, to make OpenGL render points instead of lines or polygons, you need to use glBegin(GL_POINTS) instead of glBegin(GL_POLYGON).

#5 Goran Milovanovic   Members   -  Reputation: 1104

Like
0Likes
Like

Posted 12 October 2012 - 07:14 AM

You are using deprecated functions.

Read this, and adopt modern OpenGL.

Also, I think OpenGL questions belong in the OpenGL forum.

+---------------------------------------------------------------------+

| Game Dev video tutorials  ->   http://www.youtube.com/goranmilovano |
+---------------------------------------------------------------------+




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS