Example usage for org.lwjgl.opengl GL11 glGenTextures

List of usage examples for org.lwjgl.opengl GL11 glGenTextures

Introduction

In this page you can find the example usage for org.lwjgl.opengl GL11 glGenTextures.

Prototype

@NativeType("void")
public static int glGenTextures() 

Source Link

Document

Returns n previously unused texture names in textures.

Usage

From source file:ar.com.quark.backend.lwjgl.opengl.DesktopGLES20.java

License:Apache License

/**
 * {@inheritDoc}
 */
@Override
public int glGenTextures() {
    return GL11.glGenTextures();
}

From source file:com.adavr.player.globjects.Texture.java

License:Open Source License

public static Texture create(int internalFormat, int width, int height, int format, int type,
        ByteBuffer pixels) {//from w  ww  .  j a v  a 2s .  c o m
    int id = GL11.glGenTextures();
    int target = GL11.GL_TEXTURE_2D;

    GL11.glBindTexture(target, id);

    GL11.glTexImage2D(target, 0, internalFormat, width, height, 0, format, type, pixels);

    GL11.glTexParameteri(target, GL11.GL_TEXTURE_WRAP_S, GL12.GL_CLAMP_TO_EDGE);
    GL11.glTexParameteri(target, GL11.GL_TEXTURE_WRAP_T, GL12.GL_CLAMP_TO_EDGE);

    GL11.glTexParameteri(target, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
    GL11.glTexParameteri(target, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);

    return new Texture(id, target);
}

From source file:com.auroraengine.opengl.GLTexture.java

License:Open Source License

@Override
public void create() throws GLException {
    if (tex_ref == 0) {
        tex_ref = GL11.glGenTextures();
        update();
    }
}

From source file:com.badlogic.gdx.backends.lwjgl.LwjglGL10.java

License:Apache License

public final void glGenTextures(int n, int[] textures, int offset) {
    for (int i = offset; i < offset + n; i++)
        textures[i] = GL11.glGenTextures();
}

From source file:com.badlogic.gdx.backends.lwjgl.LwjglGL20.java

License:Apache License

public int glGenTexture() {
    return GL11.glGenTextures();
}

From source file:com.dinasgames.engine.graphics.Texture.java

public boolean create(int width, int height) {

    if (width == 0 && height == 0) {
        return false;
    }//from  w  w w.  java 2 s  .c o m

    Vector2i actualSize = new Vector2i(getValidSize(width), getValidSize(height));

    int maxSize = getMaximumSize();
    if ((actualSize.x > maxSize) || (actualSize.y > maxSize)) {
        System.out.println("Failed to create texture, its internal size is too high (" + actualSize.x + ", "
                + actualSize.y + ") maximum is (" + maxSize + ", " + maxSize + ")");
        return false;
    }

    mWidth = width;
    mHeight = height;
    mActualWidth = actualSize.x;
    mActualHeight = actualSize.y;
    mPixelsFlipped = false;

    if (mTexture <= 0) {
        mTexture = GL11.glGenTextures();
    }

    int textureEdgeClamp = GL.clampToEdge();

    GL11.glBindTexture(GL11.GL_TEXTURE_2D, mTexture);
    GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, mActualWidth, mActualHeight, 0, GL11.GL_RGBA,
            GL11.GL_UNSIGNED_BYTE, 0);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S,
            (mRepeated ? GL11.GL_REPEAT : textureEdgeClamp));
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T,
            (mRepeated ? GL11.GL_REPEAT : textureEdgeClamp));
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER,
            (mSmooth ? GL11.GL_LINEAR : GL11.GL_NEAREST));
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER,
            (mSmooth ? GL11.GL_LINEAR : GL11.GL_NEAREST));
    mCacheId = getUniqueId();

    return true;

}

From source file:com.flowpowered.caustic.lwjgl.gl20.GL20Texture.java

License:MIT License

@Override
public void create() {
    checkNotCreated();//from   w w  w.j  ava  2 s  . c om
    // Generate the texture
    id = GL11.glGenTextures();
    // Update the state
    super.create();
    // Check for errors
    LWJGLUtil.checkForGLError();
}

From source file:com.github.kajdreef.mazerunnermvn.Object.GameObject.java

protected void setTextureUnit(Texture texture, int textureUnit) {
    // Create a new texture object in memory and bind it
    texId = GL11.glGenTextures();
    GL13.glActiveTexture(textureUnit);//from w ww  .  j a v  a  2s.  co  m
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, texId);

    // All RGB bytes are aligned to each other and each component is 1 byte
    GL11.glPixelStorei(GL11.GL_UNPACK_ALIGNMENT, 1);

    // Upload the texture data and generate mip maps (for scaling)
    GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGB, texture.getWidth(), texture.getHeight(), 0,
            GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, texture.getTexBuffer());
    GL30.glGenerateMipmap(GL11.GL_TEXTURE_2D);

    // Setup the ST coordinate system
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_REPEAT);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_REPEAT);

    // Setup what to do when the texture has to be scaled
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR_MIPMAP_LINEAR);
}

From source file:com.google.gapid.glviewer.gl.Texture.java

License:Apache License

Texture(Renderer owner, int target) {
    super(owner);
    this.target = target;
    this.handle = GL11.glGenTextures();
    owner.register(this);
}

From source file:com.google.gapid.glviewer.gl.Util.java

License:Apache License

public static int createTexture() {
    return GL11.glGenTextures();
}