当前位置: 首页>>代码示例>>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;未经允许,请勿转载。