当前位置: 首页>>代码示例>>Java>>正文


Java GL20类代码示例

本文整理汇总了Java中com.badlogic.gdx.graphics.GL20的典型用法代码示例。如果您正苦于以下问题:Java GL20类的具体用法?Java GL20怎么用?Java GL20使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


GL20类属于com.badlogic.gdx.graphics包,在下文中一共展示了GL20类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: preDraw

import com.badlogic.gdx.graphics.GL20; //导入依赖的package包/类
@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);
	}
 
开发者ID:kyperbelt,项目名称:KyperBox,代码行数:20,代码来源:ParticleSystem.java

示例2: draw

import com.badlogic.gdx.graphics.GL20; //导入依赖的package包/类
@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();
}
 
开发者ID:LonamiWebs,项目名称:Klooni1010,代码行数:17,代码来源:PauseMenuStage.java

示例3: blend

import com.badlogic.gdx.graphics.GL20; //导入依赖的package包/类
/** 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;
}
 
开发者ID:CypherCove,项目名称:gdx-cclibs,代码行数:20,代码来源:Quad3D.java

示例4: render

import com.badlogic.gdx.graphics.GL20; //导入依赖的package包/类
@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);
	}
}
 
开发者ID:heyzqt,项目名称:libGdx-xiyou,代码行数:19,代码来源:Start.java

示例5: render

import com.badlogic.gdx.graphics.GL20; //导入依赖的package包/类
@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));
	}

}
 
开发者ID:MusicDev33,项目名称:JGame,代码行数:17,代码来源:LoadingScreen.java

示例6: init

import com.badlogic.gdx.graphics.GL20; //导入依赖的package包/类
@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;
}
 
开发者ID:cpppwner,项目名称:NoRiskNoFun,代码行数:17,代码来源:GdxTest.java

示例7: isSupported

import com.badlogic.gdx.graphics.GL20; //导入依赖的package包/类
/**
 * @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;
}
 
开发者ID:CypherCove,项目名称:gdx-cclibs,代码行数:19,代码来源:Anisotropy.java

示例8: draw

import com.badlogic.gdx.graphics.GL20; //导入依赖的package包/类
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();
}
 
开发者ID:conquest,项目名称:conquest,代码行数:17,代码来源:Grabber.java

示例9: render

import com.badlogic.gdx.graphics.GL20; //导入依赖的package包/类
@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();
}
 
开发者ID:akivamu,项目名称:libgdx-crypt-texture,代码行数:21,代码来源:SimpleGame.java

示例10: draw

import com.badlogic.gdx.graphics.GL20; //导入依赖的package包/类
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;
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:24,代码来源:BreakingRenderer.java

示例11: draw

import com.badlogic.gdx.graphics.GL20; //导入依赖的package包/类
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;
}
 
开发者ID:RedTroop,项目名称:Cubes,代码行数:22,代码来源:BreakingRenderer.java

示例12: render

import com.badlogic.gdx.graphics.GL20; //导入依赖的package包/类
@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);
}
 
开发者ID:DurianHLN,项目名称:Polymorph,代码行数:17,代码来源:SettingsScreen.java

示例13: render

import com.badlogic.gdx.graphics.GL20; //导入依赖的package包/类
@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();
}
 
开发者ID:eskalon,项目名称:ProjektGG,代码行数:36,代码来源:LoadingScreen.java

示例14: render

import com.badlogic.gdx.graphics.GL20; //导入依赖的package包/类
@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);
}
 
开发者ID:eskalon,项目名称:ProjektGG,代码行数:15,代码来源:GameMapScreen.java

示例15: glClear

import com.badlogic.gdx.graphics.GL20; //导入依赖的package包/类
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);
}
 
开发者ID:RedTroop,项目名称:Cubes,代码行数:11,代码来源:ClientAdapter.java


注:本文中的com.badlogic.gdx.graphics.GL20类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。