本文整理汇总了Java中javax.microedition.khronos.opengles.GL11类的典型用法代码示例。如果您正苦于以下问题:Java GL11类的具体用法?Java GL11怎么用?Java GL11使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GL11类属于javax.microedition.khronos.opengles包,在下文中一共展示了GL11类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: MatrixTrackingGL
import javax.microedition.khronos.opengles.GL11; //导入依赖的package包/类
public MatrixTrackingGL(GL gl) {
mgl = (GL10) gl;
if (gl instanceof GL10Ext) {
mgl10Ext = (GL10Ext) gl;
}
if (gl instanceof GL11) {
mgl11 = (GL11) gl;
}
if (gl instanceof GL11Ext) {
mgl11Ext = (GL11Ext) gl;
}
mModelView = new MatrixStack();
mProjection = new MatrixStack();
mTexture = new MatrixStack();
mCurrent = mModelView;
mMatrixMode = GL10.GL_MODELVIEW;
}
示例2: draw
import javax.microedition.khronos.opengles.GL11; //导入依赖的package包/类
public void draw(GL10 gl, float alpha) {
gl.glDisable(GL_TEXTURE_2D);
gl.glEnable(GL_BLEND);
gl.glEnableClientState(GL_VERTEX_ARRAY);
gl.glDisableClientState(GL_COLOR_ARRAY);
// Use mColorBuffer as a global alpha mask:
glTexEnvx(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL11.GL_COMBINE);
glTexEnvx(GL_TEXTURE_ENV, GL11.GL_COMBINE_RGB, GL11.GL_REPLACE);
glTexEnvx(GL_TEXTURE_ENV, GL11.GL_COMBINE_ALPHA, GL11.GL_MODULATE); // mix with alpha from glColor
// Alpha from glColor will be used thanks to GL_MODULATE mode
glColor4f(1f, 1f, 1f, 1f-alpha);
glBlendFunc(GL_ZERO, GL_ONE_MINUS_SRC_ALPHA);
gl.glVertexPointer(3, GL10.GL_FLOAT, 0, mFVertexBuffer);
glDrawElements(GL_TRIANGLE_STRIP, VERTS, GL_UNSIGNED_SHORT, mIndexBuffer);
}
示例3: releaseHardwareBuffers
import javax.microedition.khronos.opengles.GL11; //导入依赖的package包/类
/**
* Deletes the hardware buffers allocated by this object (if any).
*/
public void releaseHardwareBuffers(GL10 gl) {
if (mUseHardwareBuffers) {
if (gl instanceof GL11) {
GL11 gl11 = (GL11)gl;
int[] buffer = new int[1];
buffer[0] = mVertBufferIndex;
gl11.glDeleteBuffers(1, buffer, 0);
buffer[0] = mTextureCoordBufferIndex;
gl11.glDeleteBuffers(1, buffer, 0);
buffer[0] = mColorBufferIndex;
gl11.glDeleteBuffers(1, buffer, 0);
buffer[0] = mIndexBufferIndex;
gl11.glDeleteBuffers(1, buffer, 0);
}
invalidateHardwareBuffers();
}
}
示例4: beginDrawingStrips
import javax.microedition.khronos.opengles.GL11; //导入依赖的package包/类
public void beginDrawingStrips(GL10 gl, boolean useTexture) {
beginDrawing(gl, useTexture);
if (!mUseHardwareBuffers) {
gl.glVertexPointer(3, mCoordinateType, 0, mVertexBuffer);
if (useTexture) {
gl.glTexCoordPointer(2, mCoordinateType, 0, mTexCoordBuffer);
}
} else {
GL11 gl11 = (GL11)gl;
// draw using hardware buffers
gl11.glBindBuffer(GL11.GL_ARRAY_BUFFER, mVertBufferIndex);
gl11.glVertexPointer(3, mCoordinateType, 0, 0);
gl11.glBindBuffer(GL11.GL_ARRAY_BUFFER, mTextureCoordBufferIndex);
gl11.glTexCoordPointer(2, mCoordinateType, 0, 0);
gl11.glBindBuffer(GL11.GL_ELEMENT_ARRAY_BUFFER, mIndexBufferIndex);
}
}
示例5: releaseHardwareBuffers
import javax.microedition.khronos.opengles.GL11; //导入依赖的package包/类
/**
* Deletes the hardware buffers allocated by this object (if any).
*/
public void releaseHardwareBuffers(GL10 gl) {
if (mUseHardwareBuffers) {
if (gl instanceof GL11) {
GL11 gl11 = (GL11)gl;
int[] buffer = new int[1];
buffer[0] = mVertBufferIndex;
gl11.glDeleteBuffers(1, buffer, 0);
buffer[0] = mTextureCoordBufferIndex;
gl11.glDeleteBuffers(1, buffer, 0);
buffer[0] = mIndexBufferIndex;
gl11.glDeleteBuffers(1, buffer, 0);
}
invalidateHardwareBuffers();
}
}
示例6: MatrixTrackingGL
import javax.microedition.khronos.opengles.GL11; //导入依赖的package包/类
public MatrixTrackingGL(GL gl) {
mgl = (GL10) gl;
if (gl instanceof GL10Ext) {
mgl10Ext = (GL10Ext) gl;
}
if (gl instanceof GL11) {
mgl11 = (GL11) gl;
}
if (gl instanceof GL11Ext) {
mgl11Ext = (GL11Ext) gl;
}
mModelView = new MatrixStack();
mProjection = new MatrixStack();
mTexture = new MatrixStack();
mCurrent = mModelView;
mMatrixMode = GL10.GL_MODELVIEW;
}
示例7: uploadTextureAndReturnId
import javax.microedition.khronos.opengles.GL11; //导入依赖的package包/类
/**
* Used by TextureManager
*/
int uploadTextureAndReturnId(Bitmap $bitmap, boolean $generateMipMap) /*package-private*/
{
int glTextureId;
int[] a = new int[1];
_gl.glGenTextures(1, a, 0); // create a 'texture name' and put it in array element 0
glTextureId = a[0];
_gl.glBindTexture(GL10.GL_TEXTURE_2D, glTextureId);
if($generateMipMap && _gl instanceof GL11) {
_gl.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_GENERATE_MIPMAP, GL11.GL_TRUE);
} else {
_gl.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_GENERATE_MIPMAP, GL11.GL_FALSE);
}
// 'upload' to gpu
GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, $bitmap, 0);
return glTextureId;
}
示例8: GLWrapper
import javax.microedition.khronos.opengles.GL11; //导入依赖的package包/类
/**init methods*/
public GLWrapper(GL gl, GLSurfaceView glSurfaceView)
{
mGL = (GL10)gl;
if(gl instanceof GL10Ext)
{
mGL10Ext = (GL10Ext)gl;
}
if(gl instanceof GL11)
{
mGL11 = (GL11)gl;
}
if(gl instanceof GL11Ext)
{
mGL11Ext = (GL11Ext)gl;
}
if(gl instanceof GL11ExtensionPack)
{
mGL11ExtPack = (GL11ExtensionPack)gl;
}
mGLSurfaceView = glSurfaceView;
}
示例9: updateMatrixes
import javax.microedition.khronos.opengles.GL11; //导入依赖的package包/类
/**matrix methods*/
protected void updateMatrixes(GL10 gl)
{
if(PLOpenGLSupport.isHigherThanOpenGL1(gl))
{
GL11 gl11 = (GL11)gl;
gl11.glGetFloatv(GL11.GL_PROJECTION_MATRIX, mProjectionMatrix, 0);
gl11.glGetFloatv(GL11.GL_MODELVIEW_MATRIX, mModelMatrix, 0);
}
else
{
mMatrixGrabber.getCurrentProjection(gl);
mMatrixGrabber.getCurrentModelView(gl);
}
}
示例10: draw
import javax.microedition.khronos.opengles.GL11; //导入依赖的package包/类
public void draw(GL10 gl, float alpha) {
//Log.d(TAG, "draw " + " " + alpha);
if (mCoverTextureId==INVALID_TEXTURE_ID) {
// No texture, don't draw!
return;
}
glPushMatrix();
glFrontFace(GL_CCW);
glRotatef(mRotationAngle,0f,0f,1f);
// Alpha Blending
glEnable(GL_BLEND);
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
// Texture blending
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glEnable(GL_TEXTURE_2D);
if (alpha>=1f) {
alpha = 1f;
// Use color and alpha from the texture only
glTexEnvx(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL11.GL_COMBINE);
glTexEnvx(GL_TEXTURE_ENV, GL11.GL_COMBINE_RGB, GL11.GL_REPLACE); // color from texture only (not glColor)
glTexEnvx(GL_TEXTURE_ENV, GL11.GL_COMBINE_ALPHA, GL11.GL_REPLACE); // alpha from texture only (not glColor)
}
else {
// Use mColorBuffer as a global alpha mask:
glTexEnvx(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL11.GL_COMBINE);
glTexEnvx(GL_TEXTURE_ENV, GL11.GL_COMBINE_RGB, GL11.GL_REPLACE); // don't take color from glColor but from texture only
glTexEnvx(GL_TEXTURE_ENV, GL11.GL_COMBINE_ALPHA, GL11.GL_MODULATE); // mix with alpha from glColor
}
// Alpha from glColor will be used thanks to GL_MODULATE mode
glColor4f(0, 0, 0, alpha);
glVertexPointer(3, GL_FLOAT, 0, mFVertexBuffer);
glBindTexture(GL_TEXTURE_2D, mCoverTextureId);
glTexCoordPointer(2, GL_FLOAT, 0, mTexBuffer);
glDrawElements(GL_TRIANGLE_STRIP, VERTS, GL_UNSIGNED_SHORT, mIndexBuffer);
glPopMatrix();
}
示例11: drawFocus
import javax.microedition.khronos.opengles.GL11; //导入依赖的package包/类
public void drawFocus(GL10 gl) {
if (mCoverTextureId==INVALID_TEXTURE_ID) {
// No texture, don't draw!
return;
}
glPushMatrix();
glFrontFace(GL_CCW);
glRotatef(mRotationAngle,0f,0f,1f);
// Alpha Blending
glEnable(GL_BLEND);
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glDisableClientState(GL_COLOR_ARRAY); // be sure this has not been enabled by someone else in the scene
// Texture blending
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glEnable(GL_TEXTURE_2D);
// Use mColorBuffer as a global alpha mask:
glTexEnvx(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL11.GL_COMBINE);
glTexEnvx(GL_TEXTURE_ENV, GL11.GL_COMBINE_RGB, GL11.GL_ADD); // mix selection color and texture color
glTexEnvx(GL_TEXTURE_ENV, GL11.GL_COMBINE_ALPHA, GL11.GL_MODULATE); // mix with alpha from glColor
glColor4f(0f, 0.7f, 1f, 1f); // MAGICAL, selection color
glVertexPointer(3, GL_FLOAT, 0, mFVertexBuffer);
glBindTexture(GL_TEXTURE_2D, mCoverTextureId);
glTexCoordPointer(2, GL_FLOAT, 0, mTexBuffer);
glDrawElements(GL_TRIANGLE_STRIP, VERTS, GL_UNSIGNED_SHORT, mIndexBuffer);
glPopMatrix();
}
示例12: drawFocus
import javax.microedition.khronos.opengles.GL11; //导入依赖的package包/类
public void drawFocus(GL10 gl, float translation[]) {
//Log.d(TAG, "drawFocus " + " " + translation);
if (mTextureId == null) {
//Log.e(TAG, "No texture ID to draw Icon/label!");
return;
}
glRotatef(mRotationAngle,0f,0f,1f);
if (translation!=null) {
glTranslatef(translation[0], translation[1], translation[2]);
}
// Alpha Blending
glEnable(GL_BLEND);
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
// Texture blending
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glEnable(GL_TEXTURE_2D);
// Use mColorBuffer as a global alpha mask:
glTexEnvx(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL11.GL_COMBINE);
glTexEnvx(GL_TEXTURE_ENV, GL11.GL_COMBINE_RGB, GL11.GL_ADD); // mix selection color and texture color
glTexEnvx(GL_TEXTURE_ENV, GL11.GL_COMBINE_ALPHA, GL11.GL_MODULATE); // mix with alpha from glColor
glColor4f(0f, 0.7f, 1f, 1f); // MAGICAL, selection color
glVertexPointer(3, GL_FLOAT, 0, mFVertexBuffer);
glBindTexture(GL_TEXTURE_2D, mTextureId);
glTexCoordPointer(2, GL_FLOAT, 0, mTexBuffer);
glDrawElements(GL_TRIANGLE_STRIP, VERTS, GL_UNSIGNED_SHORT, mIndexBuffer);
}
示例13: prepare
import javax.microedition.khronos.opengles.GL11; //导入依赖的package包/类
public void prepare(GLCanvas canvas) {
GLId glId = canvas.getGLId();
mId = glId.generateTexture();
if (target == GLES20.GL_TEXTURE_2D) {
canvas.initializeTextureSize(this, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE);
}
canvas.setTextureParameters(this);
mState = STATE_LOADED;
setAssociatedCanvas(canvas);
}
示例14: draw
import javax.microedition.khronos.opengles.GL11; //导入依赖的package包/类
public void draw(GL10 gl, boolean useTexture, boolean useColor) {
if (!mUseHardwareBuffers) {
gl.glVertexPointer(3, mCoordinateType, 0, mVertexBuffer);
if (useTexture) {
gl.glTexCoordPointer(2, mCoordinateType, 0, mTexCoordBuffer);
}
if (useColor) {
gl.glColorPointer(4, mCoordinateType, 0, mColorBuffer);
}
gl.glDrawElements(GL10.GL_TRIANGLES, mIndexCount,
GL10.GL_UNSIGNED_SHORT, mIndexBuffer);
} else {
GL11 gl11 = (GL11)gl;
// draw using hardware buffers
gl11.glBindBuffer(GL11.GL_ARRAY_BUFFER, mVertBufferIndex);
gl11.glVertexPointer(3, mCoordinateType, 0, 0);
if (useTexture) {
gl11.glBindBuffer(GL11.GL_ARRAY_BUFFER, mTextureCoordBufferIndex);
gl11.glTexCoordPointer(2, mCoordinateType, 0, 0);
}
if (useColor) {
gl11.glBindBuffer(GL11.GL_ARRAY_BUFFER, mColorBufferIndex);
gl11.glColorPointer(4, mCoordinateType, 0, 0);
}
gl11.glBindBuffer(GL11.GL_ELEMENT_ARRAY_BUFFER, mIndexBufferIndex);
gl11.glDrawElements(GL11.GL_TRIANGLES, mIndexCount,
GL11.GL_UNSIGNED_SHORT, 0);
gl11.glBindBuffer(GL11.GL_ARRAY_BUFFER, 0);
gl11.glBindBuffer(GL11.GL_ELEMENT_ARRAY_BUFFER, 0);
}
}
示例15: draw
import javax.microedition.khronos.opengles.GL11; //导入依赖的package包/类
/**
* Draw a given label at a given x,y position, expressed in pixels, with the
* lower-left-hand-corner of the view being (0,0).
*
* @param gl
* @param x
* @param y
* @param labelID
*/
public void draw(GL10 gl, float x, float y, int labelID) {
checkState(STATE_DRAWING, STATE_DRAWING);
gl.glPushMatrix();
float snappedX = (float) Math.floor(x);
float snappedY = (float) Math.floor(y);
gl.glTranslatef(snappedX, snappedY, 0.0f);
Label label = mLabels.get(labelID);
gl.glEnable(GL10.GL_TEXTURE_2D);
((GL11)gl).glTexParameteriv(GL10.GL_TEXTURE_2D,
GL11Ext.GL_TEXTURE_CROP_RECT_OES, label.mCrop, 0);
((GL11Ext)gl).glDrawTexiOES((int) snappedX, (int) snappedY, 0,
(int) label.width, (int) label.height);
gl.glPopMatrix();
}