本文整理汇总了Java中javax.microedition.khronos.opengles.GL10.glViewport方法的典型用法代码示例。如果您正苦于以下问题:Java GL10.glViewport方法的具体用法?Java GL10.glViewport怎么用?Java GL10.glViewport使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.microedition.khronos.opengles.GL10
的用法示例。
在下文中一共展示了GL10.glViewport方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onSurfaceChanged
import javax.microedition.khronos.opengles.GL10; //导入方法依赖的package包/类
@Override
public void onSurfaceChanged(GL10 gl, int width, int height) {
mRenderListener.onSurfaceChanged(gl, width, height);
mEngine.setUpScene();
if (mEngine.isCameraActive() && mEngine.getCamera() != null)
mEngine.getCamera().update(width, height);
// Sets the current view port to the new size.
gl.glViewport(0, 0, width, height);
// Select the projection matrix
gl.glMatrixMode(GL10.GL_PROJECTION);
// Reset the projection matrix
gl.glLoadIdentity();
// Select the modelview matrix
gl.glMatrixMode(GL10.GL_MODELVIEW);
// Reset the modelview matrix
gl.glOrthof(0, width, height, 0, 0, 1f);
}
示例2: onSurfaceChanged
import javax.microedition.khronos.opengles.GL10; //导入方法依赖的package包/类
public void onSurfaceChanged(GL10 gl, int w, int h) {
try {
VideoViewH264m3u8.this.mSurfaceHeight = h;
VideoViewH264m3u8.this.mSurfaceWidth = w;
LogTag.i("MyRenderer:onSurfaceChanged(), w=" + w + ", h=" + h + ", lastW=" + this.lastW + ", lastH=" + this.lastH);
if (VideoViewH264m3u8.this.mMediaPlayer != null && VideoViewH264m3u8.this.mCurrentState >= 2) {
if (this.lastW != w || this.lastH != h) {
gl.glViewport(0, 0, w, h);
VideoViewH264m3u8.this.mMediaPlayer.native_gl_resize(w, h);
this.lastW = w;
this.lastH = h;
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
示例3: onSurfaceChanged
import javax.microedition.khronos.opengles.GL10; //导入方法依赖的package包/类
public void onSurfaceChanged(GL10 gl, int w, int h) {
try {
VideoViewH264m3u8_4D.this.mSurfaceHeight = h;
VideoViewH264m3u8_4D.this.mSurfaceWidth = w;
LogTag.i("MyRenderer:onSurfaceChanged(), w=" + w + ", h=" + h + ", lastW=" + this.lastW + ", lastH=" + this.lastH);
if (VideoViewH264m3u8_4D.this.mMediaPlayer == null) {
return;
}
if (this.lastW != w || this.lastH != h) {
gl.glViewport(0, 0, w, h);
VideoViewH264m3u8_4D.this.mMediaPlayer.native_gl_resize(w, h);
this.lastW = w;
this.lastH = h;
}
} catch (Exception e) {
e.printStackTrace();
}
}
示例4: onSurfaceChanged
import javax.microedition.khronos.opengles.GL10; //导入方法依赖的package包/类
@Override
public void onSurfaceChanged(GL10 gl, int width, int height) {
gl.glViewport(0, 0, width, height);
mViewportWidth = width;
mViewportHeight = height;
float ratio = (float) width / height;
mViewRect.top = 1.0f;
mViewRect.bottom = -1.0f;
mViewRect.left = -ratio;
mViewRect.right = ratio;
updatePageRects();
gl.glMatrixMode(GL10.GL_PROJECTION);
gl.glLoadIdentity();
if (USE_PERSPECTIVE_PROJECTION) {
GLU.gluPerspective(gl, 20f, (float) width / height, .1f, 100f);
} else {
GLU.gluOrtho2D(gl, mViewRect.left, mViewRect.right,
mViewRect.bottom, mViewRect.top);
}
gl.glMatrixMode(GL10.GL_MODELVIEW);
gl.glLoadIdentity();
}
示例5: onSurfaceChanged
import javax.microedition.khronos.opengles.GL10; //导入方法依赖的package包/类
@Override
public void onSurfaceChanged(GL10 gl, int width, int height) {
if (height == 0) height = 1;
float aspect = (float) width / height;
gl.glViewport(0, 0, width, height);
gl.glMatrixMode(GL10.GL_PROJECTION);
gl.glLoadIdentity();
gl.glOrthof(-10.f, 10.f, 10.f / aspect, -10.f / aspect, 0.1f, 100.f);
gl.glMatrixMode(GL10.GL_MODELVIEW);
gl.glLoadIdentity();
}
示例6: onSurfaceChanged
import javax.microedition.khronos.opengles.GL10; //导入方法依赖的package包/类
public void onSurfaceChanged(GL10 gl, int width, int height) {
gl.glViewport(0, 0, width, height);
/*
* Set our projection matrix. This doesn't have to be done
* each time we draw, but usually a new projection needs to
* be set when the viewport is resized.
*/
float ratio = (float) width / height;
gl.glMatrixMode(GL10.GL_PROJECTION);
gl.glLoadIdentity();
gl.glFrustumf(-ratio, ratio, -1, 1, 1, 10);
}
示例7: onSurfaceChanged
import javax.microedition.khronos.opengles.GL10; //导入方法依赖的package包/类
@Override
public void onSurfaceChanged(GL10 gl, int width, int height) {
// Adjust the viewport based on geometry changes
// such as screen rotations
gl.glViewport(0, 0, width, height);
// make adjustments for screen ratio
float ratio = (float) width / height;
gl.glMatrixMode(GL10.GL_PROJECTION); // set matrix to projection mode
gl.glLoadIdentity(); // reset the matrix to its default state
gl.glFrustumf(-ratio, ratio, -1, 1, 3, 7); // apply the projection matrix
}
示例8: onSurfaceChanged
import javax.microedition.khronos.opengles.GL10; //导入方法依赖的package包/类
@Override public void onSurfaceChanged(GL10 gl, int width, int height) {
mSurfaceWidth = width;
mSurfaceHeight = height;
if (gl != null) {
gl.glViewport(0, 0, width, height);
}
mCameraHandler.sendMessage(
mCameraHandler.obtainMessage(CameraSurfaceView.CameraHandler.SETUP_CAMERA, width,
height, mSurfaceTexture));
}
示例9: onSurfaceChanged
import javax.microedition.khronos.opengles.GL10; //导入方法依赖的package包/类
@Override public void onSurfaceChanged(GL10 gl, int width, int height) {
mSurfaceWidth = width;
mSurfaceHeight = height;
if (gl != null) {
gl.glViewport(0, 0, width, height);
}
mCameraHandler.sendMessage(
mCameraHandler.obtainMessage(CameraSurfaceView.CameraHandler.SETUP_CAMERA, width,
height, mSurfaceTexture));
}
示例10: onSurfaceChanged
import javax.microedition.khronos.opengles.GL10; //导入方法依赖的package包/类
@Override
public void onSurfaceChanged(GL10 gl, int width, int height) {
mSurfaceWidth = width;
mSurfaceHeight = height;
if (gl != null) {
gl.glViewport(0, 0, width, height);
}
}
示例11: onSurfaceChanged
import javax.microedition.khronos.opengles.GL10; //导入方法依赖的package包/类
/**
* Update view-port with the new surface
*
* @param gl the surface
* @param width new width
* @param height new height
*/
public void onSurfaceChanged(GL10 gl, int width, int height) {
// set view-port
gl.glViewport(0, 0, width, height);
// set projection matrix
float ratio = (float) width / height;
gl.glMatrixMode(GL10.GL_PROJECTION);
gl.glLoadIdentity();
gl.glFrustumf(-ratio, ratio, -1, 1, 1, 10);
}
示例12: onSurfaceChanged
import javax.microedition.khronos.opengles.GL10; //导入方法依赖的package包/类
@Override
public void onSurfaceChanged(GL10 gl, int width, int height) {
gl.glViewport(0, 0, height, height);
mViewportWidth = height;
mViewportHeight = height;
Log.d("MviewPorTWidth", "" + mViewportWidth);
/**
* @ TODO inja mViewRect Mige man che baazeE az OpenGL ro mitoonam
* bebinam, alan ino gozashtam 1.1 hamasho, chon mikham kami bozorgtar
* az kaaghaz bashe view ye page, yekam fazaaye khaali dashte bashe
*/
if (first) {
mViewRect.top = 1.2f;
mViewRect.bottom = -1.2f;
// -ratio
mViewRect.left = -1.2f;
mViewRect.right = 1.2f;
updatePageRects();
gl.glMatrixMode(GL10.GL_PROJECTION);
gl.glLoadIdentity();
if (USE_PERSPECTIVE_PROJECTION) {
GLU.gluPerspective(gl, 20f, (float) width / height, .1f, 100f);
} else {
GLU.gluOrtho2D(gl, mViewRect.left, mViewRect.right,
mViewRect.bottom, mViewRect.top);
}
first = false;
}
gl.glMatrixMode(GL10.GL_MODELVIEW);
gl.glLoadIdentity();
}
示例13: onSurfaceChanged
import javax.microedition.khronos.opengles.GL10; //导入方法依赖的package包/类
@Override
public void onSurfaceChanged(GL10 gl, int width, int height) {
Log.d("OGLChart", "onSurfaceChanged : start, chart title is " + this.mstrChartTitle);
if(height == 0) { //Prevent A Divide By Zero By
height = 1; //Making Height Equal One
}
mdChartWindowHeight = height;
mdChartWindowWidth = width;
gl.glViewport(0, 0, width, height); //Reset The Current Viewport
gl.glMatrixMode(GL10.GL_PROJECTION); //Select The Projection Matrix
gl.glLoadIdentity(); //Reset The Projection Matrix
//Calculate The Aspect Ratio Of The Window, tan(28.0725/2) = 0.25
//GLU.gluPerspective(gl, PROJECT_Y_OVERALL_ANGLE, (float)width / (float)height, PROJECT_Z_NEAR - 1, PROJECT_Z_FAR + 1);
GLU.gluPerspective(gl, PROJECT_Y_OVERALL_ANGLE, (float)width / (float)height, PROJECT_Z_NEAR, PROJECT_Z_FAR);
double dFarXLength = PROJECT_Z_FAR * Math.tan(PROJECT_Y_OVERALL_ANGLE * Math.PI / 360) * 2
* width / height;
double dFarYLength = PROJECT_Z_FAR * Math.tan(PROJECT_Y_OVERALL_ANGLE * Math.PI / 360) * 2;
mp3OriginInTO = new Position3D(0, 0, (-PROJECT_Z_NEAR - PROJECT_Z_FAR)/2.0);
double dFarMinFarXYLen = Math.min(dFarXLength, dFarYLength);
mdXAxisLenInTO = dFarMinFarXYLen * 3/4; //* 5 / 9;
mdYAxisLenInTO = dFarMinFarXYLen * 3/4; //* 5 / 9;;
mdZAxisLenInTO = dFarMinFarXYLen * 3/4; //* 5 / 9;;
setMapperFROM2TO();
update();
Log.d("OGLChart", "onSurfaceChanged : end");
}
示例14: onSurfaceChanged
import javax.microedition.khronos.opengles.GL10; //导入方法依赖的package包/类
@Override public void onSurfaceChanged(GL10 gl, int width, int height) {
gl.glViewport(0, 0, width, height);
}
示例15: onSurfaceChanged
import javax.microedition.khronos.opengles.GL10; //导入方法依赖的package包/类
public void onSurfaceChanged(GL10 gl, int width, int height ) {
// This is called whenever the dimensions of the surface have changed.
// We need to adapt this change for the GL viewport.
gl.glViewport( 0, 0, width, height );
}