用纹理贴图+由顶点表示的四边形图元来实现构造一个数组,表示我们所需的贴图:GLbyte image[64][64][3];int i,j;for( i=0; i<64; i++ ){for( j=0; j<64; j++ ){ if(i==0 || i==63 || j==0 || j==63) image[i][j][0] = image[i][j][1] = image[i][j][2] = 0;//黑色边界线 else { image[i][j][0] = 255; image[i][j][1] = image[i][j][2] = 0; }//内部为红色}}在opengl初始化中://启用纹理功能glEnable(GL_TEXTURE_2D);//加载纹理贴图GLuint rectTexture;glGenTextures(1, &rectTexture);glBindTexture(GL_TEXTURE_2D, rectTexture);glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 64, 64, 0, GL_RGB, GL_UNSIGNED_BYTE, image);在你的绘图函数中绘制矩形:glBindTexture(GL_TEXTURE_2D, rectTexture);//激活贴图glBegin(GL_QUADS);//左下角glTexCoord2f(0.f, 0.f);glVertex3f(-10.f, -5.f, 0.f);//右下角glTexCoord2f(1.f, 0.f);glVertex3f(10.f, -5.f, 0.f);//右上角glTexCoord2f(1.f, 1.f);glVertex3f(10.f, 5.f, 0.f);//左上角glTexCoord2f(0.f, 1.f);glVertex3f(-10.f, 5.f, 0.f);glEnd(); 注意,四边形要以逆时针为正面,在opengl初始化时还加入:glFrontFace(GL_CCW);