當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。