Java Code Examples for com.badlogic.gdx.graphics.GL20

The following examples show how to use com.badlogic.gdx.graphics.GL20. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: ud406   Source File: GameplayScreen.java    License: MIT License 6 votes vote down vote up
@Override
public void render(float delta) {
    level.update(delta);
    chaseCam.update(delta);
    gameplayViewport.apply();
    Gdx.gl.glClearColor(
            Constants.BACKGROUND_COLOR.r,
            Constants.BACKGROUND_COLOR.g,
            Constants.BACKGROUND_COLOR.b,
            Constants.BACKGROUND_COLOR.a);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    batch.setProjectionMatrix(gameplayViewport.getCamera().combined);
    batch.begin();
    level.render(batch);

    batch.end();


}
 
Example 2
Source Project: ud406   Source File: GameplayScreen.java    License: MIT License 6 votes vote down vote up
@Override
public void render(float delta) {
    level.update(delta);
    chaseCam.update();

    viewport.apply();
    Gdx.gl.glClearColor(
            Constants.BACKGROUND_COLOR.r,
            Constants.BACKGROUND_COLOR.g,
            Constants.BACKGROUND_COLOR.b,
            Constants.BACKGROUND_COLOR.a);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    batch.setProjectionMatrix(viewport.getCamera().combined);
    level.render(batch);
}
 
Example 3
Source Project: ud406   Source File: GameplayScreen.java    License: MIT License 6 votes vote down vote up
@Override
public void render(float delta) {
    level.update(delta);
    chaseCam.update(delta);
    gameplayViewport.apply();
    Gdx.gl.glClearColor(
            Constants.BACKGROUND_COLOR.r,
            Constants.BACKGROUND_COLOR.g,
            Constants.BACKGROUND_COLOR.b,
            Constants.BACKGROUND_COLOR.a);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    batch.setProjectionMatrix(gameplayViewport.getCamera().combined);
    batch.begin();
    level.render(batch);

    batch.end();

}
 
Example 4
Source Project: ud406   Source File: GameplayScreen.java    License: MIT License 6 votes vote down vote up
@Override
public void render(float delta) {
    level.update(delta);
    chaseCam.update(delta);
    gameplayViewport.apply();
    Gdx.gl.glClearColor(
            Constants.BACKGROUND_COLOR.r,
            Constants.BACKGROUND_COLOR.g,
            Constants.BACKGROUND_COLOR.b,
            Constants.BACKGROUND_COLOR.a);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    batch.setProjectionMatrix(gameplayViewport.getCamera().combined);
    batch.begin();
    level.render(batch);

    batch.end();

}
 
Example 5
Source Project: ud406   Source File: GameplayScreen.java    License: MIT License 6 votes vote down vote up
@Override
public void render(float delta) {
    level.update(delta);
    chaseCam.update(delta);
    gameplayViewport.apply();
    Gdx.gl.glClearColor(
            Constants.BACKGROUND_COLOR.r,
            Constants.BACKGROUND_COLOR.g,
            Constants.BACKGROUND_COLOR.b,
            Constants.BACKGROUND_COLOR.a);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    batch.setProjectionMatrix(gameplayViewport.getCamera().combined);
    batch.begin();
    level.render(batch);

    batch.end();


}
 
Example 6
Source Project: ud406   Source File: GameplayScreen.java    License: MIT License 6 votes vote down vote up
@Override
public void render(float delta) {
    level.update(delta);
    chaseCam.update(delta);
    gameplayViewport.apply();
    Gdx.gl.glClearColor(
            Constants.BACKGROUND_COLOR.r,
            Constants.BACKGROUND_COLOR.g,
            Constants.BACKGROUND_COLOR.b,
            Constants.BACKGROUND_COLOR.a);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    batch.setProjectionMatrix(gameplayViewport.getCamera().combined);
    batch.begin();
    level.render(batch);

    batch.end();

}
 
