1
我有這樣的渲染工作職能:OpenGL的繪製文本對象除了
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);
任何想法這一點。我想要任何建議,因爲它沒有顯示任何內容。
UPDATE:
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);
}