-1
我已經創建了6個平面作爲JOGL中的一個房間,現在我想用不同的圖像紋理它們,所以我怎樣才能在每個平面上做到這一點?還有如何推薦紋理圖像資源,我可以用它來裝飾房間?如何紋理JOGL中的不同平面
謝謝。
public void render(GL2 gl) {
gl.glClear(GL2.GL_COLOR_BUFFER_BIT|GL2.GL_DEPTH_BUFFER_BIT);
gl.glLoadIdentity();
camera.view(glu); // Orientate the camera
doLight(gl); // Place the light
doLight2(gl);
if (axes.getSwitchedOn())
axes.display(gl, glut);
if (objectsOn) { // Render the objects
gl.glPushMatrix();
//Making the room.
double planeParam = animationScene.getParam(animationScene.PLANE_PARAM);
//red x, blue z, green y.
gl.glTranslated(planeParam,0,0);
//Base
plane.renderDisplayList(gl);
//Back wall
gl.glTranslated(0,25,-25);
gl.glRotated(90, 1, 0, 0);
plane.renderDisplayList(gl);
//Right wall
gl.glTranslated(25,25,0);
gl.glRotated(90, 0, 0, 1);
plane.renderDisplayList(gl);
//Front wall
gl.glTranslated(25,25,0);
gl.glRotated(90, 0, 0, 1);
plane.renderDisplayList(gl);
//Roof
gl.glTranslated(0,25,-25);
gl.glRotated(90, 1, 0, 0);
plane.renderDisplayList(gl);
//Left wall
gl.glTranslated(25,25,0);
gl.glRotated(90, 0, 0, 1);
plane.renderDisplayList(gl);
gl.glPopMatrix();
}
你不應該使用任何顯示列表,這個功能在許多驅動程序(甚至是一些舊驅動程序)中是半分的。而是使用編譯的頂點數組或靜態VBO。 – gouessej