Example 7
Source Project: buffer_bci   Source File: SettingsScreen.java    License: GNU General Public License v3.0 6 votes vote down vote up
@Override
public void render(float delta) {
    // Clear Screen
    Gdx.gl.glClearColor(0.2f, 0.2f, 0.2f, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    stage.act(delta);

    if (StandardizedInterface.getInstance().BufferClient.isConnected()) {
        statusButton.setText("Disconnect");
        statusLabel.setColor(0,255,0,1);
    }
    else {
        statusButton.setText("Connect");
        statusLabel.setColor(255,0,0,1);
    }
    statusLabel.setText("Status: " + StandardizedInterface.getInstance().BufferClient.getConnectionState());

    // Draw stage
    stage.draw();
}
 
Example 8
Source Project: Mundus   Source File: UsefulMeshs.java    License: Apache License 2.0 6 votes vote down vote up
public static Model createAxes() {
    final float GRID_MIN = -10f;
    final float GRID_MAX = 10f;
    final float GRID_STEP = 1f;
    ModelBuilder modelBuilder = new ModelBuilder();
    modelBuilder.begin();
    MeshPartBuilder builder = modelBuilder.part("grid", GL20.GL_LINES,
            VertexAttributes.Usage.Position | VertexAttributes.Usage.ColorUnpacked, new Material());
    builder.setColor(Color.LIGHT_GRAY);
    for (float t = GRID_MIN; t <= GRID_MAX; t += GRID_STEP) {
        builder.line(t, 0, GRID_MIN, t, 0, GRID_MAX);
        builder.line(GRID_MIN, 0, t, GRID_MAX, 0, t);
    }
    builder = modelBuilder.part("axes", GL20.GL_LINES,
            VertexAttributes.Usage.Position | VertexAttributes.Usage.ColorUnpacked, new Material());
    builder.setColor(Color.RED);
    builder.line(0, 0, 0, 100, 0, 0);
    builder.setColor(Color.GREEN);
    builder.line(0, 0, 0, 0, 100, 0);
    builder.setColor(Color.BLUE);
    builder.line(0, 0, 0, 0, 0, 100);
    return modelBuilder.end();
}
 
Example 9
Source Project: libgdx-2d-tutorial   Source File: MainMenuScreen.java    License: MIT License 6 votes vote down vote up
@Override
public void render (float delta) {
	Gdx.gl.glClearColor(0.15f, 0.15f, 0.3f, 1);
	Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
	game.batch.begin();
	
	game.scrollingBackground.updateAndRender(delta, game.batch);
	
	int x = SpaceGame.WIDTH / 2 - EXIT_BUTTON_WIDTH / 2;
	if (game.cam.getInputInGameWorld().x < x + EXIT_BUTTON_WIDTH && game.cam.getInputInGameWorld().x > x && SpaceGame.HEIGHT - game.cam.getInputInGameWorld().y < EXIT_BUTTON_Y + EXIT_BUTTON_HEIGHT && SpaceGame.HEIGHT - game.cam.getInputInGameWorld().y > EXIT_BUTTON_Y) {
		game.batch.draw(exitButtonActive, x, EXIT_BUTTON_Y, EXIT_BUTTON_WIDTH, EXIT_BUTTON_HEIGHT);
	} else {
		game.batch.draw(exitButtonInactive, x, EXIT_BUTTON_Y, EXIT_BUTTON_WIDTH, EXIT_BUTTON_HEIGHT);
	}
	
	x = SpaceGame.WIDTH / 2 - PLAY_BUTTON_WIDTH / 2;
	if (game.cam.getInputInGameWorld().x < x + PLAY_BUTTON_WIDTH && game.cam.getInputInGameWorld().x > x && SpaceGame.HEIGHT - game.cam.getInputInGameWorld().y < PLAY_BUTTON_Y + PLAY_BUTTON_HEIGHT && SpaceGame.HEIGHT - game.cam.getInputInGameWorld().y > PLAY_BUTTON_Y) {
		game.batch.draw(playButtonActive, x, PLAY_BUTTON_Y, PLAY_BUTTON_WIDTH, PLAY_BUTTON_HEIGHT);
	} else {
		game.batch.draw(playButtonInactive, x, PLAY_BUTTON_Y, PLAY_BUTTON_WIDTH, PLAY_BUTTON_HEIGHT);
	}
	
	game.batch.draw(logo, SpaceGame.WIDTH / 2 - LOGO_WIDTH / 2, LOGO_Y, LOGO_WIDTH, LOGO_HEIGHT);
	
	game.batch.end();
}
 
Example 10
Source Project: ud406   Source File: GameplayScreen.java    License: MIT License 6 votes vote down vote up
@Override
public void render(float delta) {
    level.update(delta);
    chaseCam.update(delta);
    gameplayViewport.apply();
    Gdx.gl.glClearColor(
            Constants.BACKGROUND_COLOR.r,
            Constants.BACKGROUND_COLOR.g,
            Constants.BACKGROUND_COLOR.b,
            Constants.BACKGROUND_COLOR.a);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    batch.setProjectionMatrix(gameplayViewport.getCamera().combined);
    batch.begin();
    level.render(batch);

    batch.end();


}
 
Example 11
Source Project: talos   Source File: BvBWorkspace.java    License: Apache License 2.0 6 votes vote down vote up
private void drawTools(Batch batch, float parentAlpha) {
    Skeleton skeleton = skeletonContainer.getSkeleton();
    if(skeleton == null) return;

    if(showingTools) {
        batch.end();
        Gdx.gl.glLineWidth(1f);
        Gdx.gl.glEnable(GL20.GL_BLEND);
        shapeRenderer.setProjectionMatrix(batch.getProjectionMatrix());
        shapeRenderer.begin(ShapeRenderer.ShapeType.Filled);

        drawShapeRendererTools();

        shapeRenderer.end();
        batch.begin();

        if(showingTools) {
            drawSpriteTools(batch, parentAlpha);
        }
    }
}
 
Example 12
Source Project: ud406   Source File: GameplayScreen.java    License: MIT License 6 votes vote down vote up
@Override
public void render(float delta) {
    level.update(delta);
    chaseCam.update(delta);
    gameplayViewport.apply();
    Gdx.gl.glClearColor(
            Constants.BACKGROUND_COLOR.r,
            Constants.BACKGROUND_COLOR.g,
            Constants.BACKGROUND_COLOR.b,
            Constants.BACKGROUND_COLOR.a);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    batch.setProjectionMatrix(gameplayViewport.getCamera().combined);
    batch.begin();
    level.render(batch);

    batch.end();

}
 
Example 13
@Override
public void render(Canvas canvas, Camera camera, float alpha, ParticleData particles) {
    int src = canvas.getSrcBlendFunction();
    int dst = canvas.getDstBlendFunction();
    //canvas.setBlendFunction(GL20.GL_SRC_ALPHA, GL20.GL_FUNC_ADD);
    canvas.setBlendFunction(GL20.GL_SRC_ALPHA, GL20.GL_ONE);
    Gdx.gl20.glBlendEquation(GL20.GL_FUNC_ADD);
    
    Vector2f cameraPos = camera.getRenderPosition(alpha);
    for(int i = 0; i < particles.numberOfAliveParticles; i++) {
        Sprite sprite = particles.sprite[i];
        Vector2f pos = particles.pos[i];
        sprite.setPosition(pos.x - cameraPos.x, pos.y - cameraPos.y);
        sprite.setScale(particles.scale[i]);
        sprite.setColor(particles.color[i]);
        sprite.setRotation(particles.rotation[i]);
        canvas.drawRawSprite(sprite);
    }
    
    canvas.setBlendFunction(src, dst);
}
 
Example 14
Source Project: ud405   Source File: ViewportsExercise.java    License: MIT License 6 votes vote down vote up
@Override
public void render() {
    Gdx.gl.glClearColor(0, 0, 0, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    // TODO: Apply the viewport
    viewport.apply();

    // TODO: Set the projection matrix of the ShapeRenderer to the combined matrix of the viewport's camera
    renderer.setProjectionMatrix(viewport.getCamera().combined);

    renderer.begin(ShapeType.Filled);
    renderer.setColor(Color.WHITE);
    renderer.rect(0, 0, WORLD_WIDTH, WORLD_HEIGHT);
    renderer.setColor(Color.BLACK);
    punchCantorGasket(0, 0, WORLD_WIDTH, WORLD_HEIGHT, RECURSIONS);
    renderer.setColor(Color.WHITE);
    renderer.circle(WORLD_WIDTH / 2, WORLD_HEIGHT / 2, Math.min(WORLD_WIDTH, WORLD_HEIGHT) / 6.5f, 20);
    renderer.end();
}
 
Example 15
Source Project: ud405   Source File: DrawTheCantorGasket.java    License: MIT License 6 votes vote down vote up
@Override
public void render () {
    Gdx.gl.glClearColor(0, 0, 0, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    // Finds a good place to draw our fractal
    // Rectangle has members x,y for the lower left corner, and width and height
    Rectangle bounds = findLargestSquare();

    // TODO: Begin a filled shapeRenderer batch

    // TODO: Draw a white square matching the bounds

    // TODO: Set the working color to black, and call punchCantorGasket with the bounds

    // TODO: End the batch
    shapeRenderer.end();
}
 
Example 16
Source Project: ud406   Source File: GameplayScreen.java    License: MIT License 6 votes vote down vote up
@Override
public void render(float delta) {
    level.update(delta);
    chaseCam.update(delta);
    gameplayViewport.apply();
    Gdx.gl.glClearColor(
            Constants.BACKGROUND_COLOR.r,
            Constants.BACKGROUND_COLOR.g,
            Constants.BACKGROUND_COLOR.b,
            Constants.BACKGROUND_COLOR.a);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    batch.setProjectionMatrix(gameplayViewport.getCamera().combined);
    batch.begin();
    level.render(batch);

    batch.end();

}
 
Example 17
Source Project: ud405   Source File: DrawTheCantorGasket.java    License: MIT License 6 votes vote down vote up
@Override
public void render() {
    Gdx.gl.glClearColor(0, 0, 0, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    Rectangle bounds = findLargestSquare();

    // TODO: Begin a filled shapeRenderer batch
    shapeRenderer.begin(ShapeType.Filled);

    // TODO: Draw a white square matching the bounds
    shapeRenderer.setColor(Color.WHITE);
    shapeRenderer.rect(bounds.x, bounds.y, bounds.width, bounds.height);

    // TODO: Set the working color to black, and call punchCantorGasket with the bounds
    shapeRenderer.setColor(Color.BLACK);
    punchCantorGasket(bounds.x, bounds.y, bounds.width, RECURSIONS);

    // TODO: End the batch
    shapeRenderer.end();
}
 
Example 18
Source Project: VuforiaLibGDX   Source File: Renderer.java    License: MIT License 6 votes vote down vote up
public Renderer() {

        lights = new Environment();
        lights.set(new ColorAttribute(ColorAttribute.AmbientLight, Color.WHITE));

        camera = new PerspectiveCamera(60, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
        camera.near = 1.0F;
        camera.far = 1000.0F;
        //set camera into "Vuforia - style" direction
        camera.position.set(new Vector3(0,0,0));
        camera.lookAt(new Vector3(0,0,1));

        IntBuffer buffer = BufferUtils.newIntBuffer(16);
        Gdx.gl.glGetIntegerv(GL20.GL_MAX_TEXTURE_IMAGE_UNITS, buffer);
        int units = buffer.get(0);
        Log.d("TAG", "Max texture units: "+units);
        modelBatch = new ModelBatch(new RenderContext(new DefaultTextureBinder(DefaultTextureBinder.WEIGHTED, 0)));
    }
 
Example 19
Source Project: ud405   Source File: IciclesScreen.java    License: MIT License 6 votes vote down vote up
@Override
public void render(float delta) {
    // TODO: Call update() on player


    iciclesViewport.apply(true);
    Gdx.gl.glClearColor(Constants.BACKGROUND_COLOR.r, Constants.BACKGROUND_COLOR.g, Constants.BACKGROUND_COLOR.b, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    renderer.setProjectionMatrix(iciclesViewport.getCamera().combined);
    renderer.begin(ShapeType.Filled);
    renderer.setColor(Constants.ICICLE_COLOR);
    icicle.render(renderer);
    player.render(renderer);
    renderer.end();

}
 
Example 20
Source Project: Unlucky   Source File: MenuExtensionScreen.java    License: MIT License 6 votes vote down vote up
public void render(float dt) {
    update(dt);
    for (int i = 0; i < game.menuBackground.length; i++) {
        game.menuBackground[i].update(dt);
    }

    // clear screen
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    if (renderBatch) {
        stage.getBatch().setProjectionMatrix(stage.getCamera().combined);
        stage.getBatch().begin();
        // fix fading
        if (batchFade) stage.getBatch().setColor(Color.WHITE);
        for (int i = 0; i < game.menuBackground.length; i++) {
            game.menuBackground[i].render((SpriteBatch) stage.getBatch());
        }
        stage.getBatch().end();
    }

    super.render(dt);
}
 
Example 21
Source Project: ud406   Source File: GameplayScreen.java    License: MIT License 6 votes vote down vote up
@Override
public void render(float delta) {
    level.update(delta);
    chaseCam.update(delta);
    gameplayViewport.apply();
    Gdx.gl.glClearColor(
            Constants.BACKGROUND_COLOR.r,
            Constants.BACKGROUND_COLOR.g,
            Constants.BACKGROUND_COLOR.b,
            Constants.BACKGROUND_COLOR.a);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    batch.setProjectionMatrix(gameplayViewport.getCamera().combined);
    batch.begin();
    level.render(batch);

    batch.end();

}
 
Example 22
Source Project: Skyland   Source File: Splash.java    License: MIT License 6 votes vote down vote up
@Override
public void render(float v) {
    Gdx.gl.glViewport(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);

    Skyland.getInstance().renderStage();

    if (Gdx.input.isKeyPressed(Input.Keys.BACK))
        System.exit(0);

    if (!loaded && Assets.update())
        loaded = true;

    if (loaded && animationFinished) {
        Assets.addSkinRegions("skins/skin.pack");
        addFonts();
        Assets.menuSkin.load(Gdx.files.internal("skins/skin.json"));
        Skyland.getInstance().setScreen(new MenuScene());
    }
}
 
Example 23
Source Project: ud405   Source File: Starfield.java    License: MIT License 6 votes vote down vote up
@Override
public void render () {
    // Wanna see what happens when we accidentally generate the stars every frame?
    // initStars(STAR_DENSITY);
    // TODO: Make the night sky black
    Gdx.gl.glClearColor(0, 0, 0, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    // TODO: Begin a shapeRenderer batch using ShapeType.Point
    shapeRenderer.begin(ShapeType.Point);
    // TODO: Loop through the star positions and use shapeRenderer to draw points
    for (Vector2 star : stars){
        shapeRenderer.point(star.x, star.y, 0);
    }
    // TODO: End the shapeRenderer batch
    shapeRenderer.end();
}
 
Example 24
Source Project: ud406   Source File: GameplayScreen.java    License: MIT License 6 votes vote down vote up
@Override
public void render(float delta) {
    level.update(delta);
    chaseCam.update(delta);
    gameplayViewport.apply();
    Gdx.gl.glClearColor(
            Constants.BACKGROUND_COLOR.r,
            Constants.BACKGROUND_COLOR.g,
            Constants.BACKGROUND_COLOR.b,
            Constants.BACKGROUND_COLOR.a);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    batch.setProjectionMatrix(gameplayViewport.getCamera().combined);
    batch.begin();
    level.render(batch);

    batch.end();

}
 
Example 25
Source Project: ud406   Source File: GameplayScreen.java    License: MIT License 6 votes vote down vote up
@Override
public void render(float delta) {
    level.update(delta);
    chaseCam.update(delta);
    gameplayViewport.apply();
    Gdx.gl.glClearColor(
            Constants.BACKGROUND_COLOR.r,
            Constants.BACKGROUND_COLOR.g,
            Constants.BACKGROUND_COLOR.b,
            Constants.BACKGROUND_COLOR.a);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    batch.setProjectionMatrix(gameplayViewport.getCamera().combined);
    batch.begin();
    level.render(batch);

    batch.end();

}
 
Example 26
Source Project: Mundus   Source File: BasePicker.java    License: Apache License 2.0 6 votes vote down vote up
public Pixmap getFrameBufferPixmap(Viewport viewport) {
    int w = viewport.getScreenWidth();
    int h = viewport.getScreenHeight();
    int x = viewport.getScreenX();
    int y = viewport.getScreenY();
    final ByteBuffer pixelBuffer = BufferUtils.newByteBuffer(w * h * 4);

    Gdx.gl.glBindFramebuffer(GL20.GL_FRAMEBUFFER, fbo.getFramebufferHandle());
    Gdx.gl.glReadPixels(x, y, w, h, GL30.GL_RGBA, GL30.GL_UNSIGNED_BYTE, pixelBuffer);
    Gdx.gl.glBindFramebuffer(GL20.GL_FRAMEBUFFER, 0);

    final int numBytes = w * h * 4;
    byte[] imgLines = new byte[numBytes];
    final int numBytesPerLine = w * 4;
    for (int i = 0; i < h; i++) {
        pixelBuffer.position((h - i - 1) * numBytesPerLine);
        pixelBuffer.get(imgLines, i * numBytesPerLine, numBytesPerLine);
    }

    Pixmap pixmap = new Pixmap(w, h, Pixmap.Format.RGBA8888);
    BufferUtils.copy(imgLines, 0, pixmap.getPixels(), imgLines.length);

    return pixmap;
}
 
Example 27
Source Project: ud405   Source File: IciclesScreen.java    License: MIT License 6 votes vote down vote up
@Override
public void render(float delta) {
    icicles.update(delta);
    player.update(delta);

    iciclesViewport.apply(true);
    Gdx.gl.glClearColor(Constants.BACKGROUND_COLOR.r, Constants.BACKGROUND_COLOR.g, Constants.BACKGROUND_COLOR.b, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    renderer.setProjectionMatrix(iciclesViewport.getCamera().combined);
    renderer.begin(ShapeType.Filled);
    icicles.render(renderer);
    player.render(renderer);
    renderer.end();

}
 
Example 28
Source Project: ashley-superjumper   Source File: HelpScreen4.java    License: Apache License 2.0 6 votes vote down vote up
public void draw () {
	GL20 gl = Gdx.gl;
	gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
	guiCam.update();

	game.batcher.setProjectionMatrix(guiCam.combined);
	game.batcher.disableBlending();
	game.batcher.begin();
	game.batcher.draw(helpRegion, 0, 0, 320, 480);
	game.batcher.end();

	game.batcher.enableBlending();
	game.batcher.begin();
	game.batcher.draw(Assets.arrow, 320, 0, -64, 64);
	game.batcher.end();

	gl.glDisable(GL20.GL_BLEND);
}
 
Example 29
Source Project: gdx-proto   Source File: HeadlessG3dModelLoader.java    License: Apache License 2.0 6 votes vote down vote up
private int parseType (String type) {
	if (type.equals("TRIANGLES")) {
		return GL20.GL_TRIANGLES;
	} else if (type.equals("LINES")) {
		return GL20.GL_LINES;
	} else if (type.equals("POINTS")) {
		return GL20.GL_POINTS;
	} else if (type.equals("TRIANGLE_STRIP")) {
		return GL20.GL_TRIANGLE_STRIP;
	} else if (type.equals("LINE_STRIP")) {
		return GL20.GL_LINE_STRIP;
	} else {
		throw new GdxRuntimeException("Unknown primitive type '" + type
				+ "', should be one of triangle, trianglestrip, line, linestrip, lineloop or point");
	}
}
 
Example 30
Source Project: dice-heroes   Source File: State.java    License: GNU General Public License v3.0 5 votes vote down vote up
final void doRender(float delta) {
    Color color = getBackgroundColor();
    Gdx.gl.glClearColor(color.r, color.g, color.b, color.a);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    stage.act(delta);
    stage.draw();
    render(delta);
}