Java 类com.badlogic.gdx.graphics.GL30 实例源码

项目:Space-Bombs    文件:HelpScreen.java   
/**------------------------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));
    }
}
项目:Space-Bombs    文件:MenuScreen.java   
/**------------------------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();

}
项目:Space-Bombs    文件:HostSettingsScreen1.java   
/**------------------------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));
        }
    }
项目:Argent    文件:Terrain.java   
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;
}
项目:Argent    文件:LandscapeWorldActor.java   
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);
}
项目:fabulae    文件:WeatherParticleEmitter.java   
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);
}
项目:fabulae    文件:GameMapScreen.java   
@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();
}
项目:Mundus    文件:BasePicker.java   
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;
}
项目:ForgE    文件:DepthShader.java   
@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);
  }

}
项目:ForgE    文件:TerrainBuilder.java   
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;
  }
}
项目:ForgE    文件:TerrainBuilder.java   
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;
  }
}
项目:javacup    文件:VersusScreen.java   
@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();
}
项目:Space-Bombs    文件:OptionScreen.java   
/**------------------------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));
    }
}
项目:Space-Bombs    文件:HostSettingsScreen.java   
/**------------------------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));
        }
    }
项目:Space-Bombs    文件:JoinScreen.java   
/**------------------------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);
    }
}
项目:Space-Bombs    文件:WinnerScreen.java   
/**------------------------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))
    {
        if(isWinner)
        {
            AudioManager.getCurrentMusic().stop();
        }else
        {
            AudioManager.getCurrentMusic().stop();
        }

        server.stopServer();
        game.setScreen(new MenuScreen(game, client, server));
    }
}
项目:Argent    文件:Terrain.java   
@Override
public void getRenderables(Array<Renderable> renderables, Pool<Renderable> pool) {
    if (Gdx.input.isKeyJustPressed(Input.Keys.N)) {
        heightData[MathUtils.random(0, heightData.length-1)] = MathUtils.random(0, 1024);
        update();
    }
    modelInstance.nodes.forEach(n -> n.parts.forEach(p -> p.meshPart.primitiveType = GL30.GL_LINES));
    modelInstance.getRenderables(renderables, pool);
}
项目:Argent    文件:WorldObjectCharacter.java   
public static WorldObjectCharacter createDefaultPlayerCharacter(GameWorld.Generic world) {
    modelBuilder.begin();
    MeshPartBuilder builder = modelBuilder.part("player_body", GL30.GL_TRIANGLES, VertexAttributes.Usage.Position | VertexAttributes.Usage.Normal | VertexAttributes.Usage.TextureCoordinates, Reference.Defaults.Models.material());
    CapsuleShapeBuilder.build(builder, 75, 500, 64);
    WorldObject obj = new WorldObject(world, new ModelInstance(modelBuilder.end()));
    if(world instanceof GameWorld.Physics) {
        world.addInstance(new BulletEntity<>(world, obj.transform(), obj));
    }else{
        world.addInstance(obj);
    }
    return new WorldObjectCharacter(obj);
}
项目:origin    文件:DepthFrameBuffer.java   
/**
 * старый но! рабочий код) создания текстуры для буфера глубины. оставлен для истории
 */
