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


Java GL10類代碼示例

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


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

示例1: onSurfaceChanged

import javax.microedition.khronos.opengles.GL10; //導入依賴的package包/類
@Override
public void onSurfaceChanged(GL10 glUnused, int width, int height)
{
	// Set the OpenGL viewport to the same size as the surface.
	GLES20.glViewport(0, 0, width, height);

	// Create a new perspective projection matrix. The height will stay the same
	// while the width will vary as per aspect ratio.
	final float ratio = (float) width / height;
	final float left = -ratio;
	final float right = ratio;
	final float bottom = -1.0f;
	final float top = 1.0f;
	final float near = 1.0f;
	final float far = 10.0f;

	Matrix.frustumM(mProjectionMatrix, 0, left, right, bottom, top, near, far);
}
 
開發者ID:biezhihua,項目名稱:Android_OpenGL_Demo,代碼行數:19,代碼來源:LessonTwoRenderer.java

示例2: onDrawFrame

import javax.microedition.khronos.opengles.GL10; //導入依賴的package包/類
public void onDrawFrame ( GL10 glUnused )
{
   // Set the viewport
   GLES30.glViewport ( 0, 0, mWidth, mHeight );

   // Clear the color buffer
   GLES30.glClear ( GLES30.GL_COLOR_BUFFER_BIT );

   // Use the program object
   GLES30.glUseProgram ( mProgramObject );

   // Set the vertex color to red
   GLES30.glVertexAttrib4f ( 0, 1.0f, 0.0f, 0.0f, 1.0f );

   // Load the vertex position
   mVertices.position ( 0 );
   GLES30.glVertexAttribPointer ( 1, 3, GLES30.GL_FLOAT,
                                  false,
                                  0, mVertices );

   GLES30.glEnableVertexAttribArray ( 1 );

   GLES30.glDrawArrays ( GLES30.GL_TRIANGLES, 0, 3 );

   GLES30.glDisableVertexAttribArray ( 1 );
}
 
開發者ID:zhuangzaiku,項目名稱:AndroidCollection,代碼行數:27,代碼來源:Example6_3Renderer.java

示例3: draw

import javax.microedition.khronos.opengles.GL10; //導入依賴的package包/類
@Override
public void draw(GL10 gl10) {
    for (int i = 0; i < hitBoxes.size(); i++) {           // Update all the hit boxes.
        hitBoxes.get(i).update();
    }

    for (int i = 0; i < hitBoxes.size(); i++) {           // Find all the CollisionHandlers.
        HitBox h1 = hitBoxes.get(i);

        if (h1.c.getCollisionHandler() != null) {         // Is this hit box for a CollisionHandler?
            for (int j = 0; j < hitBoxes.size(); j++) {   // Compare hit box h1 to all other hit boxes.
                HitBox h2 = hitBoxes.get(j);

                if (h1.c != h2.c) {                       // Make sure it isn't the same CollisionBox!
                    boolean collided = (h1.x < h2.x + h2.w) && (h1.x + h1.w > h2.x) && (h1.y < h2.y + h2.h) && (h1.y + h1.h > h2.y);
                    if (collided) {
                        h1.c.getCollisionHandler().onCollision(h2.c);
                    }
                }
            }
        }
    }
}
 
開發者ID:ondramisar,項目名稱:AdronEngine,代碼行數:24,代碼來源:CollisionSystem.java

示例4: checkGLDriver

import javax.microedition.khronos.opengles.GL10; //導入依賴的package包/類
public synchronized void checkGLDriver(GL10 gl) {
    if (! mGLESDriverCheckComplete) {
        checkGLESVersion();
        String renderer = gl.glGetString(GL10.GL_RENDERER);
        if (mGLESVersion < kGLES_20) {
            mMultipleGLESContextsAllowed =
                    ! renderer.startsWith(kMSM7K_RENDERER_PREFIX);
            notifyAll();
        }
        mLimitedGLESContexts = !mMultipleGLESContextsAllowed;
        if (LOG_SURFACE) {
            Log.w(TAG, "checkGLDriver renderer = \"" + renderer + "\" multipleContextsAllowed = "
                    + mMultipleGLESContextsAllowed
                    + " mLimitedGLESContexts = " + mLimitedGLESContexts);
        }
        mGLESDriverCheckComplete = true;
    }
}
 
