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


Java GLES20.glUniform4f方法代碼示例

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


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

示例1: draw

import android.opengl.GLES20; //導入方法依賴的package包/類
public void draw() {

        if ( RADER_VALUES.isModeAR == true ) {
            //光源位置の指定
            GLES20.glUniform4f(GLES.lightPosHandle,0f,10f,0f,1.0f);

            GLES.glPushMatrix();
            Matrix.rotateM( GLES.mMatrix, 0, RADER_VALUES.northDirection - RADER_VALUES.rotation, 0, 1, 0 );
            Matrix.rotateM( GLES.mMatrix, 0, RADER_VALUES.elevation+95, 1, 0, 0 );

            Matrix.translateM( GLES.mMatrix, 0, 0, 0, -RADER_VALUES.distance*2 );
//            Matrix.translateM( GLES.mMatrix, 0, 0, 0, -100 );
            GLES.glPushMatrix();
            GLES.updateMatrix();

            drawTarget(); // 立方體描畫

            GLES.glPopMatrix();
            GLES.glPopMatrix();
        }
    }
 
開發者ID:jphacks,項目名稱:TK_1701,代碼行數:22,代碼來源:TargetObject.java

示例2: onSurfaceCreated

import android.opengl.GLES20; //導入方法依賴的package包/類
@Override
public void onSurfaceCreated(GL10 gl10,EGLConfig eglConfig) {
    // プログラムの生成
    GLES.makeProgram();

    // 頂點配列の有効化
    GLES20.glEnableVertexAttribArray(GLES.positionHandle);
    GLES20.glEnableVertexAttribArray(GLES.normalHandle);

    // デプスバッファの有効化
    GLES20.glEnable(GLES20.GL_DEPTH_TEST);
    // アルファブレンド有効化
    GLES20.glBlendFunc(GLES20.GL_SRC_ALPHA, GLES20.GL_ONE_MINUS_SRC_ALPHA);
    GLES20.glEnable(GLES20.GL_BLEND);

    //光源色の指定
    GLES20.glUniform4f(GLES.lightAmbientHandle,0.2f,0.2f,0.2f,1.0f);
    GLES20.glUniform4f(GLES.lightDiffuseHandle,0.7f,0.7f,0.7f,1.0f);
    GLES20.glUniform4f(GLES.lightSpecularHandle,0.0f,0.0f,0.0f,1.0f);

    raderObject = new RaderObject_UI();
    targetObject = new TargetObject();
}
 
開發者ID:jphacks,項目名稱:TK_1701,代碼行數:24,代碼來源:MyRenderer.java

示例3: updateFloatValue

import android.opengl.GLES20; //導入方法依賴的package包/類
private void updateFloatValue(float... value) {
    switch (value.length) {
        case 1:
            GLES20.glUniform1f(handle(), value[0]);
            break;
        case 2:
            GLES20.glUniform2f(handle(), value[0], value[1]);
            break;
        case 3:
            GLES20.glUniform3f(handle(), value[0], value[1], value[2]);
            break;
        case 4:
            GLES20.glUniform4f(handle(), value[0], value[1], value[2], value[3]);
            break;
        case 16:
            GLES20.glUniformMatrix4fv(handle(), 1, false, value, 0);
        default:
            break;
    }
}
 
開發者ID:gplibs,項目名稱:android-magic-surface-view,代碼行數:21,代碼來源:GLUniformParameter.java

示例4: setMaterial

import android.opengl.GLES20; //導入方法依賴的package包/類
private void setMaterial(float r,float g,float b,float a) {
    //マテリアルの環境光色の指定
    GLES20.glUniform4f(GLES.materialAmbientHandle,r,g,b,a);

    //マテリアルの拡散光色の指定
    GLES20.glUniform4f(GLES.materialDiffuseHandle,r,g,b,a);

    //マテリアルの鏡麵光色と鏡麵指數の指定
    GLES20.glUniform4f(GLES.materialSpecularHandle,r,g,b,a);
    GLES20.glUniform1f(GLES.materialShininessHandle,0.6f);
}
 
開發者ID:jphacks,項目名稱:TK_1701,代碼行數:12,代碼來源:RaderObject_UI.java

示例5: onDrawFrame

import android.opengl.GLES20; //導入方法依賴的package包/類
@Override
public void onDrawFrame(GL10 gl10) {
    // 畫麵をglClearColorで指定した色で初期化
    GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT|
            GLES20.GL_DEPTH_BUFFER_BIT);

    //射影変換
    Matrix.setIdentityM(GLES.pMatrix,0);
    GLES.gluPerspective(GLES.pMatrix,
            60.0f,  //Y方向の畫角
            aspect, //アスペクト比
            0.1f,   //ニアクリップ
            1000.0f);//ファークリップ

    //光源位置の指定
    GLES20.glUniform4f(GLES.lightPosHandle,0f,0f,0f,1.0f);


    Matrix.setIdentityM(GLES.mMatrix,0);
    //ビュー変換
    GLES.gluLookAt(GLES.mMatrix,
            0.0f,0.0f,0.0f, //カメラの視點
            0.0f,0.0f,-0.01f, //カメラの焦點
            0.0f,1.0f,0.0f);//カメラの上方向

    // ARのターゲット描畫
    targetObject.draw();
    // レーダー描畫
    raderObject.draw();

}
 
開發者ID:jphacks,項目名稱:TK_1701,代碼行數:32,代碼來源:MyRenderer.java

示例6: draw