@Deprecated
public void createDepthTextre(Texture.TextureFilter filter, Texture.TextureWrap wrap)
{
    // сначала биндим наш буфер
    gl.glBindFramebuffer(GL20.GL_FRAMEBUFFER, getFramebufferHandle());

    // создаем текстуру
    _depthTexture = gl.glGenTexture();
    // биндим ее
    gl.glBindTexture(GL11.GL_TEXTURE_2D, _depthTexture);
    gl.glTexImage2D(
            GL11.GL_TEXTURE_2D, 0,
            GL14.GL_DEPTH_COMPONENT16, width, height,
            0, GL11.GL_DEPTH_COMPONENT, GL11.GL_FLOAT, null);
    // сделаем сглаживание
    gl.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, filter.getGLEnum());
    gl.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, filter.getGLEnum());
    gl.glTexParameteri(GL11.GL_TEXTURE_2D, GL20.GL_TEXTURE_WRAP_S, wrap.getGLEnum());
    gl.glTexParameteri(GL11.GL_TEXTURE_2D, GL20.GL_TEXTURE_WRAP_T, wrap.getGLEnum());
    // связываем нашу текстуру с буфером
    gl.glFramebufferTexture2D(GL20.GL_FRAMEBUFFER, GL30.GL_DEPTH_ATTACHMENT,
                              GL20.GL_TEXTURE_2D,
                              _depthTexture, 0);

    // а вот тут может случится ата-та. т.к. надо знать ид буфера экрана. см код libgdx
    gl.glBindFramebuffer(GL20.GL_FRAMEBUFFER, 0);
}
项目:METRO    文件:Fill.java   
/**
 * Initializes the screen for drawing on it. It also stops the spriteBatch for a transparent background.
 * 
 * @param spriteBatch
 *            The sprite batch to draw on.
 */
private static void init(SpriteBatch spriteBatch)
{
    spriteBatch.end();
    Gdx.gl.glEnable(GL30.GL_BLEND);
    Gdx.gl.glBlendFunc(GL30.GL_SRC_ALPHA, GL30.GL_ONE_MINUS_SRC_ALPHA);

    __shapeRenderer.setProjectionMatrix(METRO.__camera.combined);
    __shapeRenderer.begin(ShapeType.Filled);
    __shapeRenderer.setColor(__r, __g, __b, __a);
}
项目:METRO    文件:Fill.java   
/**
 * Resets the screen and the spriteBatch to the default values so that METRO can use it normally. The drawing has finished at this point.
 * 
 * @param spriteBatch
 *            The sprite batch to draw on.
 */
private static void reset(SpriteBatch spriteBatch)
{
    __shapeRenderer.end();
    Gdx.gl.glDisable(GL30.GL_BLEND);
    spriteBatch.begin();
}
项目:METRO    文件:Draw.java   
/**
 * Initializes the screen for drawing on it. It also stops the spriteBatch for a transparent background.
 */
private static void init()
{
    METRO.__spriteBatch.end();
    Gdx.gl.glEnable(GL30.GL_BLEND);
    Gdx.gl.glBlendFunc(GL30.GL_SRC_ALPHA, GL30.GL_ONE_MINUS_SRC_ALPHA);

    if (__shapeRenderer == null)
    {
        __shapeRenderer = new ShapeRenderer();
    }
    __shapeRenderer.setProjectionMatrix(METRO.__camera.combined);
    __shapeRenderer.begin(ShapeType.Line);
    __shapeRenderer.setColor(__r, __g, __b, __a);
}
项目:METRO    文件:Draw.java   
/**
 * Resets the screen and the spriteBatch to the default values so that METRO can use it normally. The drawing has finished at this point.
 */
private static void reset()
{
    __shapeRenderer.end();
    Gdx.gl.glDisable(GL30.GL_BLEND);
    METRO.__spriteBatch.begin();
}
项目:METRO    文件:METRO.java   
/**
 * Initializes the rendering by clearing the screen and updating the control list.
 */
