本文整理汇总了Java中android.opengl.GLES30类的典型用法代码示例。如果您正苦于以下问题:Java GLES30类的具体用法?Java GLES30怎么用?Java GLES30使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GLES30类属于android.opengl包,在下文中一共展示了GLES30类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: logVersionInfo
import android.opengl.GLES30; //导入依赖的package包/类
/**
* Writes GL version info to the log.
*/
public static void logVersionInfo() {
Log.i(TAG, "vendor : " + GLES20.glGetString(GLES20.GL_VENDOR));
Log.i(TAG, "renderer: " + GLES20.glGetString(GLES20.GL_RENDERER));
Log.i(TAG, "version : " + GLES20.glGetString(GLES20.GL_VERSION));
if (CHECK_GLES30) {
int[] values = new int[1];
GLES30.glGetIntegerv(GLES30.GL_MAJOR_VERSION, values, 0);
int majorVersion = values[0];
GLES30.glGetIntegerv(GLES30.GL_MINOR_VERSION, values, 0);
int minorVersion = values[0];
if (GLES30.glGetError() == GLES30.GL_NO_ERROR) {
Log.i(TAG, "iversion: " + majorVersion + "." + minorVersion);
}
}
}
示例2: logVersionInfo
import android.opengl.GLES30; //导入依赖的package包/类
/**
* Writes GL version info to the log.
*/
public static void logVersionInfo() {
Log.i(TAG, "vendor : " + GLES20.glGetString(GLES20.GL_VENDOR));
Log.i(TAG, "renderer: " + GLES20.glGetString(GLES20.GL_RENDERER));
Log.i(TAG, "version : " + GLES20.glGetString(GLES20.GL_VERSION));
if (false) {
int[] values = new int[1];
GLES30.glGetIntegerv(GLES30.GL_MAJOR_VERSION, values, 0);
int majorVersion = values[0];
GLES30.glGetIntegerv(GLES30.GL_MINOR_VERSION, values, 0);
int minorVersion = values[0];
if (GLES30.glGetError() == GLES30.GL_NO_ERROR) {
Log.i(TAG, "iversion: " + majorVersion + "." + minorVersion);
}
}
}
示例3: loadShader
import android.opengl.GLES30; //导入依赖的package包/类
public static int loadShader ( int type, String shaderSrc )
{
int shader;
int[] compiled = new int[1];
// Create the shader object
shader = GLES30.glCreateShader ( type );
if ( shader == 0 )
{
return 0;
}
// Load the shader source
GLES30.glShaderSource ( shader, shaderSrc );
// Compile the shader
GLES30.glCompileShader ( shader );
// Check the compile status
GLES30.glGetShaderiv ( shader, GLES30.GL_COMPILE_STATUS, compiled, 0 );
if ( compiled[0] == 0 )
{
Log.e ( "ESShader", GLES30.glGetShaderInfoLog ( shader ) );
GLES30.glDeleteShader ( shader );
return 0;
}
return shader;
}
示例4: onDrawFrame
import android.opengl.GLES30; //导入依赖的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 );
}
示例5: logVersionInfo
import android.opengl.GLES30; //导入依赖的package包/类
/**
* Writes GL version info to the log.
*/
@SuppressLint("InlinedApi")
public static void logVersionInfo() {
Log.i(TAG, "vendor : " + GLES20.glGetString(GLES20.GL_VENDOR));
Log.i(TAG, "renderer: " + GLES20.glGetString(GLES20.GL_RENDERER));
Log.i(TAG, "version : " + GLES20.glGetString(GLES20.GL_VERSION));
if (BuildCheck.isAndroid4_3()) {
final int[] values = new int[1];
GLES30.glGetIntegerv(GLES30.GL_MAJOR_VERSION, values, 0);
final int majorVersion = values[0];
GLES30.glGetIntegerv(GLES30.GL_MINOR_VERSION, values, 0);
final int minorVersion = values[0];
if (GLES30.glGetError() == GLES30.GL_NO_ERROR) {
Log.i(TAG, "version: " + majorVersion + "." + minorVersion);
}
}
}
示例6: logVersionInfo
import android.opengl.GLES30; //导入依赖的package包/类
/**
* Writes GL version info to the log.
*/
@SuppressLint("InlinedApi")
public static void logVersionInfo() {
Log.i(TAG, "vendor : " + GLES10.glGetString(GLES10.GL_VENDOR));
Log.i(TAG, "renderer: " + GLES10.glGetString(GLES10.GL_RENDERER));
Log.i(TAG, "version : " + GLES10.glGetString(GLES10.GL_VERSION));
if (BuildCheck.isAndroid4_3()) {
final int[] values = new int[1];
GLES30.glGetIntegerv(GLES30.GL_MAJOR_VERSION, values, 0);
final int majorVersion = values[0];
GLES30.glGetIntegerv(GLES30.GL_MINOR_VERSION, values, 0);
final int minorVersion = values[0];
if (GLES30.glGetError() == GLES30.GL_NO_ERROR) {
Log.i(TAG, "version: " + majorVersion + "." + minorVersion);
}
}
}
示例7: onDrawFrame
import android.opengl.GLES30; //导入依赖的package包/类
@Override
public void onDrawFrame(GL10 unused) {
// Set the view-port
GLES20.glViewport ( 0, 0,getWidth(),getHeight() );
// Clear the color buffer
GLES20.glClear ( GLES30.GL_COLOR_BUFFER_BIT );
if (mBackground != null)
mTextureLayer.draw();
glDepthMask(false);
glEnable(GL_BLEND);
//TODO particle system support BlendFuc
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
mParticleSystem.update(1f / 60f);
mParticleSystem.updateBuffer();
mParticleSystem.draw();
}
示例8: onDrawEye
import android.opengl.GLES30; //导入依赖的package包/类
/**
* Draws a frame for an eye.
*
* @param eye The eye to render. Includes all required transformations.
*/
@Override
public void onDrawEye(Eye eye) {
// Clear the color buffer set above by glClearColor.
GLES30.glClear(GLES30.GL_COLOR_BUFFER_BIT | GLES30.GL_DEPTH_BUFFER_BIT);
//need this otherwise, it will over right stuff and the cube will look wrong!
GLES30.glEnable(GLES30.GL_DEPTH_TEST);
// Apply the eye transformation to the camera.
Matrix.multiplyMM(view, 0, eye.getEyeView(), 0, camera, 0);
// combine the model with the view matrix to create the modelview matreix
Matrix.multiplyMM(modelview, 0, view, 0, mRotationMatrix, 0);
// combine the model-view with the projection matrix
float[] perspective = eye.getPerspective(Z_NEAR, Z_FAR);
Matrix.multiplyMM(mMVPMatrix, 0, perspective, 0, modelview, 0);
//finally draw the cube with the full Model-view-projection matrix.
mCube.draw(mMVPMatrix);
}
示例9: onSurfaceCreated
import android.opengl.GLES30; //导入依赖的package包/类
@Override
public void onSurfaceCreated(EGLConfig eglConfig) {
mRotationMatrix = new float[16];
camera = new float[16];
view = new float[16];
mMVPMatrix = new float[16];
modelview = new float[16];
headView = new float[16];
forward = new float[3];
GLES30.glClearColor(0.1f, 0.1f, 0.1f, 0.5f); // Dark background so text shows up well.
//initialize the cube code for drawing.
mCube = new Cube();
// Build the camera matrix
Matrix.setLookAtM(camera, 0, 0.0f, 0.0f, CAMERA_Z, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f);
// Object first appears directly in front of user.
Matrix.setIdentityM(mRotationMatrix, 0);
Matrix.translateM(mRotationMatrix, 0, 0, 0, -objectDistance);
}
示例10: onSurfaceCreated
import android.opengl.GLES30; //导入依赖的package包/类
@Override
public void onSurfaceCreated(EGLConfig eglConfig) {
mRotationMatrix = new float[16];
camera = new float[16];
view = new float[16];
mMVPMatrix = new float[16];
modelview = new float[16];
headView = new float[16];
GLES30.glClearColor(0.1f, 0.1f, 0.1f, 0.5f); // Dark background so text shows up well.
//initialize the cube code for drawing.
mCube = new Cube();
// Object first appears directly in front of user.
Matrix.setIdentityM(mRotationMatrix, 0);
Matrix.translateM(mRotationMatrix, 0, 0, 0, -objectDistance);
}
示例11: onDrawFrame
import android.opengl.GLES30; //导入依赖的package包/类
public void onDrawFrame(GL10 glUnused) {
// Set the viewport
GLES30.glViewport(0, 0, mWidth, mHeight);
// Clear the color buffer, which was set above in glClearColor
GLES30.glClear(GLES30.GL_COLOR_BUFFER_BIT);
// Use the program object
GLES30.glUseProgram(mProgramObject);
// Load the vertex data
GLES30.glVertexAttribPointer(0, 3, GLES30.GL_FLOAT, false, 0, mVertices);
//set the starting vertex at 0.
GLES30.glEnableVertexAttribArray(0);
//actually draw the traingle here
GLES30.glDrawArrays(GLES30.GL_TRIANGLES, 0, 3);
}
示例12: getSupportedMaxPictureSize
import android.opengl.GLES30; //导入依赖的package包/类
public static int getSupportedMaxPictureSize() {
int[] array = new int[1];
GLES10.glGetIntegerv(GLES10.GL_MAX_TEXTURE_SIZE, array, 0);
if (array[0] == 0) {
GLES11.glGetIntegerv(GLES11.GL_MAX_TEXTURE_SIZE, array, 0);
if (array[0] == 0) {
GLES20.glGetIntegerv(GLES20.GL_MAX_TEXTURE_SIZE, array, 0);
if (array[0] == 0) {
GLES30.glGetIntegerv(GLES30.GL_MAX_TEXTURE_SIZE, array, 0);
}
}
}
return array[0] != 0 ? array[0] : 2048;
}
示例13: onSurfaceChanged
import android.opengl.GLES30; //导入依赖的package包/类
@Override
public void onSurfaceChanged(GL10 glUnused, int width, int height)
{
// Set the OpenGL viewport to the same size as the surface.
GLES30.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);
}
示例14: onSurfaceCreated
import android.opengl.GLES30; //导入依赖的package包/类
@Override
public void onSurfaceCreated(GL10 unused, EGLConfig config) {
// Set the background frame color
GLES30.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
mTriangle = new Triangle();
mSquare = new Square();
}
示例15: onSurfaceCreated
import android.opengl.GLES30; //导入依赖的package包/类
public void onSurfaceCreated ( GL10 glUnused, EGLConfig config )
{
String vShaderStr =
"#version 300 es \n" +
"layout(location = 0) in vec4 a_color; \n" +
"layout(location = 1) in vec4 a_position; \n" +
"out vec4 v_color; \n" +
"void main() \n" +
"{ \n" +
" v_color = a_color; \n" +
" gl_Position = a_position; \n" +
"}";
String fShaderStr =
"#version 300 es \n" +
"precision mediump float; \n" +
"in vec4 v_color; \n" +
"out vec4 o_fragColor; \n" +
"void main() \n" +
"{ \n" +
" o_fragColor = v_color; \n" +
"}" ;
// Load the shaders and get a linked program object
mProgramObject = ESShader.loadProgram ( vShaderStr, fShaderStr );
GLES30.glClearColor ( 1.0f, 1.0f, 1.0f, 0.0f );
}