我有这个正在工作的渲染功能:
void RenderFunction(void)
{
++FrameCount;
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
drawGraph();
drawAxis();
glutSwapBuffers();
glutPostRedisplay();
}
这是给我一个点图。我希望能够显示一个小文本。我读了这篇文章:http: //www.codersource.net/MFC/OpenGL/DisplayingTextOpenGLTutorial5.aspx,唯一需要做的就是复制该函数并更新我的代码:
void RenderFunction(void)
{
++FrameCount;
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
drawBitmapText("Osama Hosam's OpenGL Tutorials",200,200,0);
drawGraph();
drawAxis();
glutSwapBuffers();
glutPostRedisplay();
}
renderFunction 在里面被调用glutDisplayFunc(RenderFunction);
对此有任何想法。我想要任何建议,因为它没有显示任何内容。
更新:
void drawGraph(){
glBindVertexArray(VaoId);
glEnable(GL_LINE_SMOOTH);
glLineWidth(0);
glDrawElements(GL_LINES, 48, GL_UNSIGNED_BYTE, (GLvoid*)0);
glPointSize(10);
glDrawElements(GL_POINTS, 48, GL_UNSIGNED_BYTE, (GLvoid*)0);
}
void drawAxis(){
glDisable(GL_LINE_SMOOTH);
glBindVertexArray(VaoIdAxis);
glDrawElements(GL_LINES, 4, GL_UNSIGNED_BYTE, (GLvoid*)0);
}