本文整理匯總了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();
}
}
示例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();
}
示例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;
}
}
示例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);
}
示例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();
}
示例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");
}
示例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);
}
示例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");
}
示例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);
}
示例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);
}