AnsweredAssumed Answered

Issue while drawing triangle in Solidworks using openGL?

Question asked by Mahadev Dharme on Sep 20, 2019
Latest reply on Sep 20, 2019 by Simon Turner

I have drawing triangle in solidworks using openGL. The code is as follow:

 

GLdouble OpenGLmatrix[16];
GLdouble nScaling = -1.0;

 

IMathTransform *mathTransform;
modelView->get_Transform(&mathTransform);

 

double Xform[16];
mathTransform->get_IArrayData(Xform);

 

nScaling = Xform[12];

OpenGLmatrix[0] = nScaling * Xform[0];
OpenGLmatrix[1] = nScaling * Xform[1];
OpenGLmatrix[2] = nScaling * Xform[2];
OpenGLmatrix[3] = 0.0;

OpenGLmatrix[4] = nScaling * Xform[3];
OpenGLmatrix[5] = nScaling * Xform[4];
OpenGLmatrix[6] = nScaling * Xform[5];
OpenGLmatrix[7] = 0.0;

OpenGLmatrix[8] = nScaling * Xform[6];
OpenGLmatrix[9] = nScaling * Xform[7];
OpenGLmatrix[10] = nScaling * Xform[8];
OpenGLmatrix[11] = 0.0;

OpenGLmatrix[12] = Xform[9];
OpenGLmatrix[13] = Xform[10];
OpenGLmatrix[14] = Xform[11];
OpenGLmatrix[15] = 1.0;

 

// apply component Xform to OpenGL matrix
glMultMatrixd(OpenGLmatrix);

 

//draw traingle

glBegin(GL_TRIANGLES);
glVertex3d(0, 0, 0);
glVertex3d(0, 1, 0);
glVertex3d(1, 0.5, 0);
glEnd();

 

 

but triangle is not visible in solidworks. What is the issue?

Outcomes