開發者ID:pavelsemak,項目名稱:alpha-movie,代碼行數:19,代碼來源:GLTextureView.java

示例5: onSurfaceChanged

import javax.microedition.khronos.opengles.GL10; //導入依賴的package包/類
@Override
public void onSurfaceChanged(GL10 gl, int width, int height) {
    mRenderListener.onSurfaceChanged(gl, width, height);

    mEngine.setUpScene();
    if (mEngine.isCameraActive() && mEngine.getCamera() != null)
        mEngine.getCamera().update(width, height);


    // Sets the current view port to the new size.
    gl.glViewport(0, 0, width, height);
    // Select the projection matrix
    gl.glMatrixMode(GL10.GL_PROJECTION);
    // Reset the projection matrix
    gl.glLoadIdentity();
    // Select the modelview matrix
    gl.glMatrixMode(GL10.GL_MODELVIEW);
    // Reset the modelview matrix

    gl.glOrthof(0, width, height, 0, 0, 1f);
}
 
開發者ID:ondramisar,項目名稱:AdronEngine,代碼行數:22,代碼來源:AdrGlRenderer.java

示例6: draw

import javax.microedition.khronos.opengles.GL10; //導入依賴的package包/類
public void draw(GL10 gl, float alpha) {

	    gl.glDisable(GL_TEXTURE_2D);
	    gl.glEnable(GL_BLEND);
		gl.glEnableClientState(GL_VERTEX_ARRAY);
		gl.glDisableClientState(GL_COLOR_ARRAY);

		// Use mColorBuffer as a global alpha mask:
		glTexEnvx(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL11.GL_COMBINE);
		glTexEnvx(GL_TEXTURE_ENV, GL11.GL_COMBINE_RGB, GL11.GL_REPLACE);
		glTexEnvx(GL_TEXTURE_ENV, GL11.GL_COMBINE_ALPHA, GL11.GL_MODULATE); // mix with alpha from glColor

		// Alpha from glColor will be used thanks to GL_MODULATE mode
		glColor4f(1f, 1f, 1f, 1f-alpha);

		glBlendFunc(GL_ZERO, GL_ONE_MINUS_SRC_ALPHA);

		gl.glVertexPointer(3, GL10.GL_FLOAT, 0, mFVertexBuffer);

		glDrawElements(GL_TRIANGLE_STRIP, VERTS, GL_UNSIGNED_SHORT, mIndexBuffer);
	}
 
開發者ID:archos-sa,項目名稱:aos-MediaLib,代碼行數:22,代碼來源:FadeOutVeil.java

示例7: onDrawFrame

import javax.microedition.khronos.opengles.GL10; //導入依賴的package包/類
@Override
public void onDrawFrame(GL10 gl) {
    //清楚深度和顏色緩衝
    GLES20.glClear(GLES20.GL_DEPTH_BUFFER_BIT | GLES20.GL_COLOR_BUFFER_BIT);

    //保護現場
    MatrixState.pushMatrix();
    //繪製原來的立方體
    mCube.drawSelf();
    //恢複現場
    MatrixState.popMatrix();


    //繪製變換後的立方體
    MatrixState.pushMatrix();
    //X軸移動4
    MatrixState.translate(4 , 0 , 0);
    //繞Z軸旋轉30度
    MatrixState.rotate(30 , 0 , 0 , 1);
    mCube.drawSelf();
    //恢複現場
    MatrixState.popMatrix();
}
 
開發者ID:ynztlxdeai,項目名稱:GLproject,代碼行數:24,代碼來源:RotateSurfaceView.java

