本文整理汇总了Java中com.badlogic.gdx.Gdx.gl方法的典型用法代码示例。如果您正苦于以下问题:Java Gdx.gl方法的具体用法?Java Gdx.gl怎么用?Java Gdx.gl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.Gdx
的用法示例。
在下文中一共展示了Gdx.gl方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import com.badlogic.gdx.Gdx; //导入方法依赖的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;
}
示例2: isSupported
import com.badlogic.gdx.Gdx; //导入方法依赖的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;
}
示例3: main
import com.badlogic.gdx.Gdx; //导入方法依赖的package包/类
public static void main(String[] args)
{
SpringApplication.run(HeadlessServerLauncher.class, args);
ServerSettings.isHeadless = true;
LwjglNativesLoader.load();
Gdx.files = new LwjglFiles();
HeadlessNativesLoader.load();
MockGraphics mockGraphics = new MockGraphics();
Gdx.graphics = mockGraphics;
HeadlessNet headlessNet = new HeadlessNet();
Gdx.net = headlessNet;
Gdx.gl = new NullGL20();
Gdx.gl20 = new NullGL20();
Gdx.gl30 = new NullGL30();
HeadlessApplicationConfiguration config = new HeadlessApplicationConfiguration();
new HeadlessApplication(new GameServer(), config);
}
示例4: draw
import com.badlogic.gdx.Gdx; //导入方法依赖的package包/类
private void draw() {
GL20 gl = Gdx.gl;
gl.glClearColor(1, 1, 1, 1);
gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
this.guiCam.update();
this.game.spriteBatch.setProjectionMatrix(guiCam.combined);
this.game.spriteBatch.enableBlending();
this.game.spriteBatch.begin();
this.game.spriteBatch.draw(AssetsUtil.background, 0, 0, 800, 480);
this.game.spriteBatch.draw(AssetsUtil.helpScreenItems, 0, 0, 800, 480);
this.game.spriteBatch.draw(AssetsUtil.backIcon, 7, 432, 48, 48);
this.game.spriteBatch.end();
}
示例5: draw
import com.badlogic.gdx.Gdx; //导入方法依赖的package包/类
private void draw() {
GL20 gl = Gdx.gl;
gl.glClearColor(1, 1, 1, 1);
gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
this.guiCam.update();
this.game.spriteBatch.setProjectionMatrix(this.guiCam.combined);
this.game.spriteBatch.enableBlending();
this.game.spriteBatch.begin();
this.game.spriteBatch.draw(AssetsUtil.background, 0, 0, 800, 480);
this.game.spriteBatch.draw(AssetsUtil.creditsScreenItems, 0, 0, 800, 480);
this.game.spriteBatch.draw(AssetsUtil.backIcon, 7, 432, 48, 48);
this.game.spriteBatch.end();
}
示例6: renderGL2
import com.badlogic.gdx.Gdx; //导入方法依赖的package包/类
@Override
public void renderGL2(float gameTime)
{
GLCommon gl = Gdx.gl;
gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
SpriteBatch batch = getSpriteBatch();
viewMatrix.setToOrtho2D(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
batch.setProjectionMatrix(viewMatrix);
batch.begin();
batch.disableBlending();
batch.setColor(Color.WHITE);
//begin render background
renderBackground(gameTime);
batch.enableBlending();
batch.end();
gl.glEnable(GL10.GL_DEPTH_TEST);
gl.glEnable(GL10.GL_CULL_FACE);
camera.update();
for(IDrawable3D obj : collection)
if(obj.isVisible())
{
obj.renderGL2(gameTime);
}
gl.glDisable(GL10.GL_CULL_FACE);
gl.glDisable(GL10.GL_DEPTH_TEST);
batch.setProjectionMatrix(viewMatrix);
batch.begin();
//begin render foreground
renderForeground(gameTime);
//batch.enableBlending();
//batch.setBlendFunction(GL10.GL_ONE, GL10.GL_ONE_MINUS_SRC_ALPHA);
batch.end();
}
示例7: init
import com.badlogic.gdx.Gdx; //导入方法依赖的package包/类
@BeforeClass
public static void init() {
// Note that we don't need to implement any of the listener's methods
Gdx.app = 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;
}
示例8: draw
import com.badlogic.gdx.Gdx; //导入方法依赖的package包/类
private void draw() {
GL20 gl = Gdx.gl;
gl.glClearColor(1, 1, 1, 1);
gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
this.guiCam.update();
this.game.spriteBatch.setProjectionMatrix(this.guiCam.combined);
this.game.spriteBatch.enableBlending();
this.game.spriteBatch.begin();
this.game.spriteBatch.draw(AssetsUtil.background, 0, 0, 800, 480);
this.game.spriteBatch.draw(AssetsUtil.levelScreenItems, 0, 0, 800, 480);
this.game.spriteBatch.draw(AssetsUtil.backIcon, 7, 432, 48, 48);
if(SettingsUtil.autoMoveToNext) {
this.game.glyphLayout.setText(AssetsUtil.fontSmall, "x");
AssetsUtil.fontSmall.draw(this.game.spriteBatch, this.game.glyphLayout, 347, 40);
}
int line = 0;
int column = 0;
for(int i = 0; i < LEVELS; i++) {
this.game.spriteBatch.draw(AssetsUtil.levelCircle, 370 + 75 * column++, 240 - 70 * line, 57, 57);
this.game.glyphLayout.setText(AssetsUtil.font, Integer.toString(i+1));
AssetsUtil.font.draw(this.game.spriteBatch, this.game.glyphLayout, 324 + 75 * column - this.game.glyphLayout.width / 2, 281 - 70 * line);
if(column == 5) {
column = 0;
line++;
}
}
this.game.spriteBatch.end();
}
示例9: draw
import com.badlogic.gdx.Gdx; //导入方法依赖的package包/类
private void draw() {
GL20 gl = Gdx.gl;
gl.glClearColor(1, 1, 1, 1);
gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
this.guiCam.update();
this.game.spriteBatch.setProjectionMatrix(this.guiCam.combined);
this.game.spriteBatch.enableBlending();
this.game.spriteBatch.begin();
this.game.spriteBatch.draw(AssetsUtil.trainingBackground, 0, 0, 800, 480);
this.grid.drawNotes();
this.grid.draw();
this.bottomBar.draw();
this.game.spriteBatch.draw(AssetsUtil.backIcon, 7, 432, 48, 48);
if(SettingsUtil.playEnabled) {
switch (firstRun) {
case 3:
this.game.spriteBatch.draw(AssetsUtil.three, 0, 65, 800, 418);
break;
case 2:
this.game.spriteBatch.draw(AssetsUtil.two, 0, 65, 800, 418);
break;
case 1:
this.game.spriteBatch.draw(AssetsUtil.one, 0, 65, 800, 418);
break;
}
}
this.game.spriteBatch.end();
}
示例10: draw
import com.badlogic.gdx.Gdx; //导入方法依赖的package包/类
private void draw() {
GL20 gl = Gdx.gl;
gl.glClearColor(1, 1, 1, 1);
gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
this.guiCam.update();
this.game.spriteBatch.setProjectionMatrix(this.guiCam.combined);
this.game.spriteBatch.enableBlending();
this.game.spriteBatch.begin();
this.game.spriteBatch.draw(AssetsUtil.background, 0, 0, 800, 480);
this.game.spriteBatch.draw(AssetsUtil.mainScreenItems, 0, 0, 800, 480);
this.game.spriteBatch.end();
}