当前位置: 首页>>代码示例>>Java>>正文


Java GLES30.glViewport方法代码示例

本文整理汇总了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 );
}
 
开发者ID:zhuangzaiku,项目名称:AndroidCollection,代码行数:27,代码来源:Example6_3Renderer.java

示例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);
}
 
开发者ID:JimSeker,项目名称:opengl,代码行数:19,代码来源:LessonOneRenderer.java

示例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);
}
 
开发者ID:JimSeker,项目名称:opengl,代码行数:19,代码来源:HelloTriangleRenderer.java

示例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);
}
 
开发者ID:JimSeker,项目名称:opengl,代码行数:13,代码来源:myRenderer.java

示例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);
}
 
开发者ID:JimSeker,项目名称:opengl,代码行数:12,代码来源:myRenderer.java

示例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);

}
 
开发者ID:JimSeker,项目名称:opengl,代码行数:14,代码来源:MyGLRenderer.java

示例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);
}
 
开发者ID:sriharshachilakapati,项目名称:SilenceEngine,代码行数:6,代码来源:AndroidGraphicsDevice.java


注:本文中的android.opengl.GLES30.glViewport方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。