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


Java GL2.glCullFace方法代碼示例

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


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

示例1: renderPatchBoundary

import javax.media.opengl.GL2; //導入方法依賴的package包/類
protected void renderPatchBoundary(DrawContext dc, RectTile tile)
{
   // GL gl = dc.getGL();
	GL2 gl = dc.getGL().getGL2(); // GL initialization checks for GL2 compatibility.
    OGLStackHandler ogsh = new OGLStackHandler();

    ogsh.pushAttrib(gl, GL2.GL_ENABLE_BIT | GL2.GL_CURRENT_BIT | GL2.GL_POLYGON_BIT);
    try
    {
        gl.glDisable(GL.GL_BLEND);

        // Don't perform depth clipping but turn on backface culling
        gl.glDisable(GL.GL_DEPTH_TEST);
        gl.glEnable(GL.GL_CULL_FACE);
        gl.glCullFace(GL.GL_BACK);
        gl.glPolygonMode(GL.GL_FRONT, GL2.GL_LINE);

        Vec4[] corners = tile.sector.computeCornerPoints(dc.getGlobe(), dc.getVerticalExaggeration());

        gl.glColor4d(1d, 0, 0, 1d);
        gl.glBegin(javax.media.opengl.GL2.GL_QUADS);
        gl.glVertex3d(corners[0].x, corners[0].y, corners[0].z);
        gl.glVertex3d(corners[1].x, corners[1].y, corners[1].z);
        gl.glVertex3d(corners[2].x, corners[2].y, corners[2].z);
        gl.glVertex3d(corners[3].x, corners[3].y, corners[3].z);
        gl.glEnd();
    }
    finally
    {
        ogsh.pop(gl);
    }
}
 
開發者ID:iedadata,項目名稱:geomapapp,代碼行數:33,代碼來源:MYEBSRectangularTessellator.java

示例2: draw

import javax.media.opengl.GL2; //導入方法依賴的package包/類
protected void draw(DrawContext dc)
{
    this.assembleTiles(dc); // Determine the tiles to draw.

    if (this.currentTiles.size() >= 1)
    {
        // Indicate that this layer rendered something this frame.
        this.setValue(AVKey.FRAME_TIMESTAMP, dc.getFrameTimeStamp());

        if (this.getScreenCredit() != null)
        {
            dc.addScreenCredit(this.getScreenCredit());
        }

        TextureTile[] sortedTiles = new TextureTile[this.currentTiles.size()];
        sortedTiles = this.currentTiles.toArray(sortedTiles);
        Arrays.sort(sortedTiles, levelComparer);

        //GL gl = dc.getGL();
        GL2 gl = dc.getGL().getGL2(); // GL initialization checks for GL2 compatibility.
        
        if (this.isUseTransparentTextures() || this.getOpacity() < 1)
        {
            gl.glPushAttrib(GL.GL_COLOR_BUFFER_BIT | GL2.GL_POLYGON_BIT | GL2.GL_CURRENT_BIT);
            this.setBlendingFunction(dc);
        }
        else
        {
            gl.glPushAttrib(GL.GL_COLOR_BUFFER_BIT | GL2.GL_POLYGON_BIT);
        }

        gl.glPolygonMode(GL.GL_FRONT, GL2.GL_FILL);
        gl.glEnable(GL.GL_CULL_FACE);
        gl.glCullFace(GL.GL_BACK);

        dc.setPerFrameStatistic(PerformanceStatistic.IMAGE_TILE_COUNT, this.tileCountName,
            this.currentTiles.size());
        dc.getGeographicSurfaceTileRenderer().renderTiles(dc, this.currentTiles);

        gl.glPopAttrib();

        if (this.drawTileIDs)
            this.drawTileIDs(dc, this.currentTiles);

        if (this.drawBoundingVolumes)
            this.drawBoundingVolumes(dc, this.currentTiles);

        // Check texture expiration. Memory-cached textures are checked for expiration only when an explicit,
        // non-zero expiry time has been set for the layer. If none has been set, the expiry times of the layer's
        // individual levels are used, but only for images in the local file cache, not textures in memory. This is
        // to avoid incurring the overhead of checking expiration of in-memory textures, a very rarely used feature.
        if (this.getExpiryTime() > 0 && this.getExpiryTime() <= System.currentTimeMillis())
            this.checkTextureExpiration(dc, this.currentTiles);

        this.currentTiles.clear();
    }

    this.sendRequests();
    this.requestQ.clear();
}
 
開發者ID:iedadata,項目名稱:geomapapp,代碼行數:61,代碼來源:ScalingTiledImageLayer.java

示例3: draw

import javax.media.opengl.GL2; //導入方法依賴的package包/類
protected void draw(DrawContext dc)
{
    this.referencePoint = this.computeReferencePoint(dc);

    Position pos = dc.getView().getEyePosition();
    this.centerPoint = new LatLon(pos.getLatitude(), pos.getLongitude());
    
    this.assembleTiles(dc); // Determine the tiles to draw.

    if (this.currentTiles.size() >= 1)
    {
        TextureTile[] sortedTiles = new TextureTile[this.currentTiles.size()];
        sortedTiles = this.currentTiles.toArray(sortedTiles);
        Arrays.sort(sortedTiles, levelComparer);

        //GL gl = dc.getGL();
        GL2 gl = dc.getGL().getGL2(); // GL initialization checks for GL2 compatibility.

        if (this.isUseTransparentTextures() || this.getOpacity() < 1)
        {
            gl.glPushAttrib(GL.GL_COLOR_BUFFER_BIT | GL2.GL_POLYGON_BIT | GL2.GL_CURRENT_BIT);
            gl.glColor4d(1d, 1d, 1d, this.getOpacity());
            gl.glEnable(GL.GL_BLEND);
            gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA);
        }
        else
        {
            gl.glPushAttrib(GL.GL_COLOR_BUFFER_BIT | GL2.GL_POLYGON_BIT);
        }

        gl.glPolygonMode(GL.GL_FRONT, GL2.GL_FILL);
        gl.glEnable(GL.GL_CULL_FACE);
        gl.glCullFace(GL.GL_BACK);

        dc.setPerFrameStatistic(PerformanceStatistic.IMAGE_TILE_COUNT, this.tileCountName,
            this.currentTiles.size());
        dc.getGeographicSurfaceTileRenderer().renderTiles(dc, this.currentTiles);

        gl.glPopAttrib();

        if (this.drawTileIDs)
            this.drawTileIDs(dc, this.currentTiles);

        if (this.drawBoundingVolumes)
            this.drawBoundingVolumes(dc, this.currentTiles);

        this.currentTiles.clear();
    }

    this.sendRequests();
    this.requestQ.clear();
}
 
開發者ID:iedadata,項目名稱:geomapapp,代碼行數:53,代碼來源:DynamicImageTileLayer.java


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