本文整理汇总了Java中android.opengl.GLES30.glViewport方法的典型用法代码示例。如果您正苦于以下问题:Java GLES30.glViewport方法的具体用法?Java GLES30.glViewport怎么用?Java GLES30.glViewport使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.opengl.GLES30
的用法示例。
在下文中一共展示了GLES30.glViewport方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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 );
}
示例2: 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);
}
示例3: 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);
}
示例4: onSurfaceChanged
import android.opengl.GLES30; //导入方法依赖的package包/类
@Override
public void onSurfaceChanged(GL10 glUnused, int width, int height) {
mWidth = width;
mHeight = height;
// Set the viewport
GLES30.glViewport(0, 0, mWidth, mHeight);
float aspect = (float) width / height;
// this projection matrix is applied to object coordinates
//no idea why 53.13f, it was used in another example and it worked.
Matrix.perspectiveM(mProjectionMatrix, 0, 53.13f, aspect, Z_NEAR, Z_FAR);
}
示例5: onSurfaceChanged
import android.opengl.GLES30; //导入方法依赖的package包/类
public void onSurfaceChanged(GL10 glUnused, int width, int height) {
mWidth = width;
mHeight = height;
// Set the viewport
GLES30.glViewport(0, 0, mWidth, mHeight);
float aspect = (float) width / height;
// this projection matrix is applied to object coordinates
//no idea why 53.13f, it was used in another example and it worked.
Matrix.perspectiveM(mProjectionMatrix, 0, 53.13f, aspect, Z_NEAR, Z_FAR);
}
示例6: onSurfaceChanged
import android.opengl.GLES30; //导入方法依赖的package包/类
@Override
public void onSurfaceChanged(GL10 unused, int width, int height) {
// Adjust the viewport based on geometry changes,
// such as screen rotation
GLES30.glViewport(0, 0, width, height);
float ratio = (float) width / height;
// this projection matrix is applied to object coordinates
// in the onDrawFrame() method
Matrix.frustumM(mProjectionMatrix, 0, -ratio, ratio, -1, 1, 3, 7);
}
示例7: glViewport
import android.opengl.GLES30; //导入方法依赖的package包/类
@Override
public void glViewport(int x, int y, int width, int height)
{
GLES30.glViewport(x, y, width, height);
}