本文整理汇总了Java中com.badlogic.gdx.graphics.GL30类的典型用法代码示例。如果您正苦于以下问题:Java GL30类的具体用法?Java GL30怎么用?Java GL30使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GL30类属于com.badlogic.gdx.graphics包,在下文中一共展示了GL30类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: render
import com.badlogic.gdx.graphics.GL30; //导入依赖的package包/类
/**------------------------RENDER------------------------**/
@Override
public void render(float f)
{
//Debug
//stage.setDebugAll(true);
//Clear Screen
Gdx.gl.glClearColor(0.2f, 0.2f, 0.2f, 1);
Gdx.gl.glClear(GL30.GL_COLOR_BUFFER_BIT);
//Draw stage
stage.act(Constants.DELTATIME);
stage.draw();
/*------------------SWITCH TO FULLSCREEN AND BACK------------------*/
super.changeToFullScreenOnF12();
/*------------------QUIT GAME------------------*/
if (Gdx.input.isKeyPressed(Input.Keys.ESCAPE))
{
game.setScreen(new MenuScreen(game, client, server));
}
}
示例2: render
import com.badlogic.gdx.graphics.GL30; //导入依赖的package包/类
/**------------------------RENDER------------------------**/
@Override
public void render(float f)
{
//Debug
//stage.setDebugAll(true);
//Clear Screen
Gdx.gl.glClearColor(0.2f, 0.2f, 0.2f, 1);
Gdx.gl.glClear(GL30.GL_COLOR_BUFFER_BIT);
//Set background image
rootTable.background(new TextureRegionDrawable(new TextureRegion(TextureManager.menuBackground)));
//Draw stage
stage.act(Gdx.graphics.getDeltaTime());
stage.draw();
/*------------------SWITCH TO FULLSCREEN AND BACK------------------*/
super.changeToFullScreenOnF12();
}
示例3: render
import com.badlogic.gdx.graphics.GL30; //导入依赖的package包/类
/**------------------------RENDER------------------------**/
@Override
public void render(float f)
{
//Debug
// stage.setDebugAll(true);
//Clear Screen
Gdx.gl.glClearColor(0.2f, 0.2f, 0.2f, 1);
Gdx.gl.glClear(GL30.GL_COLOR_BUFFER_BIT);
//Draw stage
stage.act(Constants.DELTATIME);
stage.draw();
/*------------------SWITCH TO FULLSCREEN AND BACK------------------*/
super.changeToFullScreenOnF12();
/*------------------QUIT GAME------------------*/
if (Gdx.input.isKeyJustPressed(Input.Keys.ESCAPE))
{
game.setScreen(new HostScreen(game, client, server));
}
}
示例4: init
import com.badlogic.gdx.graphics.GL30; //导入依赖的package包/类
public void init() {
final int numVertices = this.vertexResolution * this.vertexResolution;
final int numIndices = (this.vertexResolution-1) * (this.vertexResolution-1) * 6;
mesh = new Mesh(true, numVertices, numIndices, attribs);
this.vertices = new float[numVertices * stride];
mesh.setIndices(buildIndices());
buildVertices();
mesh.setVertices(vertices);
MeshPart meshPart = new MeshPart(null, mesh, 0, numIndices, GL30.GL_TRIANGLES);
meshPart.update();
ModelBuilder mb = new ModelBuilder();
mb.begin();
mb.part(meshPart, material);
model = mb.end();
modelInstance = new ModelInstance(model);
modelInstance.transform = transform;
}
示例5: constructCells
import com.badlogic.gdx.graphics.GL30; //导入依赖的package包/类
public void constructCells() {
builder.begin();
int vertAttrs = Position | Normal | TextureCoordinates;
for(int x = 0; x < cells.length; x++) {
for (int z = 0; z < cells[x].length; z++) {
MeshPartBuilder partBuilder = builder.part("cell"+x+","+z, GL30.GL_TRIANGLES, vertAttrs, Reference.Defaults.Models.material());
partBuilder.rect(getPoint("D", x, z), getPoint("C", x, z), getPoint("B", x, z), getPoint("A", x, z), Vector3.Y);
cells[x][z].setCellPart(partBuilder.getMeshPart());
cells[x][z].init();
}
}
model = builder.end();
instance = new ModelInstance(model);
}
示例6: draw
import com.badlogic.gdx.graphics.GL30; //导入依赖的package包/类
public void draw(GameMap map, Batch batch) {
if (map == null) {
return;
}
if (additive)
batch.setBlendFunction(GL30.GL_SRC_ALPHA, GL30.GL_ONE);
Particle[] particles = this.particles;
boolean[] active = this.active;
Vector2 tempVector = MathUtil.getVector2();
for (int i = 0, n = maxParticleCount; i < n; i++)
if (active[i]) {
tempVector.set(particles[i].getX() + particles[i].getOriginX(),
particles[i].getY() + particles[i].getOriginY());
map.projectToTiles(tempVector);
if (map.shouldRenderTile((int) tempVector.x, (int) tempVector.y)) {
particles[i].draw(batch);
}
}
MathUtil.freeVector2(tempVector);
if (additive)
batch.setBlendFunction(GL30.GL_SRC_ALPHA, GL30.GL_ONE_MINUS_SRC_ALPHA);
}
示例7: render
import com.badlogic.gdx.graphics.GL30; //导入依赖的package包/类
@Override
public void render(float delta) {
// get any missing assets
Assets.getAssetManager().update();
// update phase
gameState.update(delta, camera);
UIManager.updateUI(delta);
cameraController.updateCamera(delta);
camera.update();
// render phase
Gdx.gl.glClearColor(0f, 0f, 0f, 1f);
Gdx.gl.glClear(GL30.GL_COLOR_BUFFER_BIT);
renderer.render(delta, camera);
UIManager.drawUI();
}
示例8: getFrameBufferPixmap
import com.badlogic.gdx.graphics.GL30; //导入依赖的package包/类
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;
}
示例9: beforeRender
import com.badlogic.gdx.graphics.GL30; //导入依赖的package包/类
@Override
public void beforeRender(Renderable renderable) {
context.setDepthMask(true);
context.setDepthTest(GL30.GL_LESS);
if (env.depthShaderMode == LevelEnv.DepthShaderMode.Normal) {
shader.setUniformf(UNIFORM_TRANSPARENT_DEPTH, 1.0f);
if (BaseRenderable.haveTransparency(renderable.material)) {
context.setCullFace(GL30.GL_NONE);
} else {
context.setCullFace(GL20.GL_FRONT);
}
} else {
shader.setUniformf(UNIFORM_TRANSPARENT_DEPTH, 1.0f);
context.setCullFace(GL20.GL_BACK);
}
}
示例10: buildFactoryFor
import com.badlogic.gdx.graphics.GL30; //导入依赖的package包/类
private VoxelChunkRenderableFactory buildFactoryFor(Chunk chunk, VoxelsAssembler assembler, Material material) {
if (assembler.isEmpty()) {
return null;
} else {
VoxelChunkRenderableFactory voxelChunkRenderableFactory = new VoxelChunkRenderableFactory();
voxelChunkRenderableFactory.material = material;
voxelChunkRenderableFactory.primitiveType = GL30.GL_TRIANGLES;
if (ForgE.config.getBool(Config.Key.GenerateWireframe))
voxelChunkRenderableFactory.wireframe = assembler.wireframe();
voxelChunkRenderableFactory.triangleCount = assembler.getTriangleCount();
voxelChunkRenderableFactory.attributes = MeshVertexInfo.voxelTypes();
voxelChunkRenderableFactory.meshFactory = assembler.meshFactory(voxelChunkRenderableFactory.attributes);
return voxelChunkRenderableFactory;
}
}
示例11: buildFaceForChunkWithAssembler
import com.badlogic.gdx.graphics.GL30; //导入依赖的package包/类
private VoxelChunkRenderable buildFaceForChunkWithAssembler(Chunk chunk, VoxelsAssembler assembler, boolean haveTransparency) {
if (!assembler.isEmpty()) {
VoxelChunkRenderable renderable = new VoxelChunkRenderable();
renderable.primitiveType = GL30.GL_TRIANGLES;
if (ForgE.config.getBool(Config.Key.GenerateWireframe))
renderable.wireframe = assembler.wireframe();
renderable.triangleCount = assembler.getTriangleCount();
renderable.meshFactory = assembler.meshFactory(MeshVertexInfo.voxelTypes());
renderable.worldTransform.idt();
renderable.material = new Material(new SolidTerrainAttribute());
if (haveTransparency) {
renderable.material.set(new BlendingAttribute(true,1f));
}
chunk.addFace(renderable);
return renderable;
} else {
return null;
}
}
示例12: render
import com.badlogic.gdx.graphics.GL30; //导入依赖的package包/类
@Override
public void render() {
Gdx.gl.glClearColor(0, 0, 0, 1);
Gdx.gl.glClear(GL30.GL_COLOR_BUFFER_BIT);
//TODO background
localTSR.draw(game.cRenderer);
visitorTSR.draw(game.cRenderer);
ShapeRenderer shapeRenderer = game.cRenderer.shape;
shapeRenderer.begin(ShapeRenderer.ShapeType.Filled);
shapeRenderer.setColor(new Color(0, 0, 1, 1));
shapeRenderer.rect(button.x, button.y, button.width, button.height);
shapeRenderer.end();
}
示例13: render
import com.badlogic.gdx.graphics.GL30; //导入依赖的package包/类
/**------------------------RENDER------------------------**/
@Override
public void render(float f)
{
//Debug
//stage.setDebugAll(true);
if(Gdx.graphics.isFullscreen())
{
checkBoxFullscreen.setChecked(true);
}else
{
checkBoxFullscreen.setChecked(false);
}
//Clear Screen
Gdx.gl.glClearColor(0.2f, 0.2f, 0.2f, 1);
Gdx.gl.glClear(GL30.GL_COLOR_BUFFER_BIT);
//Draw stage
stage.act(Constants.DELTATIME);
stage.draw();
/*------------------SWITCH TO FULLSCREEN AND BACK------------------*/
super.changeToFullScreenOnF12();
/*------------------QUIT GAME------------------*/
if (Gdx.input.isKeyJustPressed(Input.Keys.ESCAPE))
{
game.setScreen(new MenuScreen(game, client, server));
}
}
示例14: render
import com.badlogic.gdx.graphics.GL30; //导入依赖的package包/类
/**------------------------RENDER------------------------**/
@Override
public void render(float f)
{
//Debug
// stage.setDebugAll(true);
//Clear Screen
Gdx.gl.glClearColor(0.2f, 0.2f, 0.2f, 1);
Gdx.gl.glClear(GL30.GL_COLOR_BUFFER_BIT);
//Draw stage
stage.act(Constants.DELTATIME);
stage.draw();
/*------------------SWITCH TO FULLSCREEN AND BACK------------------*/
super.changeToFullScreenOnF12();
/*------------------QUIT GAME------------------*/
if (Gdx.input.isKeyJustPressed(Input.Keys.ESCAPE))
{
if(oldMaxPlayerValue != maxPlayers)
{
server.resetServer();
}
game.setScreen(new HostScreen(game, client, server));
}
}
示例15: render
import com.badlogic.gdx.graphics.GL30; //导入依赖的package包/类
/**------------------------RENDER------------------------**/
@Override
public void render(float f)
{
//Debug
//stage.setDebugAll(true);
//Clear Screen
Gdx.gl.glClearColor(0.2f, 0.2f, 0.2f, 1);
Gdx.gl.glClear(GL30.GL_COLOR_BUFFER_BIT);
//Set background image
rootTable.background(new TextureRegionDrawable(new TextureRegion(TextureManager.menuBackground)));
//Render stage
stage.act(Constants.DELTATIME);
stage.draw();
/*------------------SWITCH TO FULLSCREEN AND BACK------------------*/
super.changeToFullScreenOnF12();
/*------------------QUIT GAME------------------*/
if (Gdx.input.isKeyPressed(Input.Keys.ESCAPE))
{
game.setScreen(new MenuScreen(game, client, server));
}
/*------------------JOIN GAME WITH ENTER------------------*/
if(Gdx.input.isKeyJustPressed(Input.Keys.ENTER))
{
ChangeEvent event1 = new ChangeEvent();
joinButton.fire(event1);
}
}