我目前正在探索opengl通過使用JOGL庫(用於openGL的java包裝)來創建2d/3d圖形。目前,我對通過「glutBitmapString」方法渲染的文本存在一些小問題,它不會根據以下屏幕截圖所示的窗口調整大小。不幸的是,我得到的工作規範是必須用Java完成的,所以我不能跳轉到任何其他支持openGL的更好的語言。JOGL過度文本不能調整窗口和原始大小
窗口中的其他內容正確調整大小,所以我假設問題出現在我已經發布的代碼中,如果不是,那麼我會很高興發佈您認爲與問題相關的代碼。
這裏是我使用呈現文本
GL gl = drawable.getGL();
GLUT glut = new GLUT();
float textPosx = -0.4f;
float textPosy = -2.1f;
gl.glColor3f(1.0f, 0.0f, 0.0f);
// Move to rastering position
gl.glRasterPos2f(textPosx, textPosy);
// convert text to bitmap and tell what string to put
glut.glutBitmapString(GLUT.BITMAP_HELVETICA_12, "0");
textPosx = 1.75f;
textPosy = -2.15f;
// Move to rastering position
gl.glRasterPos2f(textPosx, textPosy);
// convert text to bitmap and tell what string to put
glut.glutBitmapString(GLUT.BITMAP_HELVETICA_18, "TIME");
textPosx = -1.0f;
textPosy = 1.0f;
gl.glColor3f(0.0f, 1.0f, 0.0f);
// Move to rastering position
gl.glRasterPos2f(textPosx, textPosy);
// convert text to bitmap and tell what string to put
glut.glutBitmapString(GLUT.BITMAP_HELVETICA_18, "ERRORS");
現貨答覆,非常感謝。 :d – 2012-08-28 13:56:51