List of usage examples for com.badlogic.gdx Gdx gl
GL20 gl
To view the source code for com.badlogic.gdx Gdx gl.
Click Source Link
From source file:com.pantagruelsteeth.SpiderEncountersGame.java
License:Open Source License
@Override public void render() { Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT); stage.act(Gdx.graphics.getDeltaTime()); stage.draw(); }
From source file:com.paperscape.game.Menu.java
License:Creative Commons License
@Override public void render(float delta) { //makes the whole screen a colour, (red, green, blue, alpha) how much of each?, 0-1F, 1F = white, alpha = transparency Gdx.gl.glClearColor(1F, 1F, 1F, 1F); //clears the canvas ready for drawing Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); //update the camera on the screen GameAssets.camera.update();/*w w w . j ava 2s. c o m*/ //continuously checking for touches or inputs generalUpdate(GameAssets.game, GameAssets.touch, GameAssets.camera); checkButtons(); //------------------------------------ /*Sprite Batch*/ //resize the sprite batch depending on screen size GameAssets.batch.setProjectionMatrix(GameAssets.camera.combined); //resize the shape renderer depending on screen size GameAssets.shapeRenderer.setProjectionMatrix(GameAssets.camera.combined); //code that draws sprites to the screen goes after this GameAssets.batch.begin(); menuManager.draw(GameAssets.batch); GameAssets.batch.end(); /* //used to check the position of objects GameAssets.shapeRenderer.begin(ShapeRenderer.ShapeType.Line); menuManager.renderEnemies(GameAssets.shapeRenderer); GameAssets.shapeRenderer.end(); */ }
From source file:com.paulogaspar.ninja.screens.Credits.java
@Override public void render(float delta) { Gdx.gl.glClearColor(0.61f, 0.64f, 0.5f, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); update(delta);//www . ja va2s .c om if (changed_screen) return; draw(); }
From source file:com.pearl.main.screen.transition.ScreenTransitionSlide.java
License:Apache License
@Override public void render(SpriteBatch batch, Texture currScreen, Texture nextScreen, float alpha) { float w = currScreen.getWidth(); float h = currScreen.getHeight(); float x = 0;/*from w w w .ja v a 2 s . co m*/ float y = 0; if (easing != null) alpha = easing.apply(alpha); // calculate position offset switch (direction) { case LEFT: x = -w * alpha; if (!slideOut) x += w; break; case RIGHT: x = w * alpha; if (!slideOut) x -= w; break; case UP: y = h * alpha; if (!slideOut) y -= h; break; case DOWN: y = -h * alpha; if (!slideOut) y += h; break; } // drawing order depends on slide type ('in' or 'out') Texture texBottom = slideOut ? nextScreen : currScreen; Texture texTop = slideOut ? currScreen : nextScreen; // finally, draw both screens Gdx.gl.glClearColor(0.0f, 0.0f, 0.0f, 1.0f); Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT); batch.begin(); batch.draw(texBottom, 0, 0, 0, 0, w, h, 1, 1, 0, 0, 0, currScreen.getWidth(), currScreen.getHeight(), false, true); batch.draw(texTop, x, y, 0, 0, w, h, 1, 1, 0, 0, 0, nextScreen.getWidth(), nextScreen.getHeight(), false, true); batch.end(); }
From source file:com.perfectplay.org.SkyBox.java
License:Open Source License
public void reloadCubemap() { g_cubeTexture = createGLHandle();// www . j av a 2s. c o m Gdx.gl20.glBindTexture(GL20.GL_TEXTURE_CUBE_MAP, g_cubeTexture); Pixmap temp = manager.get(textures[0], Pixmap.class); Gdx.gl.glTexImage2D(GL20.GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, temp.getGLInternalFormat(), temp.getWidth(), temp.getHeight(), 0, temp.getGLFormat(), temp.getGLType(), temp.getPixels()); temp = manager.get(textures[1], Pixmap.class); Gdx.gl.glTexImage2D(GL20.GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, temp.getGLInternalFormat(), temp.getWidth(), temp.getHeight(), 0, temp.getGLFormat(), temp.getGLType(), temp.getPixels()); temp = manager.get(textures[2], Pixmap.class); Gdx.gl.glTexImage2D(GL20.GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, temp.getGLInternalFormat(), temp.getWidth(), temp.getHeight(), 0, temp.getGLFormat(), temp.getGLType(), temp.getPixels()); temp = manager.get(textures[3], Pixmap.class); Gdx.gl.glTexImage2D(GL20.GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, temp.getGLInternalFormat(), temp.getWidth(), temp.getHeight(), 0, temp.getGLFormat(), temp.getGLType(), temp.getPixels()); temp = manager.get(textures[4], Pixmap.class); Gdx.gl.glTexImage2D(GL20.GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, temp.getGLInternalFormat(), temp.getWidth(), temp.getHeight(), 0, temp.getGLFormat(), temp.getGLType(), temp.getPixels()); temp = manager.get(textures[5], Pixmap.class); Gdx.gl.glTexImage2D(GL20.GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, temp.getGLInternalFormat(), temp.getWidth(), temp.getHeight(), 0, temp.getGLFormat(), temp.getGLType(), temp.getPixels()); Gdx.gl20.glBindTexture(GL20.GL_TEXTURE_CUBE_MAP, g_cubeTexture); Gdx.gl20.glTexParameterf(GL20.GL_TEXTURE_CUBE_MAP, GL20.GL_TEXTURE_MAG_FILTER, GL20.GL_LINEAR); Gdx.gl20.glTexParameterf(GL20.GL_TEXTURE_CUBE_MAP, GL20.GL_TEXTURE_MIN_FILTER, GL20.GL_NEAREST); Gdx.gl20.glTexParameteri(GL20.GL_TEXTURE_CUBE_MAP, GL20.GL_TEXTURE_WRAP_S, GL20.GL_CLAMP_TO_EDGE); Gdx.gl20.glTexParameteri(GL20.GL_TEXTURE_CUBE_MAP, GL20.GL_TEXTURE_WRAP_T, GL20.GL_CLAMP_TO_EDGE); }
From source file:com.perfectplay.org.SkyBox.java
License:Open Source License
public void render(PerspectiveCamera camera) { invView.set(camera.view);// w ww . j a v a 2 s .c o m // Remove translation invView.val[Matrix4.M03] = 0; invView.val[Matrix4.M13] = 0; invView.val[Matrix4.M23] = 0; invView.inv().tra(); mvp.set(camera.projection); mvp.mul(invView); Gdx.gl.glEnable(GL20.GL_CULL_FACE); Gdx.gl.glCullFace(GL20.GL_FRONT); Gdx.gl.glFrontFace(GL20.GL_CCW); Gdx.gl20.glDisable(GL20.GL_BLEND); Gdx.gl20.glDisable(GL20.GL_DEPTH_TEST); Gdx.gl20.glDepthMask(false); Gdx.gl20.glActiveTexture(GL20.GL_TEXTURE0); Gdx.gl20.glBindTexture(GL20.GL_TEXTURE_CUBE_MAP, g_cubeTexture); program.begin(); program.setUniformMatrix("u_mvpMatrix", mvp); program.setUniformi("s_cubemap", 0); cube.render(program, GL20.GL_TRIANGLE_STRIP); program.end(); Gdx.gl.glEnable(GL20.GL_DEPTH_TEST); Gdx.gl.glDepthMask(true); }
From source file:com.perfectplay.org.SkyBox.java
License:Open Source License
protected static int createGLHandle() { buffer.position(0); buffer.limit(buffer.capacity()); Gdx.gl.glGenTextures(1, buffer); return buffer.get(0); }
From source file:com.perfectplay.org.SkyBox.java
License:Open Source License
public void dispose() { for (int i = 0; i < 6; i++) { if (manager.isLoaded(textures[i])) { manager.unload(textures[i]); }//w ww. j a va2 s . c om } cube.dispose(); IntBuffer buffer = BufferUtils.newIntBuffer(1); buffer.put(0, g_cubeTexture); Gdx.gl.glDeleteTextures(1, buffer); }
From source file:com.pixelscientists.gdx.inventory.InventoryScreen.java
License:Open Source License
@Override public void render(float delta) { Gdx.gl.glClearColor(0.2f, 0.2f, 0.2f, 0f); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT); if (Gdx.input.isKeyPressed(Input.Keys.ANY_KEY)) { inventoryActor.setVisible(true); }/*from ww w . j ava 2 s .com*/ stage.act(delta); stage.draw(); }
From source file:com.pixelscientists.gdx.splash.SplashScreen.java
License:Open Source License
@Override public void render(float deltaTime) { if (LibgdxUtils.assets.update() && minimumShowTime <= 0) { LibgdxUtils.game.setScreen(new InventoryScreen()); }// w ww. ja va 2 s.c om Gdx.gl.glClearColor(0.15f, 0.15f, 0.15f, 0f); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT); LibgdxUtils.spriteBatch.setProjectionMatrix(camera.combined); LibgdxUtils.spriteBatch.begin(); LibgdxUtils.spriteBatch.draw(splash, 0, 0); LibgdxUtils.spriteBatch.end(); minimumShowTime -= deltaTime; }