當前位置: 首頁>>代碼示例>>Java>>正文


Java GL.glNewList方法代碼示例

本文整理匯總了Java中javax.media.opengl.GL.glNewList方法的典型用法代碼示例。如果您正苦於以下問題:Java GL.glNewList方法的具體用法?Java GL.glNewList怎麽用?Java GL.glNewList使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.media.opengl.GL的用法示例。


在下文中一共展示了GL.glNewList方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: updateMapDisplayLists

import javax.media.opengl.GL; //導入方法依賴的package包/類
/**
 * Update display lists for waypoints and path quads according to preferences
 */
private synchronized void updateMapDisplayLists(GL gl) {
    // delete old
    gl.glDeleteLists(pathDisplayList, 1);
    gl.glDeleteLists(waypointDisplayList, 1);

    // create new
    pathDisplayList = gl.glGenLists(1);
    gl.glNewList(pathDisplayList, GL.GL_COMPILE);
    renderPaths(gl, pathTris);
    gl.glEndList();

    waypointDisplayList = gl.glGenLists(1);
    gl.glNewList(waypointDisplayList, GL.GL_COMPILE);
    renderWaypoints(gl, waypointsTris);
    gl.glEndList();
}
 
開發者ID:kefik,項目名稱:Pogamut3,代碼行數:20,代碼來源:MapRenderer.java

示例2: createGridList

import javax.media.opengl.GL; //導入方法依賴的package包/類
/**
 * Create OpenGl list for grid lines of the map.
 * @return id of a list
 */
private int createGridList(GL gl) {
    Box mapBox = map.getBox();
    int numMainLines = getNumGridLines(mapBox);

    double lineLength = 2 * GRID_SCALE * numMainLines;
    // TODO: Is 10 good arbiotrary number?
    double floorZ = getGridZ();
    int list = gl.glGenLists(1);

    gl.glNewList(list, GL.GL_COMPILE);
    {
        gl.glBegin(GL.GL_LINES);
        {
            // central X lines, red
            double minY = mapBox.getCenterY() - lineLength / 2;
            double maxY = mapBox.getCenterY() + lineLength / 2;

            gl.glColor3d(0.45, 0.29, 0.32);
            gl.glVertex3d(mapBox.getCenterX(), minY, floorZ);
            gl.glVertex3d(mapBox.getCenterX(), maxY, floorZ);

            // central Y line, green
            double minX = mapBox.getCenterX() - lineLength / 2;
            double maxX = mapBox.getCenterX() + lineLength / 2;

            gl.glColor3d(0.3, 0.57, 0.31);
            gl.glVertex3d(minX, mapBox.getCenterY(), floorZ);
            gl.glVertex3d(maxX, mapBox.getCenterY(), floorZ);

            // other lines for better idea about size of level
            // main lines
            for (int line = 1; line <= numMainLines; line++) {
                for (int coef = -1; coef <= 1; coef += 2) {
                    // main lines (darker grey)
                    gl.glColor3d(0.34, 0.34, 0.34);
                    // draw along Y axis
                    gl.glVertex3d(mapBox.getCenterX() + coef * line * GRID_SCALE, minY, floorZ);
                    gl.glVertex3d(mapBox.getCenterX() + coef * line * GRID_SCALE, maxY, floorZ);
                    // draw along X axis
                    gl.glVertex3d(minX, mapBox.getCenterY() + coef * line * GRID_SCALE, floorZ);
                    gl.glVertex3d(maxX, mapBox.getCenterY() + coef * line * GRID_SCALE, floorZ);

                    // minor lines (lighter grey)
                    gl.glColor3d(0.41, 0.41, 0.41);
                    for (int minority = 1; minority < 10; minority++) {
                        // draw along Y axis
                        gl.glVertex3d(mapBox.getCenterX() + coef * ((line - 1) * GRID_SCALE + minority * GRID_SCALE / 10), minY, floorZ);
                        gl.glVertex3d(mapBox.getCenterX() + coef * ((line - 1) * GRID_SCALE + minority * GRID_SCALE / 10), maxY, floorZ);
                        // draw along X axis
                        gl.glVertex3d(minX, mapBox.getCenterY() + coef * ((line - 1) * GRID_SCALE + minority * GRID_SCALE / 10), floorZ);
                        gl.glVertex3d(maxX, mapBox.getCenterY() + coef * ((line - 1) * GRID_SCALE + minority * GRID_SCALE / 10), floorZ);
                    }
                }
            }
        }
        gl.glEnd();
    }
    gl.glEndList();

    return list;
}
 
開發者ID:kefik,項目名稱:Pogamut3,代碼行數:66,代碼來源:MapRenderer.java


注:本文中的javax.media.opengl.GL.glNewList方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。