@Override public void preDraw(Batch batch, float parentAlpha) { // boolean last_additive = pre_draws.size > 0?containsAdditive(pre_draws.first()):false; for (int i = 0; i < pre_draws.size; i++) { PooledEffect pe = pre_draws.get(i); // boolean contains_additive = containsAdditive(pe); // if(last_additive&&!contains_additive) { // batch.setBlendFunction(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA); // } // last_additive = contains_additive; pe.draw(batch); } batch.setBlendFunction(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA); }
@Override public void draw() { if (shown) { // Draw an overlay rectangle with not all the opacity // This is the only place where ShapeRenderer is OK because the batch hasn't started Gdx.gl.glEnable(GL20.GL_BLEND); shapeRenderer.begin(ShapeRenderer.ShapeType.Filled); Color color = new Color(Klooni.theme.bandColor); color.a = 0.1f; shapeRenderer.setColor(color); shapeRenderer.rect(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); shapeRenderer.end(); } super.draw(); }
/** Enables blending and sets the blend function parameters to a commonly used pair. Blending is disabled by default. * @return This object for chaining. */ public Quad3D blend (Blending blending) { opaque = false; switch (blending) { case Alpha: srcBlendFactor = GL20.GL_SRC_ALPHA; dstBlendFactor = GL20.GL_ONE_MINUS_SRC_ALPHA; break; case PremultipliedAlpha: srcBlendFactor = GL20.GL_ONE; dstBlendFactor = GL20.GL_ONE_MINUS_SRC_ALPHA; break; case Additive: srcBlendFactor = dstBlendFactor = GL20.GL_ONE; break; } return this; }
@Override public void render() { Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); mBatch.setProjectionMatrix(mCamera.combined); mBatch.begin(); mBatch.draw(MyGdxGame.assetManager.getTexture(Constant.START_BG), 0, 0); mBatch.end(); update(Gdx.graphics.getDeltaTime()); mStage.act(); mStage.draw(); if (isShowRangeDialog) { mRangeDialog.render(mBatch); } }
@Override public void render(float delta) { Gdx.gl.glClearColor(0, 1, 1, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); randomDelta += delta; game.batch.begin(); fontHandler.font90.setColor(Color.BLACK); fontHandler.font90.draw(game.batch, "Loading", (game.screenX / 2) - widthLoading / 2, (game.screenY / 2) + 100); game.batch.end(); if (randomDelta >= .1 && settingMap == true) { settingMap = false; game.setScreen(new GameScreen(game)); } }
@BeforeClass public static void init() { // Note that we don't need to implement any of the listener's methods application = new HeadlessApplication(new ApplicationListener() { @Override public void create() {} @Override public void resize(int width, int height) {} @Override public void render() {} @Override public void pause() {} @Override public void resume() {} @Override public void dispose() {} }); // Use Mockito to mock the OpenGL methods since we are running headlessly Gdx.gl20 = Mockito.mock(GL20.class); Gdx.gl = Gdx.gl20; }
/** * @return Whether the device supports anisotropic filtering. */ public static boolean isSupported () { GL20 gl = Gdx.gl; if (gl != null) { if (Gdx.graphics.supportsExtension("GL_EXT_texture_filter_anisotropic")) { anisotropySupported = true; FloatBuffer buffer = BufferUtils.newFloatBuffer(16); buffer.position(0); buffer.limit(buffer.capacity()); Gdx.gl20.glGetFloatv(GL20.GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, buffer); maxAnisotropySupported = buffer.get(0); } checkComplete = true; } return anisotropySupported; }
public void draw(ShapeRenderer renderer) { if (rect.width < 25 * cam.zoom || rect.height < 25 * cam.zoom) return; Gdx.gl.glEnable(GL20.GL_BLEND); Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA); renderer.setProjectionMatrix(cam.combined); renderer.begin(ShapeRenderer.ShapeType.Filled); renderer.setColor(new Color(0x228b2255)); renderer.rect(rect.x, rect.y, rect.width, rect.height); renderer.set(ShapeRenderer.ShapeType.Line); renderer.setColor(Color.BLACK); renderer.rect(rect.x, rect.y, rect.width, rect.height); renderer.end(); }
@Override public void render() { Gdx.gl.glClearColor(1, 0, 0, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); batch.begin(); int x = 1; font.draw(batch, "Origin", x, originH + 20); batch.draw(originTexture, x, 1); x += originW + 1; font.draw(batch, "non encrypt", x, originH + 20); batch.draw(originTextureByDecryptor, x, 1); x += originW + 1; font.draw(batch, "decrypt", x, originH + 20); batch.draw(decryptedTexture, x, 1); batch.end(); }
public static Renderable draw() { Player player = Cubes.getClient().player; ItemTool.MiningTarget currentlyMining = player.getCurrentlyMining(); if (currentlyMining == null) return null; BlockReference position = currentlyMining.target; float percent = currentlyMining.time / currentlyMining.totalTime; percent -= 1f / (1f + num); if (percent <= 0f) return null; int n = (int) Math.floor(percent * num); float f = 1f / 128f; Renderable renderable = new Renderable(); renderable.worldTransform.translate(position.blockX - f, position.blockY - f, position.blockZ - f); renderable.worldTransform.scl(1f + f + f); renderable.meshPart.primitiveType = GL20.GL_TRIANGLES; renderable.meshPart.offset = n * (6 * 6); renderable.meshPart.size = 6 * 6; renderable.meshPart.mesh = mesh; renderable.material = material; return renderable; }
@Override public void render(float delta) { // TODO Fix magic numbers Gdx.gl.glClearColor(0, 0, 0, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); stage.getBatch().begin(); stage.getBatch().draw(background, 0, 0, Polymorph.WORLD_WIDTH, Polymorph.WORLD_HEIGHT); stage.getBatch().draw(musicVolumeText, musicVolumeSlider.getX() - 25, musicVolumeSlider.getY() + musicVolumeSlider.getHeight(), 200, 50); stage.getBatch().draw(soundVolumeText, soundVolumeSlider.getX() - 25, soundVolumeSlider.getY() + soundVolumeSlider.getHeight(), 200, 50); stage.getBatch().end(); stage.draw(); stage.act(delta); }
@Override public void render(float delta) { Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); game.getSpriteBatch().begin(); game.getSpriteBatch().setProjectionMatrix(game.getUICamera().combined); // Draw the background game.getSpriteBatch().draw(this.backgroundTexture, 0, 0, game.getViewportWidth(), game.getViewportHeight()); // Get useful values float viewPortWidth = game.getViewportWidth(); float viewPortHeight = game.getViewportHeight(); float imageWidth = this.orangeBarTexture.getWidth(); float imageHeight = this.orangeBarTexture.getHeight(); // Check if the asset manager is done if (game.getAssetManager().update()) { onFinishedLoading(); } progress = Interpolation.linear.apply(progress, game.getAssetManager().getProgress(), 0.1f); // The actual drawing game.getSpriteBatch().draw(this.blueBarTexture, (viewPortWidth / 2) - (imageWidth / 2) + 1, (viewPortHeight / 4) - imageHeight / 2); game.getSpriteBatch().draw(this.orangeBarTexture, (viewPortWidth / 2) - (imageWidth / 2), (viewPortHeight / 4) - imageHeight / 2, imageWidth * progress, imageHeight); this.game.getSpriteBatch().end(); }
@Override public void render(float delta) { Gdx.gl.glClearColor(backgroundColor.r, backgroundColor.g, backgroundColor.b, backgroundColor.a); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); game.getSpriteBatch().begin(); game.getSpriteBatch().setProjectionMatrix(game.getUICamera().combined); game.getSpriteBatch().draw(this.titleImage, 100, 100); game.getSpriteBatch().end(); //game.getCurrentSession().renderMap(delta, 0, 0); }
private void glClear() { try { Color skyColour = ((WorldClient) cubesClient.world).getSkyColour(); Gdx.gl20.glClearColor(skyColour.r, skyColour.g, skyColour.b, skyColour.a); } catch (Exception ignored) { Gdx.gl20.glClearColor(0, 0, 0, 1f); } Gdx.gl20.glViewport(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); Gdx.gl20.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT); }
public void progress(float cx, float cy, float r, float thickness, float amt, Color c, Texture lookup) { //start and end angles float start = 0f; float end = amt * 360f; lookup.bind(); renderer.begin(cam.combined, GL20.GL_TRIANGLE_STRIP); Gdx.gl.glEnable(GL20.GL_BLEND); Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA); int segs = (int)(24 * Math.cbrt(r)); end += 90f; start += 90f; float halfThick = thickness/2f; float step = 360f / segs; for (float angle=start; angle<(end+step); angle+=step) { float tc = 0.5f; if (angle==start) tc = 0f; else if (angle>=end) tc = 1f; float fx = MathUtils.cosDeg(angle); float fy = MathUtils.sinDeg(angle); float z = 0f; renderer.color(c.r, c.g, c.b, c.a); renderer.texCoord(tc, 1f); renderer.vertex(cx + fx * (r + halfThick), cy + fy * (r + halfThick), z); renderer.color(c.r, c.g, c.b, c.a); renderer.texCoord(tc, 0f); renderer.vertex(cx + fx * (r + -halfThick), cy + fy * (r + -halfThick), z); } renderer.end(); }
@Override public void render() { Gdx.gl.glClearColor(1, 0, 0, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); batch.begin(); batch.draw(img, 0, 0); batch.end(); }
@Override public void draw() { if (light) { Gdx.gl.glBlendFunc( GL20.GL_SRC_ALPHA, GL20.GL_ONE ); super.draw(); Gdx.gl.glBlendFunc( GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA ); } else { super.draw(); } }
@Override public void render () { Gdx.gl.glClearColor(15, 8, 0, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); batch.begin(); miCoche.draw(batch); batch.end(); ProcesarEntradaTeclado(); ProcesarEntradaRaton(); }
@Override public void render () { update(Gdx.graphics.getDeltaTime()); Gdx.gl.glClearColor(0.1f, 0.1f, 0.1f, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); stage.draw(); }
public void draw(int dx, int dy){ if(dx < 0 || dy < 0 || dx >= pixmap.getWidth() || dy >= pixmap.getHeight()){ return; } Gdx.gl.glBindTexture(GL20.GL_TEXTURE_2D, texture.getTextureObjectHandle()); int dstWidth = brushSize*2-1; int dstHeight = brushSize*2-1; int width = pixmap.getWidth(), height = pixmap.getHeight(); int x = dx - dstWidth/2; int y = dy - dstHeight/2; if (x + dstWidth > width){ x = width - dstWidth; }else if (x < 0){ x = 0; } if (y + dstHeight > height){ dstHeight = height - y; }else if (y < 0){ dstHeight += y; y = 0; } pixmap.fillCircle(dx, dy, brushSize-1); Pixmap dst = brush(brushSize); dst.drawPixmap(pixmap, x, y, dstWidth, dstHeight, 0, 0, dstWidth, dstHeight); Gdx.gl.glTexSubImage2D(GL20.GL_TEXTURE_2D, 0, x, y, dstWidth, dstHeight, dst.getGLFormat(), dst.getGLType(), dst.getPixels()); }
@Override public void render() { super.render(); Gdx.gl.glClearColor(0, 0, 0, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); if (stage!=null) { stage.act(); stage.draw(); } }
@Override public void render() { Gdx.gl.glClearColor(0f, 1f, 1f, 1f); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); _batch.setProjectionMatrix(camera.combined); _batch.begin(); // batch.draw(tex, Gdx.graphics.getWidth() / 4 - tex.getWidth(), Gdx.graphics.getHeight() / 4 - tex.getWidth(), // 0, 0); sprite.draw(_batch); _batch.end(); }
@Override public void render () { Gdx.gl.glClearColor(0, 0, 0, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); mainStage.act(Gdx.graphics.getDeltaTime()); mainStage.draw(); }
/** Returns actual OpenGL states to defaults. The blend function parameters, depth test function parameters, and culled face * parameter are left unchanged. */ public void end () { State temp = pending; pending = DEF; executeChanges(); pending = temp; Gdx.gl.glActiveTexture(GL20.GL_TEXTURE0); }
@Override public void render(float delta) { Gdx.gl.glClearColor(0, 0, 0, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); game.batch.begin(); game.batch.draw(bg, 0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); game.batch.end(); stage.act(delta); stage.draw(); }
@Override public void render(float delta) { Gdx.gl.glClearColor(0, 0, 0, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); aGame.batch.begin(); aGame.batch.draw(bg, 0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); aGame.batch.end(); aLoginStage.act(delta); aLoginStage.draw(); }
@Override public void render(float delta) { Gdx.gl.glClearColor(0, 0, 0, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); aGame.batch.begin(); aGame.batch.draw(bg, 0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); aGame.batch.end(); aMenuStage.act(delta); aMenuStage.draw(); }
@Override public void show() { //Initialize everything screenCamera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); camera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); camera.position.x = 0; camera.position.y = 0; batch = new DrawingBatch(1000, ShaderUtil.compileShader(Gdx.files.internal("shaders/basic.vertex.glsl"), Gdx.files .internal("shaders/basic.fragment.glsl")), true); batch.setBlendFunction(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA); setLevel(level); }
@Override public void render (float deltaTime) { Gdx.gl.glClearColor(red, green, blue, 1f); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); DS.camera.update(); DS.sb.setProjectionMatrix(DS.camera.combined); DS.sb.begin(); splashLogo.draw(DS.sb); DS.sb.end(); }
@Override public void render () { Gdx.gl.glClearColor(1, 1, 1, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); camera.update(); stage.getBatch().setProjectionMatrix(camera.combined); stage.act(); stage.draw(); }
@Override public void render (float delta) { Gdx.gl.glClearColor(clearColor.r, clearColor.g, clearColor.b, clearColor.a); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); stage.act(); stage.draw(); }
@Override public void render() { Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); gsm.setSpriteBatch(batch); gsm.update(Gdx.graphics.getDeltaTime()); gsm.render(batch); }
/** Flushes the same triangles drawn the last time a flush occurred. This is an expert method with no error checks. It * provides a way to avoid re-submitting the batchable data for drawing if none of them have changed since the last * flush and nothing in the render context has changed either (textures, blend modes, etc.). Note that there are * several reasons the previous flush may have occurred other than a manual call to {@link #flush()}, so care must * be taken to be aware of these and avoid them if necessary. */ public void repeatPreviousFlush (){ if (previousTriIdx != 0) { mesh.render(shader, GL20.GL_TRIANGLES, 0, previousTriIdx); renderCalls++; totalRenderCalls++; } reflushUsed = true; }
@Override public void draw() { if (lightMode) { Gdx.gl.glBlendFunc( GL20.GL_SRC_ALPHA, GL20.GL_ONE ); super.draw(); Gdx.gl.glBlendFunc( GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA ); } else { super.draw(); } }
@Override public void render(float delta) { Gdx.gl.glClearColor((float)95/255,(float)10/255,(float)255/255,(float)1.0); Gdx.gl.glClear( GL20.GL_COLOR_BUFFER_BIT ); viewport.apply(); batch.setProjectionMatrix(viewport.getCamera().combined); batch.begin(); float width = Gdx.graphics.getWidth(); float height = Gdx.graphics.getHeight(); batch.end(); stage.act(Gdx.graphics.getDeltaTime()); stage.draw(); }
@Override public void render(float delta) { Gdx.gl.glClearColor((float)95/255,(float)10/255,(float)255/255,(float)1.0); Gdx.gl.glClear( GL20.GL_COLOR_BUFFER_BIT ); viewport.apply(); batch.setProjectionMatrix(viewport.getCamera().combined); batch.begin(); float width = Gdx.graphics.getWidth(); float height = Gdx.graphics.getHeight(); batch.end(); stage.draw(); }
@Override public void render(float delta) { Gdx.gl.glClearColor((float)95/255,(float)10/255,(float)255/255,(float)1.0); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); viewport.apply(); batch.setProjectionMatrix(viewport.getCamera().combined); batch.begin(); batch.end(); if(victory){ if(level == maxNumLevels) { imageLogo.setDrawable(new TextureRegionDrawable(new TextureRegion(new Texture(Gdx.files.internal("Star.png"))))); button.setText(menuvictory+" "+ menulevel + " "+level+ "\n"+menuchampion+"\n"+menucontinue); } else{ imageLogo.setDrawable(new TextureRegionDrawable(new TextureRegion(new Texture(Gdx.files.internal("Star.png"))))); button.setText(menuvictory+" "+ menulevel + " "+level+ "\n"+menucontinue); } } else { imageLogo.setDrawable(new TextureRegionDrawable(new TextureRegion(new Texture(Gdx.files.internal("Cross.png"))))); button.setText(menugameover+" "+ menulevel + " "+level+ "\n"+menucontinue);} stage.act(Gdx.graphics.getDeltaTime()); stage.draw(); imageLogo.setOrigin(imageLogo.getWidth()/2, imageLogo.getHeight()/2); imageLogo.rotateBy(2); }
@Override public void render(float delta) { Gdx.gl.glClearColor((float)95/255,(float)10/255,(float)255/255,(float)1.0); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); viewport.apply(); batch.setProjectionMatrix(viewport.getCamera().combined); batch.begin(); batch.end(); stage.act(Gdx.graphics.getDeltaTime()); stage.draw(); }