Package com.badlogic.gdx.graphics

Examples of com.badlogic.gdx.graphics.GL10


        mesh.render(shader, GL10.GL_TRIANGLES, 0, spritesInBatch * 6);
    } else {
      if (blendingDisabled) {
        Gdx.gl10.glDisable(GL10.GL_BLEND);
      } else {
        GL10 gl10 = Gdx.gl10;
        gl10.glEnable(GL10.GL_BLEND);
        gl10.glBlendFunc(blendSrcFunc, blendDstFunc);
      }
      mesh.render(GL10.GL_TRIANGLES, 0, spritesInBatch * 6);
    }

    idx = 0;
View Full Code Here


    if (drawing) setupMatrices();
  }

  private void setupMatrices () {
    if(!Gdx.graphics.isGL20Available()) {
      GL10 gl = Gdx.gl10;
      gl.glMatrixMode(GL10.GL_PROJECTION);
      gl.glLoadMatrixf(projectionMatrix.val, 0);
      gl.glMatrixMode(GL10.GL_MODELVIEW);
      gl.glLoadMatrixf(transformMatrix.val, 0);
    } else {
      combinedMatrix.set(projectionMatrix).mul(transformMatrix);
      if (customShader != null) {
        customShader.setUniformMatrix("u_proj", projectionMatrix);
        customShader.setUniformMatrix("u_trans", transformMatrix);
View Full Code Here

    if (drawing) setupMatrices();
  }

  private void setupMatrices () {
    if (!Gdx.graphics.isGL20Available()) {
      GL10 gl = Gdx.gl10;
      gl.glMatrixMode(GL10.GL_PROJECTION);
      gl.glLoadMatrixf(projectionMatrix.val, 0);
      gl.glMatrixMode(GL10.GL_MODELVIEW);
      gl.glLoadMatrixf(transformMatrix.val, 0);
    } else {
      combinedMatrix.set(projectionMatrix).mul(transformMatrix);
      if (customShader != null) {
        customShader.setUniformMatrix("u_projTrans", combinedMatrix);
        customShader.setUniformi("u_texture", 0);
View Full Code Here

    if (drawing) setupMatrices();
  }

  private void setupMatrices () {
    if (!Gdx.graphics.isGL20Available()) {
      GL10 gl = Gdx.gl10;
      gl.glMatrixMode(GL10.GL_PROJECTION);
      gl.glLoadMatrixf(projectionMatrix.val, 0);
      gl.glMatrixMode(GL10.GL_MODELVIEW);
      gl.glLoadMatrixf(transformMatrix.val, 0);
    } else {
      combinedMatrix.set(projectionMatrix).mul(transformMatrix);
      if (customShader != null) {
        customShader.setUniformMatrix("u_projTrans", combinedMatrix);
        customShader.setUniformi("u_texture", 0);
View Full Code Here

  /** Prepares the OpenGL state for SpriteCache rendering. */
  public void begin () {
    if (drawing) throw new IllegalStateException("end must be called before begin.");

    if (Gdx.graphics.isGL20Available() == false) {
      GL10 gl = Gdx.gl10;
      gl.glDepthMask(false);
      gl.glEnable(GL10.GL_TEXTURE_2D);

      gl.glMatrixMode(GL10.GL_PROJECTION);
      gl.glLoadMatrixf(projectionMatrix.val, 0);
      gl.glMatrixMode(GL10.GL_MODELVIEW);
      gl.glLoadMatrixf(transformMatrix.val, 0);

      mesh.bind();
    } else {
      combinedMatrix.set(projectionMatrix).mul(transformMatrix);

      GL20 gl = Gdx.gl20;
      gl.glDepthMask(false);

      if (customShader != null) {
        customShader.begin();
        customShader.setUniformMatrix("u_proj", projectionMatrix);
        customShader.setUniformMatrix("u_trans", transformMatrix);
View Full Code Here

  public void end () {
    if (!drawing) throw new IllegalStateException("begin must be called before end.");
    drawing = false;

    if (Gdx.graphics.isGL20Available() == false) {
      GL10 gl = Gdx.gl10;
      gl.glDepthMask(true);
      gl.glDisable(GL10.GL_TEXTURE_2D);
      mesh.unbind();
    } else {
      shader.end();
      GL20 gl = Gdx.gl20;
      gl.glDepthMask(true);
      if(customShader != null) mesh.unbind(customShader);
      else mesh.unbind(shader);
    }
  }
View Full Code Here

    buffer.limit(count);
  }

  @Override
  public void bind () {
    GL10 gl = Gdx.gl10;
    int textureUnit = 0;
    int numAttributes = attributes.size();

    byteBuffer.limit(buffer.limit() * 4);

    for (int i = 0; i < numAttributes; i++) {
      VertexAttribute attribute = attributes.get(i);

      switch (attribute.usage) {
      case Usage.Position:
        byteBuffer.position(attribute.offset);
        gl.glEnableClientState(GL11.GL_VERTEX_ARRAY);
        gl.glVertexPointer(attribute.numComponents, GL10.GL_FLOAT, attributes.vertexSize, byteBuffer);
        break;

      case Usage.Color:
      case Usage.ColorPacked:
        int colorType = GL10.GL_FLOAT;
        if (attribute.usage == Usage.ColorPacked) colorType = GL11.GL_UNSIGNED_BYTE;
        byteBuffer.position(attribute.offset);
        gl.glEnableClientState(GL10.GL_COLOR_ARRAY);
        gl.glColorPointer(attribute.numComponents, colorType, attributes.vertexSize, byteBuffer);
        break;

      case Usage.Normal:
        byteBuffer.position(attribute.offset);
        gl.glEnableClientState(GL10.GL_NORMAL_ARRAY);
        gl.glNormalPointer(GL10.GL_FLOAT, attributes.vertexSize, byteBuffer);
        break;

      case Usage.TextureCoordinates:
        gl.glClientActiveTexture(GL10.GL_TEXTURE0 + textureUnit);
        gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
        byteBuffer.position(attribute.offset);
        gl.glTexCoordPointer(attribute.numComponents, GL10.GL_FLOAT, attributes.vertexSize, byteBuffer);
        textureUnit++;
        break;

      default:
        // throw new GdxRuntimeException("unkown vertex attribute type: " + attribute.usage);
View Full Code Here

    isBound = true;
  }

  @Override
  public void unbind () {
    GL10 gl = Gdx.gl10;
    int textureUnit = 0;
    int numAttributes = attributes.size();

    for (int i = 0; i < numAttributes; i++) {

      VertexAttribute attribute = attributes.get(i);
      switch (attribute.usage) {
      case Usage.Position:
        break; // no-op, we always need a position bound in gles
      case Usage.Color:
      case Usage.ColorPacked:
        gl.glDisableClientState(GL11.GL_COLOR_ARRAY);
        break;
      case Usage.Normal:
        gl.glDisableClientState(GL11.GL_NORMAL_ARRAY);
        break;
      case Usage.TextureCoordinates:
        gl.glClientActiveTexture(GL11.GL_TEXTURE0 + textureUnit);
        gl.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY);
        textureUnit++;
        break;
      default:
        // throw new GdxRuntimeException("unkown vertex attribute type: " + attribute.usage);
      }
View Full Code Here

    if (drawing) setupMatrices();
  }

  private void setupMatrices () {
    if (!Gdx.graphics.isGL20Available()) {
      GL10 gl = Gdx.gl10;
      gl.glMatrixMode(GL10.GL_PROJECTION);
      gl.glLoadMatrixf(projectionMatrix.val, 0);
      gl.glMatrixMode(GL10.GL_MODELVIEW);
      gl.glLoadMatrixf(transformMatrix.val, 0);
    } else {
      combinedMatrix.set(projectionMatrix).mul(transformMatrix);
      if (customShader != null) {
        customShader.setUniformMatrix("u_proj", projectionMatrix);
        customShader.setUniformMatrix("u_trans", transformMatrix);
View Full Code Here

TOP

Related Classes of com.badlogic.gdx.graphics.GL10

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.