private void renderInit()
{
    Gdx.gl.glClearColor(1, 1, 1, 1);
    Gdx.gl.glClear(GL30.GL_COLOR_BUFFER_BIT);

}
项目:KittenMaxit    文件:Game.java   
@Override
public void render() {
    update(Gdx.graphics.getRawDeltaTime());

    Gdx.gl30.glClearColor(1, 1, 1, 1);
    Gdx.gl30.glClear(GL30.GL_COLOR_BUFFER_BIT | GL30.GL_DEPTH_BUFFER_BIT
            | (Gdx.graphics.getBufferFormat().coverageSampling ? GL30.GL_COVERAGE_BUFFER_BIT_NV : 0));

    Gdx.graphics.setCursor(cursor);

    if (state == 1) {
        if (!menu.equals(null)) {
            menu.render(mX, mY);
        }
    } else if (state == 2) {
        if (!singleplayer.equals(null)) {
            singleplayer.render(mX, mY);
        }
    } else if (state == 3) {
        if (!help.equals(null)) {
            help.render(mX, mY);
        }
    } else if (state == 4) {
        if (!options.equals(null)) {
            options.render(mX, mY);
        }
    } else if (state == 5) {
        if (!credits.equals(null)) {
            credits.render(mX, mY);
        }
    }
}
项目:ForgE    文件:TerrainShader.java   
@Override
public void beforeRender(VoxelChunkRenderable renderable) {
  if (BaseRenderable.haveTransparency(renderable.material)) {
    context.setBlending(true, GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
    context.setCullFace(GL30.GL_NONE);
  } else {
    context.setBlending(false, GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
    context.setCullFace(GL30.GL_BACK);
  }
}
项目:ForgE    文件:Default.java   
@Override
public void afterBegin() {
  context.setCullFace(GL30.GL_BACK);
  context.setBlending(false, GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
  context.setDepthMask(true);
  context.setDepthTest(GL30.GL_LEQUAL);
}
项目:ForgE    文件:SpriteShader.java   
@Override
public void beforeRender(SpriteRenderable renderable) {
  shader.setUniformi(UNIFORM_SPRITE_TEXTURE, context.textureBinder.bind(renderable.texture));

  context.setBlending(true, GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
  context.setCullFace(GL30.GL_BACK);
}
项目:ForgE    文件:ShaderPostProcessingStep.java   
@Override
public void run(RenderContext renderContext, LevelEnv env) {
  renderContext.begin(); {
    ForgE.fb.begin(targetFboName); {
      ForgE.graphics.clearAll(Color.CLEAR);// TODO change it using json
      shader.begin(ForgE.fb.getScreenCamera(), renderContext, env); {
        shader.render(ForgE.fb.getScreenQuad(), GL30.GL_TRIANGLE_STRIP);
      } shader.end();
    } ForgE.fb. end();
  } renderContext.end();
}
项目:ForgE    文件:CubemapSkybox.java   
private Renderable getRenderable() {
  if (renderable == null) {
    this.renderable           = new CubemapSkyboxRenderable();
    this.renderable.mesh      = buildMesh();

    renderable.primitiveType  = GL30.GL_TRIANGLE_STRIP;
    renderable.worldTransform.idt();
  }

  return renderable;
}
项目:ForgE    文件:SpriteRenderable.java   
public void build(BaseSprite3D sprite) {
  this.mesh             = sprite.getMesh();
  this.primitiveType    = GL30.GL_TRIANGLES;
  this.triangleCount    = 2;
  //this.haveTransparency = sprite.haveTransparency();
  this.texture          = sprite.getTexture();
  sprite.applyToMatrix(this.worldTransform);
}
项目:bladecoder-adventure-engine    文件:SceneList.java   
private TextureRegion createBgIcon(String atlas, String region) {
    TextureAtlas a = new TextureAtlas(
            Gdx.files.absolute(Ctx.project.getAssetPath() + Project.ATLASES_PATH + "/1/" + atlas + ".atlas"));
    AtlasRegion r = a.findRegion(region);

    if (r == null) {
        a.dispose();
        return null;
    }

    GLFrameBuffer.FrameBufferBuilder frameBufferBuilder = new GLFrameBuffer.FrameBufferBuilder(200,
            (int) (r.getRegionHeight() * 200f / r.getRegionWidth()));

    frameBufferBuilder.addColorTextureAttachment(GL30.GL_RGBA8, GL30.GL_RGBA, GL30.GL_UNSIGNED_BYTE);
    FrameBuffer fbo = frameBufferBuilder.build();

    SpriteBatch fboBatch = new SpriteBatch();
    fboBatch.setColor(Color.WHITE);
    OrthographicCamera camera = new OrthographicCamera();
    camera.setToOrtho(false, fbo.getWidth(), fbo.getHeight());
    fboBatch.setProjectionMatrix(camera.combined);

    Gdx.gl.glDisable(GL20.GL_SCISSOR_TEST);
    fbo.begin();
    fboBatch.begin();
    fboBatch.draw(r, 0, 0, fbo.getWidth(), fbo.getHeight());
    fboBatch.end();

    TextureRegion tex = ScreenUtils.getFrameBufferTexture(0, 0, fbo.getWidth(), fbo.getHeight());
    // tex.flip(false, true);

    fbo.end();
    Gdx.gl.glEnable(GL20.GL_SCISSOR_TEST);

    fbo.dispose();
    a.dispose();
    fboBatch.dispose();

    return tex;
}
项目:radial    文件:GameScreen.java   
@Override
  public void render(float delta) {
    float tpf = Math.min(0.25f, timer.tickSeconds());

    // TODO: need better way to set TPF
    context.getTransformMotionSystem().setTpf(tpf);
    context.getWorld().process();

    Gdx.gl.glClearColor(0, 0, 0, 1);
    Gdx.gl.glClear(GL30.GL_COLOR_BUFFER_BIT);

    SpriteBatch batch = context.getBatch();
    Camera camera = context.getCurrentCamera();
    camera.update();

    batch.setProjectionMatrix(camera.combined);
    batch.begin();
    // render
    context.getRenderSystem().process();
    batch.end();

    if (debugMode) {
      grid.render();
      context.getPhysicsSystem().debugRender(camera.combined);
    }

    // physics world step
    context.getPhysicsSystem().setTPF(tpf);
    context.getPhysicsSystem().step();
    context.getPhysicsSystem().process();

//    fpsLogger.log();
  }
项目:Escapy    文件:EscapyLightContainer.java   
private void setProgram(int p1, int p2, int p3, int p4) {
    batch.setBlendFunction(-1, -1);
    Gdx.gl30.glBlendFuncSeparate(p1,p2, p3, p4);
    Gdx.gl30.glBlendEquationSeparate(GL30.GL_FUNC_ADD, GL30.GL_FUNC_ADD);
}
项目:ZombieInvadersVR    文件:CardBoardGraphics.java   
@Override
public GL30 getGL30 () {
   return gl30;
}
项目:Space-Bombs    文件:StartScreen.java   
@Override
public void render(float f) 
{
    //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();

    if(flashingTimer >= endFlashingTimer)
    {
        if(pressAnyKey.isVisible())
        {
            pressAnyKey.setVisible(false);
        }else
        {
            pressAnyKey.setVisible(true);
        }
        flashingTimer = 0;
    }else
    {
        flashingTimer += Constants.DELTATIME;
    }

    if(inputHandler.isAnyKey() || hideTimer != 0)
    {
        pressAnyKey.setVisible(false);

        AudioManager.getCurrentMusic().dispose();

        if(hideTimer == 0)
        {
            //Add click sound
            Sound sound = AudioManager.getNormalExplosion();
            long id = sound.play();
            sound.setVolume(id, AudioManager.getSoundVolume() * Constants.NORMALBOMBEXPLOSIONMOD);
        }

        if(hideTimer >= endHideTimer)
        {
            game.setScreen(new MenuScreen(game, client, server));
        }else
        {
            hideTimer += Constants.DELTATIME;
        }
    }

    /*------------------SWITCH TO FULLSCREEN AND BACK------------------*/
    super.changeToFullScreenOnF12();

}
项目:Space-Bombs    文件:HostScreen.java   
/**------------------------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);

    try 
    {
        ipTextField.setText(client.getCurrentIp().getHostAddress());
    } catch (SocketException ex) 
    {
        ipTextField.setText("ERROR");
        ex.printStackTrace();
    } catch (NullPointerException e)
    {
        ipTextField.setText("No network");
    }

    checkCurrentPlayerCompatibility();

    p1Field.setVisible(false);
    p2Field.setVisible(false);
    p3Field.setVisible(false);
    p4Field.setVisible(false);

    for(int i=0; i < Server.getClientConnectionArraySize(); i++)
    {
        ClientConnection clientconnection = Server.getClient(i);

        //Who joined
        switch(clientconnection.getPlayerId())
        {
            case 1:
                p1Field.setVisible(true);
                break;

            case 2:
                p2Field.setVisible(true);
                break;

            case 3:
                p3Field.setVisible(true);
                break;

            case 4:
                p4Field.setVisible(true);
                break;
        }
    }

    //Draw stage
    stage.act(Constants.DELTATIME);
    stage.draw();

    /*------------------SWITCH TO FULLSCREEN AND BACK------------------*/
    super.changeToFullScreenOnF12();

    /*------------------QUIT GAME------------------*/
    if (Gdx.input.isKeyJustPressed(Input.Keys.ESCAPE))
    {
        server.stopServer();
        game.setScreen(new MenuScreen(game, client, server));
    }
}
项目:exterminate    文件:LwjglGraphics.java   
@Override
public GL30 getGL30 () {
    return gl30;
}
项目:Argent    文件:PointLight.java   
@Override
public void applyToShader(ShaderProgram program) {
    final int texNum = GL30.GL_MAX_TEXTURE_UNITS-2;
}
项目:fabulae    文件:WeatherParticleEmitter.java   
/**
 * Updates and draws the particles. This is slightly more efficient than
 * calling {@link #update(float)} and {@link #draw(Batch)} separately.
 */
public void draw(GameMap map, Batch batch, float delta) {
    accumulator += delta * 1000;
    if (accumulator < 1) {
        draw(map, batch);
        return;
    }
    int deltaMillis = (int) accumulator;
    accumulator -= deltaMillis;

    if (additive)
        batch.setBlendFunction(GL30.GL_SRC_ALPHA, GL30.GL_ONE);

    Particle[] particles = this.particles;
    boolean[] active = this.active;
    int activeCount = this.activeCount;
    for (int i = 0, n = maxParticleCount; i < n; i++) {
        if (active[i]) {
            Particle particle = particles[i];
            if (updateParticle(particle, delta, deltaMillis)) {
                tempVector.set(particle.getX() + particle.getOriginX(), particle.getY() + particle.getOriginY());
                map.projectToTiles(tempVector);
                if (map.shouldRenderTile((int) tempVector.x, (int) tempVector.y)) {
                    particle.draw(batch);
                }
            } else {
                active[i] = false;
                activeCount--;
            }
        }
    }
    this.activeCount = activeCount;

    if (additive)
        batch.setBlendFunction(GL30.GL_SRC_ALPHA, GL30.GL_ONE_MINUS_SRC_ALPHA);

    if (delayTimer < delay) {
        delayTimer += deltaMillis;
        return;
    }

    if (firstUpdate) {
        firstUpdate = false;
        addParticle();
    }

    if (durationTimer < duration)
        durationTimer += deltaMillis;
    else {
        restart();
    }

    emissionDelta += deltaMillis;
    float emissionTime = emission + emissionDiff * emissionValue.getScale(durationTimer / (float) duration);
    if (emissionTime > 0) {
        emissionTime = 1000 / emissionTime;
        if (emissionDelta >= emissionTime) {
            int emitCount = (int) (emissionDelta / emissionTime);
            emitCount = Math.min(emitCount, maxParticleCount - activeCount);
            emissionDelta -= emitCount * emissionTime;
            emissionDelta %= emissionTime;
            addParticles(emitCount);
        }
    }
    if (activeCount < minParticleCount)
        addParticles(minParticleCount - activeCount);
}