示例8: onSurfaceChanged

import javax.microedition.khronos.opengles.GL10; //導入依賴的package包/類
public void onSurfaceChanged(GL10 unused, int width, int height) {
        GLES20.glViewport(0, 0, width, height);

        final float ratio = (float) width / height;
        final float left = -ratio;
        final float right = ratio;
        final float bottom = -1.0f;
        final float top = 1.0f;
        final float near = 2.0f;
        final float far = 10.0f;

        // this projection matrix is applied to object coordinates
        // in the onDrawFrame() method
//        Matrix.frustumM(mProjectionMatrix, 0, -ratio, ratio, -1, 1, 3, 7);
        Matrix.frustumM(mProjectionMatrix, 0, left, right, bottom, top, near, far);
    }
 
開發者ID:biezhihua,項目名稱:Android_OpenGL_Demo,代碼行數:17,代碼來源:MyGLRenderer.java

示例9: onSurfaceCreated

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

    final CameraView cameraView = mCameraViewRef.get();
    if (cameraView != null) {
        cameraView.mGLSurfaceFilter = new GLSurfaceFilter();

        Matrix.setIdentityM(mMvpMatrix, 0);
        mTextureId = cameraView.mGLSurfaceFilter.createTexture();
        cameraView.mSurfaceTexture = new SurfaceTexture(mTextureId);
        cameraView.mSurfaceTexture.setOnFrameAvailableListener(cameraView);
        if (cameraView.mCameraSurfaceListener != null) {
            cameraView.mCameraSurfaceListener.onCameraSurfaceCreate(cameraView.mSurfaceTexture);
        }
    }
}
 
開發者ID:LeonHover,項目名稱:MediaCodecRecorder,代碼行數:18,代碼來源:CameraView.java

示例10: onSurfaceChanged

import javax.microedition.khronos.opengles.GL10; //導入依賴的package包/類
@Override
public void onSurfaceChanged(GL10 glUnused, int width, int height) 
{
	// Set the OpenGL viewport to the same size as the surface.
	GLES20.glViewport(0, 0, width, height);

	// Create a new perspective projection matrix. The height will stay the same
	// while the width will vary as per aspect ratio.
	final float ratio = (float) width / height;
	final float left = -ratio;
	final float right = ratio;
	final float bottom = -1.0f;
	final float top = 1.0f;
	final float near = 1.0f;
	final float far = 1000.0f;
	
	Matrix.frustumM(mProjectionMatrix, 0, left, right, bottom, top, near, far);
}
 
開發者ID:biezhihua,項目名稱:Android_OpenGL_Demo,代碼行數:19,代碼來源:LessonSevenRenderer.java

示例11: onSurfaceChanged

import javax.microedition.khronos.opengles.GL10; //導入依賴的package包/類
@Override
public void onSurfaceChanged(GL10 glUnused, int width, int height)
{

	_width = width;
	_height = height;

	// Set the OpenGL viewport to the same size as the surface.
	GLES20.glViewport(0, 0, width, height);

	// Create a new perspective projection matrix. The height will stay the same
	// while the width will vary as per aspect ratio.
	final float ratio = (float) width / height;
	final float left = -ratio;
	final float right = ratio;
	final float bottom = -1.0f;
	final float top = 1.0f;
	final float near = 1.0f;
	final float far = 5000.0f;

	Matrix.frustumM(aProjectionMatrix, 0, left, right, bottom, top, near, far);
}
 
開發者ID:regar007,項目名稱:ShapesInOpenGLES2.0,代碼行數:23,代碼來源:ShapeRenderer.java

示例12: onSurfaceCreated

