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


Java GL10.glShadeModel方法代碼示例

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


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

示例1: onSurfaceCreated

import javax.microedition.khronos.opengles.GL10; //導入方法依賴的package包/類
@Override
public void onSurfaceCreated(GL10 gl, EGLConfig eglConfig) {
    mRenderListener.onSurfaceCreated(gl);

    mEngine.getTextureLibrary().LoadTextures(gl);

    gl.glClearColor(0.0f, 0.0f, 0.0f, 0.5f);

    // Enable Smooth Shading, default not really needed.
    gl.glShadeModel(GL10.GL_SMOOTH);
    // Depth buffer setup.
    gl.glClearDepthf(1.0f);
    // Enables depth testing.
    gl.glEnable(GL10.GL_DEPTH_TEST);
    // The type of depth testing to do.
    gl.glDepthFunc(GL10.GL_LEQUAL);    // Really nice perspective calculations.
    gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, GL10.GL_NICEST);
    gl.glEnable(GL10.GL_ALPHA_TEST);
    gl.glAlphaFunc(GL10.GL_GREATER, 0.1f);

}
 
開發者ID:ondramisar,項目名稱:AdronEngine,代碼行數:22,代碼來源:AdrGlRenderer.java

示例2: onSurfaceCreated

import javax.microedition.khronos.opengles.GL10; //導入方法依賴的package包/類
@Override public void onSurfaceCreated(GL10 gl, EGLConfig config) {
    gl.glClearColor(0.0f, 0.0f, 0.0f, 1);
    gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, GL10.GL_FASTEST);
    gl.glShadeModel(GL10.GL_FLAT);
    gl.glDisable(GL10.GL_DEPTH_TEST);

    // Alpha support.
    gl.glEnable(GL10.GL_BLEND);
    gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);

    gl.glMatrixMode(GL10.GL_PROJECTION);
    gl.glLoadIdentity();

    GLU.gluOrtho2D(gl, 0, getWidth(), getHeight(), 0);
}
 
開發者ID:StringMon,項目名稱:homescreenarcade,代碼行數:16,代碼來源:GLFieldView.java

示例3: onSurfaceCreated

import javax.microedition.khronos.opengles.GL10; //導入方法依賴的package包/類
@Override
	public void onSurfaceCreated(GL10 gl, EGLConfig config) {

//		gl.glClearColor(0f, 0f, 0f, 0.5f);

		
		//gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);
		gl.glEnable(GL10.GL_BLEND);
//		 gl.glEnable(GL10.GL_TEXTURE_2D);     
//		 gl.glBlendFunc(GL10.GL_ONE, GL10.GL_SRC_COLOR);
		gl.glClearDepthf(1.0f);
		gl.glEnable(GL10.GL_DEPTH_TEST);
		gl.glDepthFunc(GL10.GL_LEQUAL);
		gl.glHint(3152, 4354);
		gl.glEnable(GL10.GL_NORMALIZE);
		gl.glShadeModel(GL10.GL_SMOOTH);

		gl.glMatrixMode(GL10.GL_PROJECTION);

		// Lighting
		gl.glEnable(GL10.GL_LIGHTING);
		gl.glLightModelfv(GL10.GL_LIGHT_MODEL_AMBIENT, getFloatBufferFromArray(new  float[]{0.5f,0.5f,0.5f,1.0f}));// 全局環境光
		gl.glLightfv(GL10.GL_LIGHT0, GL10.GL_AMBIENT_AND_DIFFUSE, new float[]{0.3f, 0.3f, 0.3f, 1.0f}, 0);
		gl.glLightfv(GL10.GL_LIGHT0, GL10.GL_POSITION, new float[] { 1000f, 1000f, 1000f, 1.0f }, 0);
		gl.glEnable(GL10.GL_LIGHT0);

	}
 
開發者ID:xhd-Git,項目名稱:3DPrint-Controller,代碼行數:28,代碼來源:STLRenderer.java

示例4: onSurfaceCreated

import javax.microedition.khronos.opengles.GL10; //導入方法依賴的package包/類
@Override
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
	gl.glClearColor(0f, 0f, 0f, 1f);
	gl.glShadeModel(GL10.GL_SMOOTH);
	gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, GL10.GL_NICEST);
	gl.glHint(GL10.GL_LINE_SMOOTH_HINT, GL10.GL_NICEST);
	gl.glHint(GL10.GL_POLYGON_SMOOTH_HINT, GL10.GL_NICEST);
	gl.glEnable(GL10.GL_LINE_SMOOTH);
	gl.glDisable(GL10.GL_DEPTH_TEST);
	gl.glDisable(GL10.GL_CULL_FACE);

	mObserver.onSurfaceCreated();
}
 
開發者ID:ichason,項目名稱:PageCurl,代碼行數:14,代碼來源:CurlRenderer.java

示例5: draw

