这是我画线的方法,我用鼠标画线
static struct
{
GLfloat p[MAX_POINTS][2];
GLuint point_cnt;
} contours [ MAX_CONTOURS ] ;
GLuint point_cnt_mouse;
point_cnt_mouse = contours[contour_cnt].point_cnt;
glColor3f( 0.0, 0.0, 0.0 );
glBegin(GL_LINES);
glLineWidth(5.0);
int i;
int j;
for(i = 0; i <= contour_cnt; i++)
{
GLuint point_cnt;
point_cnt = contours[i].point_cnt;
if (contours[i].point_cnt == 0)
{
glVertex2fv ( P );
glVertex2fv ( P );
}//if
else
{
for(j = 2; j <= point_cnt; j++)
{
glVertex2fv (contours[i].p[j-2]);
glVertex2fv (contours[i].p[j-1]);
}//for
}//else
}//for
if(point_cnt_mouse > 0)
{
glVertex2fv(contours[contour_cnt].p[point_cnt_mouse-1]);
glVertex2fv(P);
}//if
glEnd();
然后我使用 glTexImage2D() 制作 GL_TEXTURE_2D 然后我的显示是
void display()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
glPushMatrix ();
glTranslatef(-4.0, 5.0, -6.0);
//this is box and load texture on it
drawPlane();
glPopMatrix();
glutSwapBuffers();
glFlush();
}
void myinit()
{
glClearColor(1.0, 1.0, 1.0, 1.0);
glEnable(GL_DEPTH_TEST);
//load png image
drawLogo();
glDisable(GL_DEPTH_TEST);
}
标志不会出现线条,为什么?谁能告诉我的代码有什么问题?