Package com.badlogic.gdx.graphics

Examples of com.badlogic.gdx.graphics.GL11


    if (isBound) {
      if (Gdx.gl20 != null) {
        GL20 gl = Gdx.gl20;
        gl.glBufferSubData(GL20.GL_ARRAY_BUFFER, 0, byteBuffer.limit(), byteBuffer);
      } else {
        GL11 gl = Gdx.gl11;
        gl.glBufferSubData(GL11.GL_ARRAY_BUFFER, 0, byteBuffer.limit(), byteBuffer);
      }
      isDirty = false;
    }
  }
View Full Code Here


  }

  /** {@inheritDoc} */
  @Override
  public void bind () {
    GL11 gl = Gdx.gl11;

    gl.glBindBuffer(GL11.GL_ARRAY_BUFFER, bufferHandle);
    if (isDirty) {
      byteBuffer.limit(buffer.limit() * 4);
      gl.glBufferSubData(GL11.GL_ARRAY_BUFFER, 0, byteBuffer.limit(), byteBuffer);
// gl.glBufferData(GL11.GL_ARRAY_BUFFER, byteBuffer.limit(),
// byteBuffer, usage);
      isDirty = false;
    }

    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:
        gl.glEnableClientState(GL11.GL_VERTEX_ARRAY);
        gl.glVertexPointer(attribute.numComponents, GL10.GL_FLOAT, attributes.vertexSize, attribute.offset);
        break;

      case Usage.Color:
      case Usage.ColorPacked:
        int colorType = GL10.GL_FLOAT;
        if (attribute.usage == Usage.ColorPacked) colorType = GL11.GL_UNSIGNED_BYTE;

        gl.glEnableClientState(GL10.GL_COLOR_ARRAY);
        gl.glColorPointer(attribute.numComponents, colorType, attributes.vertexSize, attribute.offset);
        break;

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

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

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

    isBound = true;
  }

  @Override
  public void unbind () {
    GL11 gl = Gdx.gl11;
    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 also 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);
      }
    }

    gl.glBindBuffer(GL11.GL_ARRAY_BUFFER, 0);
    isBound = false;
  }
View Full Code Here

      bufferHandle = 0;
    } else {
      tmpHandle.clear();
      tmpHandle.put(bufferHandle);
      tmpHandle.flip();
      GL11 gl = Gdx.gl11;
      gl.glBindBuffer(GL11.GL_ARRAY_BUFFER, 0);
      gl.glDeleteBuffers(1, tmpHandle);
      bufferHandle = 0;
    }
  }
View Full Code Here

    if (isBound) {
      if (Gdx.gl20 != null) {
        GL20 gl = Gdx.gl20;
        gl.glBufferData(GL20.GL_ARRAY_BUFFER, byteBuffer.limit(), byteBuffer, usage);
      } else {
        GL11 gl = Gdx.gl11;
        gl.glBufferData(GL11.GL_ARRAY_BUFFER, byteBuffer.limit(), byteBuffer, usage);
      }
      isDirty = false;
    }
  }
View Full Code Here

  }

  /** {@inheritDoc} */
  @Override
  public void bind () {
    GL11 gl = Gdx.gl11;

    gl.glBindBuffer(GL11.GL_ARRAY_BUFFER, bufferHandle);
    if (isDirty) {
      byteBuffer.limit(buffer.limit() * 4);
      gl.glBufferData(GL11.GL_ARRAY_BUFFER, byteBuffer.limit(), byteBuffer, usage);
      isDirty = false;
    }

    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:
        gl.glEnableClientState(GL11.GL_VERTEX_ARRAY);
        gl.glVertexPointer(attribute.numComponents, GL10.GL_FLOAT, attributes.vertexSize, attribute.offset);
        break;

      case Usage.Color:
      case Usage.ColorPacked:
        int colorType = GL10.GL_FLOAT;
        if (attribute.usage == Usage.ColorPacked) colorType = GL11.GL_UNSIGNED_BYTE;

        gl.glEnableClientState(GL10.GL_COLOR_ARRAY);
        gl.glColorPointer(attribute.numComponents, colorType, attributes.vertexSize, attribute.offset);
        break;

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

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

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

    isBound = true;
  }

  @Override
  public void unbind () {
    GL11 gl = Gdx.gl11;
    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 also 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);
      }
    }

    gl.glBindBuffer(GL11.GL_ARRAY_BUFFER, 0);
    isBound = false;
  }
View Full Code Here

      bufferHandle = 0;
    } else {
      tmpHandle.clear();
      tmpHandle.put(bufferHandle);
      tmpHandle.flip();
      GL11 gl = Gdx.gl11;
      gl.glBindBuffer(GL11.GL_ARRAY_BUFFER, 0);
      gl.glDeleteBuffers(1, tmpHandle);
      bufferHandle = 0;
    }
    BufferUtils.disposeUnsafeByteBuffer(byteBuffer);
  }
View Full Code Here

  }

  /** {@inheritDoc} */
  @Override
  public void unbind () {
    GL11 gl = Gdx.gl11;
    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 also 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);
      }
    }

    gl.glBindBuffer(GL11.GL_ARRAY_BUFFER, 0);
    isBound = false;
  }
View Full Code Here

      bufferHandle = 0;
    } else {
      tmpHandle.clear();
      tmpHandle.put(bufferHandle);
      tmpHandle.flip();
      GL11 gl = Gdx.gl11;
      gl.glBindBuffer(GL11.GL_ARRAY_BUFFER, 0);
      gl.glDeleteBuffers(1, tmpHandle);
      bufferHandle = 0;
    }
  }
View Full Code Here

TOP

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

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.