List of usage examples for com.badlogic.gdx.graphics GL10 GL_TRIANGLES
int GL_TRIANGLES
To view the source code for com.badlogic.gdx.graphics GL10 GL_TRIANGLES.
Click Source Link
From source file:com.badlogic.gdx.graphics.g3d.test.MD2Viewer.java
@Override public void render() { Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT); Gdx.gl.glEnable(GL10.GL_DEPTH_TEST); cam.update();// w w w .j a v a 2s. c o m cam.apply(Gdx.gl10); angle += 45 * Gdx.graphics.getDeltaTime(); Gdx.gl10.glRotatef(angle, 0, 1, 0); Gdx.gl.glEnable(GL10.GL_TEXTURE_2D); texture.bind(); model.subMeshes[0].mesh.setVertices(model.subMeshes[0].animations.get("all").keyframes[0].vertices); model.subMeshes[0].mesh.render(GL10.GL_TRIANGLES); }
From source file:com.badlogic.gdx.physics.bullet.demo.screens.DemoScreen.java
public void dropThing(boolean type) { if (!isPaused()) { float x = (random.nextFloat() * 10f) - 5f; float y = (random.nextFloat() * 10f) - 5f; float z = 20; final btTransform transform = Pools.btTRANSFORM.obtain(); final Vector3 vector = Pools.VECTOR3.obtain(); final Matrix3 basis = Pools.MATRIX3.obtain(); transform.setIdentity();/*from w w w. ja v a 2 s. co m*/ transform.setOrigin(vector.set(x, y, z)); MeshSimulationObject object; if (type) { // Don't autodispose the mesh and texture object = new MeshSimulationObject(cubeMesh, GL10.GL_TRIANGLES, false, cubeTexture, false); object.initialize(new btBoxShape(vector.set(1, 1, 1)), 50, -1, transform); } else { // Don't autodispose the mesh and texture object = new MeshSimulationObject(icosphereMesh, GL10.GL_TRIANGLES, false, icosphereTexture, false); object.initialize(new btSphereShape(1), 50, -1, transform); } addCollisionSimulationObject(object); Pools.btTRANSFORM.free(transform); Pools.VECTOR3.free(vector); Pools.MATRIX3.free(basis); } }
From source file:com.badlogic.gdx.physics.bullet.demo.screens.DemoScreen.java
@Override protected void hookAddSimulationObjects() { final btTransform transform = Pools.btTRANSFORM.obtain(); final Vector3 vector = Pools.VECTOR3.obtain(); // Terrain//from w ww. j ava2s. c o m transform.setIdentity(); vector.set(0, 0, 0); transform.setOrigin(vector); terrain = new MeshSimulationObject(terrainMesh, GL10.GL_TRIANGLES, false, terrainTexture, false); terrain.initialize(MeshSimulationObject.createTriangleMeshShape(terrainMesh, terrainTriangleMesh), 0, -1, transform); terrain.getRigidbody().setCollisionFlags(CollisionFlags.CF_STATIC_OBJECT); addCollisionSimulationObject(terrain); // terrain = new StaticPlaneSimulationObject(vector.set(0, 0, 1), 1, -1, 50, 50, terrainTexture, false); // addCollisionSimulationObject(terrain); Pools.btTRANSFORM.free(transform); Pools.VECTOR3.free(vector); }
From source file:com.badlogic.gdx.tests.box2d.PhysicalCell.java
void render() { buildMesh();/*from w w w . j a v a 2 s . c om*/ GL10 gl = Gdx.graphics.getGL10(); Gdx.gl.glEnable(GL10.GL_TEXTURE_2D); //Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT); texture.bind(); gl.glPushMatrix(); gl.glTranslatef(0.3f, 0.0f, 0.0f); //gl.glScalef(0.5f, 0.5f, 1.0f); gl.glRotatef(0, 0f, 0f, 1f); mesh.render(GL10.GL_TRIANGLES); gl.glPopMatrix(); }
From source file:com.badlogic.gdx.tests.lw.WaterRipplesLW.java
License:Apache License
@Override public void render() { GL10 gl = Gdx.graphics.getGL10();//from w ww . j ava 2 s .co m gl.glViewport(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); gl.glClear(GL10.GL_COLOR_BUFFER_BIT); camera.update(); gl.glMatrixMode(GL10.GL_PROJECTION); gl.glLoadMatrixf(camera.combined.val, 0); gl.glMatrixMode(GL10.GL_MODELVIEW); gl.glLoadIdentity(); accum += Gdx.graphics.getDeltaTime(); while (accum > TICK) { // for (int i = 0; i < 5; i++) { // if (Gdx.input.isTouched(i)) { // Ray ray = camera.getPickRay(Gdx.input.getX(i), Gdx.input.getY(i)); // Intersector.intersectRayPlane(ray, plane, point); // touchWater(point); // } // } updateWater(); float[][] tmp = curr; curr = last; last = tmp; accum -= TICK; } float alpha = accum / TICK; interpolateWater(alpha); updateVertices(intp); gl.glEnable(GL10.GL_TEXTURE_2D); texture.bind(); mesh.render(GL10.GL_TRIANGLES); batch.begin(); // batch.drawText(font, "fps: " + Gdx.graphics.getFramesPerSecond(), 10, 20, Color.WHITE); batch.end(); }
From source file:com.badlogic.gdx.tests.MyFirstTriangle.java
License:Apache License
@Override public void render() { renderCount++;//ww w . ja va 2 s . c o m Gdx.app.log("RenderCountTest", String.valueOf(renderCount)); Gdx.gl10.glClear(GL10.GL_COLOR_BUFFER_BIT); mesh.render(GL10.GL_TRIANGLES, 0, 3); try { Thread.sleep(2000); } catch (InterruptedException e) { Gdx.app.log("RenderCountTest", e.toString()); } }
From source file:com.badlogic.gdx.tests.Water.java
@Override public void render() { GL10 gl = Gdx.graphics.getGL10();/*from w ww . ja v a2s. c om*/ if (gl == null) { return; } gl.glViewport(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); gl.glClear(GL10.GL_COLOR_BUFFER_BIT); camera.update(); gl.glMatrixMode(GL10.GL_PROJECTION); gl.glLoadMatrixf(camera.getCombinedMatrix().val, 0); gl.glMatrixMode(GL10.GL_MODELVIEW); accum += Gdx.graphics.getDeltaTime(); while (accum > TICK) { for (int i = 0; i < 5; i++) { if (Gdx.input.isTouched(i)) { Ray ray = camera.getPickRay(Gdx.input.getX(i), (int) (Gdx.input.getY(i) / (float) Gdx.graphics.getHeight() * Gdx.graphics.getWidth())); Intersector.intersectRayPlane(ray, plane, point); touchWater(point); } } updateWater(); float[][] tmp = curr; curr = last; last = tmp; accum -= TICK; } float alpha = accum / TICK; interpolateWater(alpha); updateVertices(intp); gl.glEnable(GL10.GL_TEXTURE_2D); texture.bind(); mesh.render(GL10.GL_TRIANGLES); batch.begin(); //batch.drawText(font, "fps: " + Gdx.graphics.getFramesPerSecond(), 10, 20, Color.WHITE); batch.end(); }
From source file:com.badlogic.gdx.tests.WaterRipples.java
License:Apache License
@Override public void render() { GL10 gl = Gdx.graphics.getGL10();/* ww w . j a v a2s.c o m*/ gl.glViewport(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); gl.glClear(GL10.GL_COLOR_BUFFER_BIT); camera.update(); gl.glMatrixMode(GL10.GL_PROJECTION); gl.glLoadMatrixf(camera.combined.val, 0); gl.glMatrixMode(GL10.GL_MODELVIEW); gl.glLoadIdentity(); accum += Gdx.graphics.getDeltaTime(); while (accum > TICK) { for (int i = 0; i < 5; i++) { if (Gdx.input.isTouched(i)) { Ray ray = camera.getPickRay(Gdx.input.getX(i), Gdx.input.getY(i)); Intersector.intersectRayPlane(ray, plane, point); touchWater(point); } } updateWater(); float[][] tmp = curr; curr = last; last = tmp; accum -= TICK; } float alpha = accum / TICK; interpolateWater(alpha); updateVertices(intp); gl.glEnable(GL10.GL_TEXTURE_2D); texture.bind(); mesh.render(GL10.GL_TRIANGLES); batch.begin(); // batch.drawText(font, "fps: " + Gdx.graphics.getFramesPerSecond(), 10, 20, Color.WHITE); batch.end(); }
From source file:com.badlogic.rtm.LevelRenderer.java
License:Apache License
@Override public void render() { GL10 gl = Gdx.gl10;// w w w .j a v a2 s . co m gl.glViewport(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT); gl.glEnable(GL10.GL_DEPTH_TEST); gl.glEnable(GL10.GL_TEXTURE_2D); camera.update(); camera.apply(gl); tiles.bind(); gl.glColor4f(1, 1, 1, 1); floorMesh.render(GL10.GL_TRIANGLES); wallMesh.render(GL10.GL_TRIANGLES); batch.begin(); batch.setBlendFunction(GL10.GL_ONE, GL10.GL_ONE_MINUS_SRC_ALPHA); font.draw(batch, "fps: " + Gdx.graphics.getFramesPerSecond() + ", delta:" + Gdx.graphics.getDeltaTime(), 10, 25); batch.end(); processInput(); }
From source file:com.balloongame.handlers.CustomSpriteBatch.java
License:Apache License
private void renderMesh() { if (idx == 0) return;/*from w ww .ja va2 s .c om*/ renderCalls++; totalRenderCalls++; //int spritesInBatch = idx / 20; //if (spritesInBatch > maxSpritesInBatch) maxSpritesInBatch = spritesInBatch; int meshIndicesBufferLimit = idx * 6 / 20; lastTexture.bind(0); mesh.setVertices(vertices, 0, idx); mesh.getIndicesBuffer().position(0); mesh.getIndicesBuffer().limit(meshIndicesBufferLimit); if (blendingDisabled) { Gdx.gl.glDisable(GL20.GL_BLEND); } else { Gdx.gl.glEnable(GL20.GL_BLEND); if (blendSrcFunc != -1) Gdx.gl.glBlendFunc(blendSrcFunc, blendDstFunc); } if (Gdx.graphics.isGL20Available()) { mesh.render(customShader != null ? customShader : shader, GL10.GL_TRIANGLES, 0, meshIndicesBufferLimit);//mesh.render(shader, GL10.GL_TRIANGLES, 0, meshIndicesBufferLimit); } else { mesh.render(GL10.GL_TRIANGLES, 0, meshIndicesBufferLimit); } idx = 0; currBufferIdx++; if (currBufferIdx == buffers.length) currBufferIdx = 0; mesh = buffers[currBufferIdx]; }