我的绘图代码有问题。我必须显示一些箭头,但是当它们离轴的原点太远时它们会消失..
我在这里发布我的相关代码:
static void drawArrow( double trans[3][4] , double **d, int num, double *altitude)
{
int i;
double c_min=0.3;
double gl_para[16];
GLfloat mat_ambient[] = {0.0, 0.0, 1.0, 1.0};
GLfloat mat_flash[] = {0.0, 0.0, 1.0, 1.0};
GLfloat mat_flash_shiny[] = {50.0};
GLfloat light_position[] = {100.0,-200.0,200.0,0.0};
GLfloat ambi[] = {0.1, 0.1, 0.1, 0.1};
GLfloat lightZeroColor[] = {0.9, 0.9, 0.9, 0.1};
...
argConvGlpara(trans, gl_para);
glMatrixMode(GL_PROJECTION);
glLoadIdentity
glLoadMatrixd( gl_para );
glRotated(180,1,0,0);
glutWireCone(40,40*arrow_factor,10,100);
//arrowfactor can change by keyboard input
...
glDisable( GL_LIGHTING );
glDisable( GL_DEPTH_TEST );
}
我想我必须使用GL_PROJECTION矩阵模式,但我相信如果有更好的方法让它工作而不改变它...
编辑:删除了不必要的代码部分