import android.opengl.GLES20; //導入方法依賴的package包/類
/**
 * Renders the point cloud.
 *
 * @param pose the current point cloud pose, from {@link Frame#getPointCloudPose()}.
 * @param cameraView the camera view matrix for this frame, typically from
 *     {@link Frame#getViewMatrix(float[], int)}.
 * @param cameraPerspective the camera projection matrix for this frame, typically from
 *     {@link Session#getProjectionMatrix(float[], int, float, float)}.
 */
public void draw(Pose pose, float[] cameraView, float[] cameraPerspective) {
    float[] modelMatrix = new float[16];
    pose.toMatrix(modelMatrix, 0);

    float[] modelView = new float[16];
    float[] modelViewProjection = new float[16];
    Matrix.multiplyMM(modelView, 0, cameraView, 0, modelMatrix, 0);
    Matrix.multiplyMM(modelViewProjection, 0, cameraPerspective, 0, modelView, 0);

    ShaderUtil.checkGLError(TAG, "Before draw");

    GLES20.glUseProgram(mProgramName);
    GLES20.glEnableVertexAttribArray(mPositionAttribute);
    GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, mVbo);
    GLES20.glVertexAttribPointer(
        mPositionAttribute, 4, GLES20.GL_FLOAT, false, BYTES_PER_POINT, 0);
    GLES20.glUniform4f(mColorUniform, 31.0f / 255.0f, 188.0f / 255.0f, 210.0f / 255.0f, 1.0f);
    GLES20.glUniformMatrix4fv(mModelViewProjectionUniform, 1, false, modelViewProjection, 0);
    GLES20.glUniform1f(mPointSizeUniform, 5.0f);

    GLES20.glDrawArrays(GLES20.GL_POINTS, 0, mNumPoints);
    GLES20.glDisableVertexAttribArray(mPositionAttribute);
    GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, 0);

    ShaderUtil.checkGLError(TAG, "Draw");
}
 
開發者ID:googlevr,項目名稱:poly-sample-android,代碼行數:36,代碼來源:PointCloudRenderer.java

示例7: SetColorUniform

import android.opengl.GLES20; //導入方法依賴的package包/類
public static void SetColorUniform(int location, int color) {
    float r = Color.red(color) / 255.0f;
    float g = Color.green(color) / 255.0f;
    float b = Color.blue(color) / 255.0f;
    float a = Color.alpha(color) / 255.0f;

    GLES20.glUniform4f(location, r, g, b, a);
}
 
開發者ID:pooyafaroka,項目名稱:PlusGram,代碼行數:9,代碼來源:Shader.java

示例8: draw

import android.opengl.GLES20; //導入方法依賴的package包/類
/**
 * Renders the point cloud.
 *
 * @param pose              the current point cloud pose, from {@link Frame#getPointCloudPose()}.
 * @param cameraView        the camera view matrix for this frame, typically from
 *                          {@link Frame#getViewMatrix(float[], int)}.
 * @param cameraPerspective the camera projection matrix for this frame, typically from
 *                          {@link Session#getProjectionMatrix(float[], int, float, float)}.
 */
public void draw(Pose pose, float[] cameraView, float[] cameraPerspective) {
    float[] modelMatrix = new float[16];
    pose.toMatrix(modelMatrix, 0);

    float[] modelView = new float[16];
    float[] modelViewProjection = new float[16];
    Matrix.multiplyMM(modelView, 0, cameraView, 0, modelMatrix, 0);
    Matrix.multiplyMM(modelViewProjection, 0, cameraPerspective, 0, modelView, 0);

    ShaderUtil.checkGLError(TAG, "Before draw");

    GLES20.glUseProgram(mProgramName);
    GLES20.glEnableVertexAttribArray(mPositionAttribute);
    GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, mVbo);
    GLES20.glVertexAttribPointer(
            mPositionAttribute, 4, GLES20.GL_FLOAT, false, BYTES_PER_POINT, 0);
    GLES20.glUniform4f(mColorUniform, 31.0f / 255.0f, 188.0f / 255.0f, 210.0f / 255.0f, 1.0f);
    GLES20.glUniformMatrix4fv(mModelViewProjectionUniform, 1, false, modelViewProjection, 0);
    GLES20.glUniform1f(mPointSizeUniform, 5.0f);

    GLES20.glDrawArrays(GLES20.GL_POINTS, 0, mNumPoints);
    GLES20.glDisableVertexAttribArray(mPositionAttribute);
    GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, 0);

    ShaderUtil.checkGLError(TAG, "Draw");
}
 
開發者ID:nimbl3,項目名稱:nimbl3-arcore,代碼行數:36,代碼來源:PointCloudRenderer.java

示例9: value4f

import android.opengl.GLES20; //導入方法依賴的package包/類
public void value4f(float v1, float v2, float v3, float v4) {
	GLES20.glUniform4f(location, v1, v2, v3, v4);
}
 
開發者ID:G2159687,項目名稱:ESPD,代碼行數:4,代碼來源:Uniform.java

示例10: draw

import android.opengl.GLES20; //導入方法依賴的package包/類
@Override public void draw(ShaderProgram shaderProgram) {
    GraphShaderProgram graphShaderProgram = (GraphShaderProgram) shaderProgram;
    GLES20.glLineWidth(graphInfo.getLineWidth());
    GLES20.glUniform4f(graphShaderProgram.getColorLocation(), graphInfo.getRed(), graphInfo.getGreen(), graphInfo.getBlue(), 1.0f);
    GLES20.glDrawArrays(GLES20.GL_LINE_STRIP, 0, SENSOR_HISTORY_LENGTH);
}
 
開發者ID:khoatd92,項目名稱:sensor-graph-opengl-es-android,代碼行數:7,代碼來源:SensorGraph.java


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