import javax.microedition.khronos.opengles.GL10; //導入方法依賴的package包/類
/**
 * Draws this cube of the given GL-Surface
 * 
 * @param gl The GL-Surface this cube should be drawn upon.
 */
public void draw(GL10 gl) {
    gl.glEnable(GL10.GL_CULL_FACE);
    gl.glFrontFace(GL10.GL_CW);
    gl.glShadeModel(GL10.GL_SMOOTH);
    gl.glVertexPointer(3, GL10.GL_FLOAT, 0, mVertexBuffer);
    gl.glColorPointer(4, GL10.GL_FLOAT, 0, mColorBuffer);
    gl.glDrawElements(GL10.GL_TRIANGLES, 36, GL10.GL_UNSIGNED_BYTE, mIndexBuffer);
}
 
開發者ID:peter10110,項目名稱:Android-SteamVR-controller,代碼行數:14,代碼來源:Cube.java

示例6: onSurfaceCreated

import javax.microedition.khronos.opengles.GL10; //導入方法依賴的package包/類
@Override
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
	gl.glClearColor(0f, 0f, 0f, 0f);
	gl.glShadeModel(GL10.GL_SMOOTH);
	gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, GL10.GL_NICEST);
	gl.glHint(GL10.GL_LINE_SMOOTH_HINT, GL10.GL_NICEST);
	gl.glHint(GL10.GL_POLYGON_SMOOTH_HINT, GL10.GL_NICEST);
	// gl.glEnable(GL10.GL_LINE_SMOOTH);
	gl.glDisable(GL10.GL_DEPTH_TEST);
	gl.glDisable(GL10.GL_CULL_FACE);
	gl.glDisable(GL10.GL_DITHER);
}
 
開發者ID:AmulaySoftGroup,項目名稱:TaBeTa,代碼行數:13,代碼來源:CurlRenderer.java

示例7: onSurfaceCreated

import javax.microedition.khronos.opengles.GL10; //導入方法依賴的package包/類
@Override
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
	gl.glGenTextures(NUMBER_OF_TEXTURES, mtextureMgr.mtextures, 0);

    gl.glShadeModel(GL10.GL_SMOOTH);             //Enable Smooth Shading
    gl.glClearColor(0.0f, 0.0f, 0.0f, 0.5f);     //Black Background
    gl.glClearDepthf(1.0f);                     //Depth Buffer Setup
    gl.glEnable(GL10.GL_DEPTH_TEST);             //Enables Depth Testing
    gl.glDepthFunc(GL10.GL_LEQUAL);             //The Type Of Depth Testing To Do

    //Really Nice Perspective Calculations
    gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, GL10.GL_NICEST);

}
 
開發者ID:woshiwpa,項目名稱:SmartMath,代碼行數:15,代碼來源:OGLChart.java

示例8: onSurfaceCreated

import javax.microedition.khronos.opengles.GL10; //導入方法依賴的package包/類
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
    /*
     * By default, OpenGL enables features that improve quality
     * but reduce performance. One might want to tweak that
     * especially on software renderer.
     */
    gl.glDisable(GL10.GL_DITHER);

    /*
     * Some one-time OpenGL initialization can be made here
     * probably based on features of this particular context
     */
    gl.glClearColor(1,1,1,1);
    gl.glEnable(GL10.GL_CULL_FACE);
    gl.glShadeModel(GL10.GL_SMOOTH);
    gl.glEnable(GL10.GL_DEPTH_TEST);

    /*
     * create / load the our 3D models here
     */

    gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
    gl.glEnableClientState(GL10.GL_COLOR_ARRAY);

    float vertices[] = {
            0,0,0,
            1,0,0,
            0,1,0,
            0,0,1
    };
    float colors[] = {
            0,0,0,0,
            1,0,0,1,
            0,1,0,1,
            0,0,1,1
    };
    byte indices[] = { 0, 1, 0, 2, 0, 3 };

    // Buffers to be passed to gl*Pointer() functions
    // must be direct, i.e., they must be placed on the
    // native heap where the garbage collector cannot
    // move them.
    //
    // Buffers with multi-byte datatypes (e.g., short, int, float)
    // must have their byte order set to native order

    ByteBuffer vbb;
    vbb = ByteBuffer.allocateDirect(vertices.length*4);
    vbb.order(ByteOrder.nativeOrder());
    mVertexBuffer = vbb.asFloatBuffer();
    mVertexBuffer.put(vertices);
    mVertexBuffer.position(0);

    vbb = ByteBuffer.allocateDirect(colors.length*4);
    vbb.order(ByteOrder.nativeOrder());
    mColorBuffer = vbb.asFloatBuffer();
    mColorBuffer.put(colors);
    mColorBuffer.position(0);

    mIndexBuffer = ByteBuffer.allocateDirect(indices.length);
    mIndexBuffer.put(indices);
    mIndexBuffer.position(0);
}
 
開發者ID:sdrausty,項目名稱:buildAPKsSamples,代碼行數:64,代碼來源:CompassActivity.java


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