AnsweredAssumed Answered

Problem while drawing triangles using openGL in solidworks?

Question asked by Mahadev Dharme on Sep 20, 2019

Hi,

 I want to draw triangle in solidworks using openGL. Please refer following code:

 

OnBufferSwap()

{

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();

}

 

Triangle is not visible in solid-works. What is the issue?

Outcomes