本文整理汇总了Java中javax.microedition.khronos.opengles.GL10.glClearColor方法的典型用法代码示例。如果您正苦于以下问题:Java GL10.glClearColor方法的具体用法?Java GL10.glClearColor怎么用?Java GL10.glClearColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.microedition.khronos.opengles.GL10
的用法示例。
在下文中一共展示了GL10.glClearColor方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onSurfaceCreated
import javax.microedition.khronos.opengles.GL10; //导入方法依赖的package包/类
@Override
public void onSurfaceCreated(GL10 gl, EGLConfig eglConfig) {
mRenderListener.onSurfaceCreated(gl);
mEngine.getTextureLibrary().LoadTextures(gl);
gl.glClearColor(0.0f, 0.0f, 0.0f, 0.5f);
// Enable Smooth Shading, default not really needed.
gl.glShadeModel(GL10.GL_SMOOTH);
// Depth buffer setup.
gl.glClearDepthf(1.0f);
// Enables depth testing.
gl.glEnable(GL10.GL_DEPTH_TEST);
// The type of depth testing to do.
gl.glDepthFunc(GL10.GL_LEQUAL); // Really nice perspective calculations.
gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, GL10.GL_NICEST);
gl.glEnable(GL10.GL_ALPHA_TEST);
gl.glAlphaFunc(GL10.GL_GREATER, 0.1f);
}
示例2: onDrawFrame
import javax.microedition.khronos.opengles.GL10; //导入方法依赖的package包/类
@Override
public void onDrawFrame(GL10 gl) {
gl.glClearColor(1.f, 0.f, 0.f, 1.f);
gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
gl.glLoadIdentity();
gl.glTranslatef(0.f, 0.f, -50.f);
long time = SystemClock.uptimeMillis() % 4000L;
float angle = 0.090f * ((int) time);
gl.glRotatef(angle, 0.f, 0.f, 1.f);
gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
gl.glColor4f(1.f, 1.f, 1.f, 1.f);
gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertexBuffer);
gl.glDrawElements(GL10.GL_TRIANGLES, indices.length, GL10.GL_UNSIGNED_SHORT, indexBuffer);
gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
}
示例3: onDrawFrame
import javax.microedition.khronos.opengles.GL10; //导入方法依赖的package包/类
@Override
public synchronized void onDrawFrame(GL10 gl) {
mObserver.onDrawFrame();
gl.glClearColor(Color.red(mBackgroundColor) / 255f,
Color.green(mBackgroundColor) / 255f,
Color.blue(mBackgroundColor) / 255f,
Color.alpha(mBackgroundColor) / 255f);
gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
gl.glLoadIdentity();
if (USE_PERSPECTIVE_PROJECTION) {
gl.glTranslatef(0, 0, -6f);
}
for (int i = 0; i < mCurlMeshes.size(); ++i) {
mCurlMeshes.get(i).onDrawFrame(gl);
}
}
示例4: draw
import javax.microedition.khronos.opengles.GL10; //导入方法依赖的package包/类
@Override
public void draw(GL10 gl) {
gl.glClearColor(1.0f,1.0f,1.0f,1.0f);
if(shouldLoadTexture){
loadTexture(gl);
shouldLoadTexture = false;
}
if(mTextureId != -1 && mVertexBuffer != null){
gl.glEnable(GL10.GL_TEXTURE_2D);
gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
gl.glTexCoordPointer(2,GL10.GL_FLOAT,0,mVertexBuffer);
gl.glBindTexture(GL10.GL_TEXTURE_2D,mTextureId);
}
// gl.glRotatef(180.0f,1,0,0);
gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
gl.glVertexPointer(2,GL10.GL_FLOAT,0,mVertexBuffer);
gl.glDrawElements(GL10.GL_TRIANGLES, indices.length,
GL10.GL_UNSIGNED_SHORT, mIndexBuffer);
// gl.glDrawArrays(GL10.GL_TRIANGLES,0,4);
gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
if(mTextureId != -1 && mVertexBuffer != null){
gl.glDisableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
gl.glDisable(GL10.GL_TEXTURE_2D);
}
}
示例5: onSurfaceCreated
import javax.microedition.khronos.opengles.GL10; //导入方法依赖的package包/类
@Override public void onSurfaceCreated(GL10 gl, EGLConfig config) {
gl.glClearColor(0.0f, 0.0f, 0.0f, 1);
gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, GL10.GL_FASTEST);
gl.glShadeModel(GL10.GL_FLAT);
gl.glDisable(GL10.GL_DEPTH_TEST);
// Alpha support.
gl.glEnable(GL10.GL_BLEND);
gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);
gl.glMatrixMode(GL10.GL_PROJECTION);
gl.glLoadIdentity();
GLU.gluOrtho2D(gl, 0, getWidth(), getHeight(), 0);
}
示例6: onSurfaceCreated
import javax.microedition.khronos.opengles.GL10; //导入方法依赖的package包/类
@Override
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
// Set the background frame color
gl.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
mTriangle = new Triangle();
mSquare = new Square();
}
示例7: onSurfaceCreated
import javax.microedition.khronos.opengles.GL10; //导入方法依赖的package包/类
@Override
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
gl.glClearColor(0f, 0f, 0f, 1f);
gl.glShadeModel(GL10.GL_SMOOTH);
gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, GL10.GL_NICEST);
gl.glHint(GL10.GL_LINE_SMOOTH_HINT, GL10.GL_NICEST);
gl.glHint(GL10.GL_POLYGON_SMOOTH_HINT, GL10.GL_NICEST);
gl.glEnable(GL10.GL_LINE_SMOOTH);
gl.glDisable(GL10.GL_DEPTH_TEST);
gl.glDisable(GL10.GL_CULL_FACE);
mObserver.onSurfaceCreated();
}
示例8: onSurfaceCreated
import javax.microedition.khronos.opengles.GL10; //导入方法依赖的package包/类
@Override
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
// dither is enabled by default, we don't need it
gl.glDisable(GL10.GL_DITHER);
// clear screen in black
gl.glClearColor(0, 0, 0, 1);
}
示例9: onSurfaceCreated
import javax.microedition.khronos.opengles.GL10; //导入方法依赖的package包/类
@Override
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
gl.glClearColor(0f, 0f, 0f, 0f);
gl.glShadeModel(GL10.GL_SMOOTH);
gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, GL10.GL_NICEST);
gl.glHint(GL10.GL_LINE_SMOOTH_HINT, GL10.GL_NICEST);
gl.glHint(GL10.GL_POLYGON_SMOOTH_HINT, GL10.GL_NICEST);
// gl.glEnable(GL10.GL_LINE_SMOOTH);
gl.glDisable(GL10.GL_DEPTH_TEST);
gl.glDisable(GL10.GL_CULL_FACE);
gl.glDisable(GL10.GL_DITHER);
}
示例10: onSurfaceCreated
import javax.microedition.khronos.opengles.GL10; //导入方法依赖的package包/类
@Override
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
gl.glGenTextures(NUMBER_OF_TEXTURES, mtextureMgr.mtextures, 0);
gl.glShadeModel(GL10.GL_SMOOTH); //Enable Smooth Shading
gl.glClearColor(0.0f, 0.0f, 0.0f, 0.5f); //Black Background
gl.glClearDepthf(1.0f); //Depth Buffer Setup
gl.glEnable(GL10.GL_DEPTH_TEST); //Enables Depth Testing
gl.glDepthFunc(GL10.GL_LEQUAL); //The Type Of Depth Testing To Do
//Really Nice Perspective Calculations
gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, GL10.GL_NICEST);
}
示例11: onSurfaceCreated
import javax.microedition.khronos.opengles.GL10; //导入方法依赖的package包/类
@Override
public void onSurfaceCreated(GL10 gl10) {
gl10.glClearColor(0.0f, 0.0f, 0.0f, 0.5f);
}
示例12: onSurfaceCreated
import javax.microedition.khronos.opengles.GL10; //导入方法依赖的package包/类
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
/*
* By default, OpenGL enables features that improve quality
* but reduce performance. One might want to tweak that
* especially on software renderer.
*/
gl.glDisable(GL10.GL_DITHER);
/*
* Some one-time OpenGL initialization can be made here
* probably based on features of this particular context
*/
gl.glClearColor(1,1,1,1);
gl.glEnable(GL10.GL_CULL_FACE);
gl.glShadeModel(GL10.GL_SMOOTH);
gl.glEnable(GL10.GL_DEPTH_TEST);
/*
* create / load the our 3D models here
*/
gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
gl.glEnableClientState(GL10.GL_COLOR_ARRAY);
float vertices[] = {
0,0,0,
1,0,0,
0,1,0,
0,0,1
};
float colors[] = {
0,0,0,0,
1,0,0,1,
0,1,0,1,
0,0,1,1
};
byte indices[] = { 0, 1, 0, 2, 0, 3 };
// Buffers to be passed to gl*Pointer() functions
// must be direct, i.e., they must be placed on the
// native heap where the garbage collector cannot
// move them.
//
// Buffers with multi-byte datatypes (e.g., short, int, float)
// must have their byte order set to native order
ByteBuffer vbb;
vbb = ByteBuffer.allocateDirect(vertices.length*4);
vbb.order(ByteOrder.nativeOrder());
mVertexBuffer = vbb.asFloatBuffer();
mVertexBuffer.put(vertices);
mVertexBuffer.position(0);
vbb = ByteBuffer.allocateDirect(colors.length*4);
vbb.order(ByteOrder.nativeOrder());
mColorBuffer = vbb.asFloatBuffer();
mColorBuffer.put(colors);
mColorBuffer.position(0);
mIndexBuffer = ByteBuffer.allocateDirect(indices.length);
mIndexBuffer.put(indices);
mIndexBuffer.position(0);
}
示例13: onDrawFrame
import javax.microedition.khronos.opengles.GL10; //导入方法依赖的package包/类
@Override
public synchronized void onDrawFrame(GL10 gl) {
if (CreatePNG) {
saveBmp(gl);
CreatePNG = false;
}
mObserver.onDrawFrame();
// glClearColor miad rangi ke maa entekhaab kardim ro tooye carde
// Graphic register mikone
gl.glClearColor(Color.red(mBackgroundColor) / 255f,
Color.green(mBackgroundColor) / 255f,
Color.blue(mBackgroundColor) / 255f,
Color.alpha(mBackgroundColor) / 255f);
// glClear miad oon rangi ke bala register karde boodim ro dige az
// buffer paak mikone
gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
// miad matris ro be MabdaEsh barmigardoone, ke bAd baraye glRotate va
// glTranslate moshkeli ijaad nashe
// chon maa asle jaabejaa kardan hamoon baraye safhe, baste be makaane
// avalieye
// kaaghazemoon hast, na oon makani ke dar haale hazer gharaar dare
gl.glLoadIdentity();
if (capture) {
// Log.e("Capturing..", "Capturing..");
if (BeforeStart) {
// Log.e("BeforeStartCalled", "BeforeStartCalled");
frameBuffer.BeforeStart(gl);
BeforeStart = false;
}
if (AttachTexture) {
// Log.e("SETUP", "SETUP Ran");
int h = gl.glGetError();
frameBuffer.setup(gl);
if (h != 0) {
// Log.d("ERROR", "ERROR Happend" + h + "");
}
AttachTexture = false;
}
frameBuffer.RenderStart(gl);
if (USE_PERSPECTIVE_PROJECTION) {
double x = mCurlMesh.GetMinX() * mCurlMesh.GetMinY();
gl.glTranslatef((float) (-1.000 - mCurlMesh.GetMinX()),
(float) (-1.000 - mCurlMesh.GetMinY()), -6f);
}
gl.glMatrixMode(GL10.GL_PROJECTION);
gl.glLoadIdentity();
GLU.gluOrtho2D(gl, (float) mCurlMesh.GetMinX(),
(float) mCurlMesh.GetMaxX(), (float) mCurlMesh.GetMinY(),
(float) mCurlMesh.GetMaxY());
gl.glMatrixMode(GL10.GL_MODELVIEW);
gl.glLoadIdentity();
gl.glViewport(0, 0, texW, texH);
mCurlMesh.onDrawFrame(gl, false);
frameBuffer.RenderEnd(gl);
}
// Reset Every Thing to Its Normal State
gl.glMatrixMode(GL10.GL_PROJECTION);
gl.glLoadIdentity();
GLU.gluOrtho2D(gl, -1.2f, 1.2f, -1.2f, 1.2f);
gl.glMatrixMode(GL10.GL_MODELVIEW);
gl.glLoadIdentity();
gl.glViewport(0, 0, mViewportWidth, mViewportHeight);
mCurlMesh.onDrawFrame(gl, true);
// Log.e("Rendered", "Rendered");
if (DelPrevious) {
// Log.e("DeleTing", "Deleting Texture = " +DelTextureId[0]);
gl.glDeleteTextures(1, DelTextureId, 0);
DelPrevious = false;
Counter++;
}
DoneRender = true;
}