import javax.microedition.khronos.opengles.GL10; //導入依賴的package包/類
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
	if(DBG) Log.d(TAG, "onSurfaceCreated");
	// mGL = gl;

	// Tell the listener as soon as GL stack is ready
	if(DBG) Log.d(TAG,"GL_READY");
    mListener.sendEmptyMessage(RendererListener.MSG_GL_READY);

    // Depth management is done "by hand", by sorting covers. Because of Blending.
    // Sometimes I even want to display cover behind, to mimic transparency
    glDisable(GL_DEPTH_TEST);

    glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);

    // Enable stuff (...)
    glEnableClientState(GL_VERTEX_ARRAY);
    glDisableClientState(GL_COLOR_ARRAY); // This must be disabled to use glColor for covers
    glEnableClientState(GL_TEXTURE_COORD_ARRAY);
}
 
開發者ID:archos-sa,項目名稱:aos-MediaLib,代碼行數:20,代碼來源:CoversRenderer.java

示例13: genTexture

import javax.microedition.khronos.opengles.GL10; //導入依賴的package包/類
public static int genTexture(int textureType) {
    int[] genBuf = new int[1];
    GLES20.glGenTextures(1, genBuf, 0);
    GLES20.glBindTexture(textureType, genBuf[0]);

    // Set texture default draw parameters
    if (textureType == GLES11Ext.GL_TEXTURE_EXTERNAL_OES) {
        GLES20.glTexParameterf(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_LINEAR);
        GLES20.glTexParameterf(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_LINEAR);
        GLES20.glTexParameteri(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, GL10.GL_TEXTURE_WRAP_S, GL10.GL_CLAMP_TO_EDGE);
        GLES20.glTexParameteri(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, GL10.GL_TEXTURE_WRAP_T, GL10.GL_CLAMP_TO_EDGE);

    } else {
        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_LINEAR);
        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_LINEAR);
        GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_S, GL10.GL_REPEAT);
        GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_T, GL10.GL_REPEAT);
    }

    return genBuf[0];
}
 
開發者ID:SimonCherryGZ,項目名稱:face-landmark-android,代碼行數:22,代碼來源:MyGLUtils.java

示例14: onDrawFrame

import javax.microedition.khronos.opengles.GL10; //導入依賴的package包/類
@Override
public void onDrawFrame(GL10 gl) {
    //Log.i(LOGTAG, "onDrawFrame start");

    if (!mHaveFBO)
        return;

    synchronized(this) {
        if (mUpdateST) {
            mSTexture.updateTexImage();
            mUpdateST = false;
        }

        GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);

        CameraTextureListener texListener = mView.getCameraTextureListener();
        if(texListener != null) {
            //Log.d(LOGTAG, "haveUserCallback");
            // texCamera(OES) -> texFBO
            drawTex(texCamera[0], true, FBO[0]);

            // call user code (texFBO -> texDraw)
            boolean modified = texListener.onCameraTexture(texFBO[0], texDraw[0], mCameraWidth, mCameraHeight);

            if(modified) {
                // texDraw -> screen
                drawTex(texDraw[0], false, 0);
            } else {
                // texFBO -> screen
                drawTex(texFBO[0], false, 0);
            }
        } else {
            Log.d(LOGTAG, "texCamera(OES) -> screen");
            // texCamera(OES) -> screen
            drawTex(texCamera[0], true, 0);
        }
        //Log.i(LOGTAG, "onDrawFrame end");
    }
}
 
開發者ID:vulovicv23,項目名稱:opencv-documentscanner-android,代碼行數:40,代碼來源:CameraGLRendererBase.java

示例15: onSurfaceChanged

import javax.microedition.khronos.opengles.GL10; //導入依賴的package包/類
@Override
public void onSurfaceChanged(GL10 gl, int surfaceWidth, int surfaceHeight) {
    Log.i(LOGTAG, "onSurfaceChanged("+surfaceWidth+"x"+surfaceHeight+")");
    mHaveSurface = true;
    updateState();
    setPreviewSize(surfaceWidth, surfaceHeight);
}
 
開發者ID:vulovicv23,項目名稱:opencv-documentscanner-android,代碼行數:8,代碼來源:CameraGLRendererBase.java


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