c++ - How do I display/draw a .ply object in OpenGL? -


I am trying to drag OpenGL to the diagram that I load with OPENFILENAME I am doing What I've got now: I can show comments, tops, how many faces, but I can not attract this figure and I am not sure how to do this, I can attract other pre-determined figures, But the people whom I am trying to open are not.


This is where I am starting everything:

  Case WM_CREATE: HDC = Gate DC (HWND); Hrc = wglCreateContext (HDC); WglMakeCurrent (HDC, HRC); G_hwndDlg = CreateDialog (HIN, MACNTIOUS1, HW & D, Dialog Process); Figure = newer drawer (); InitGL (); break;  

This is where I am finding out which element I am opening:

  / * Learn through the file * / / * and read them * / for (i = 0; i & lt; nelems; i ++) {/ * Get details of first element * / elem_name = elist [i]; Plist = ply_get_element_description (ply, elem_name, and num_elems, and nprops); Int el = sprintf (szFile, "element% s% d \ n", elem_name, num_elems); Print the name of the element for / * debugging * / TextOut (HDC, 150,0 + i * 20, SJFile, L); / * If we are on the top elements, then read them / / (Write equal marks / strings ("vertex", elem_name)) / / to create a top list to catch all the titles * / vlist = (Vertex **) malloc (sizeof (Vertex *) * num_elems); / * Set up for Vertex elements * / ply_get_property (please, AMM_name, and verte_prop [0]); Ply_get_property (ply, elem_name, and vert_props [1]); Ply_get_property (please, elem_name, and vert_props [2]); / * Hold all the top elements * / for (j = 0; j & lt; num_elems; j ++) {int move = 10; / * File grab and element * / vlist [j] = (vertex *) mauloq (vertex); Ply_get_element (please, (void *) vlist [j]); Int vert = sprintf (szFile, "vertex:% g% g% g", vlist [j] -> x, vlist [j] -> y, vlist [j] - gt; z); Print Vertex X, Y, Z for / * debugging * / TextOut (HDC, 600, LEFT + J * 20, SFFILE, WIRE); Figure-> Parameter (vlist [j] -> gt; vlist [j] - & gt; y, vlist [j] - & gt; z); }}  

And this is where the class shape is, where I have been reconciled to attract everything:

  Figure: Figure ( } {} Zero Figure: parameter (float x, float y, float z) {it-> X1 = x; This- & gt; Y1 = y; This- & gt; Z1 = z; } Zero Figure :: Draw () {glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); GlLoadIdentity (); GluLookAt (0.0,0.0,4.0,0.0,0.0,0.0,0.0,1.0,0.0); GlBegin (GL_TRIANGLES); GlNormal3f (x1, y1, z1); GlVertex3f (x1, y1, z1); GlEnd (); } X1, y1, z1 have been declared in the picture  

I tried to explain myself the best; If you think it still requires more explanation, please let me know and I will explain it in some other way

Yes, I forgot to explain that I think I would draw that picture I am trying to ... well it does not know which figure it would be because I am using OpenFiIIEMA 1 linear shape to open and used to triangle it by dragging it That I thought that I can draw anything with the triangle and I have also tried in the class to ask for the number of parameter number I am working in class draw and for this I am making "for" but It is not working

You only specify a header between start / end. You need atleast 3 to specify a triangle. And so much more if you want a complete Bench triangle, you want something else on the pattern of this:

  Zero Image: parameter (float x, float y, float z) {m_vertices.push_back (myVertex ( X, y, z)); } Zero Figure :: Draw () {glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); GlLoadIdentity (); GluLookAt (0.0,0.0,4.0,0.0,0.0,0.0,0.0,1.0,0.0); GlBegin (GL_TRIANGLES); Insert (m_vertices.size ()% 3 == 0); // Since we (size_t i = 0; i & lt; m_vertices.size (i ++) {glNormal3f (m_vertices [i] .x, m_versities [i] .y, m_vertices [i] .z) for triangle ; GlVertex3f (m_vertices [i] .x, m_vertices [i] .y, m_vertices [i] .z);} glend ();}  

Comments