Example usage for org.lwjgl.opengl GL11 GL_ZERO

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

Introduction

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

Prototype

int GL_ZERO

To view the source code for org.lwjgl.opengl GL11 GL_ZERO.

Click Source Link

Document

BlendingFactorDest

Usage

From source file:a1.gui.GUI_Map.java

License:Open Source License

public void RenderLightMap() {
    GL11.glBlendFunc(GL11.GL_ZERO, GL11.GL_SRC_COLOR);
    //Log.info("lightmap: "+LightMap);
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, LightMap); //Resource.textures.get("core_skin").getTextureID());

    GL11.glTranslatef(0, 0, 0);/* w w  w .  jav  a  2s  . c  o m*/
    GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);

    float texwidth = 1024;
    float texheight = 1024;

    float newTextureOffsetX = 0 / texwidth;
    float newTextureOffsetY = 0 / texheight;
    float newTextureWidth = 1024 / texwidth;
    float newTextureHeight = 1024 / texheight;

    int w = 1024;
    int h = 1024;

    GL11.glBegin(GL11.GL_QUADS);
    {
        glTexCoord2f(newTextureOffsetX, newTextureOffsetY);
        glVertex2i(0, 0);

        glTexCoord2f(newTextureOffsetX, newTextureOffsetY + newTextureHeight);
        glVertex2i(0, h);

        glTexCoord2f(newTextureOffsetX + newTextureWidth, newTextureOffsetY + newTextureHeight);
        glVertex2i(w, h);

        glTexCoord2f(newTextureOffsetX + newTextureWidth, newTextureOffsetY);
        glVertex2i(w, 0);
    }

    GL11.glEnd();

    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
}

From source file:com.a2client.corex.Render.java

License:Open Source License

static public void setBlendType(Const.BLEND_TYPE v) {
    //        GL11.glDisable(GL11.GL_BLEND);
    if (blend_type != v) {
        if (blend_type == Const.BLEND_TYPE.btNone)
            GL11.glEnable(GL11.GL_BLEND);
        blend_type = v;//w  ww.j  ava  2s  .  c  om
        switch (v) {
        case btNormal:
            GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
            break;
        case btAdd:
            GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
            break;
        case btMult:
            GL11.glBlendFunc(GL11.GL_ZERO, GL11.GL_SRC_COLOR);
            break;
        default:
            GL11.glDisable(GL11.GL_BLEND);
        }
    }
}

From source file:com.ardor3d.renderer.lwjgl.LwjglRenderer.java

License:Open Source License

public void applyNormalsMode(final NormalsMode normalsMode, final ReadOnlyTransform worldTransform) {
    final RenderContext context = ContextManager.getCurrentContext();
    final RendererRecord rendRecord = context.getRendererRecord();
    if (normalsMode != NormalsMode.Off) {
        final ContextCapabilities caps = context.getCapabilities();
        switch (normalsMode) {
        case NormalizeIfScaled:
            if (worldTransform.isRotationMatrix()) {
                final ReadOnlyVector3 scale = worldTransform.getScale();
                if (!(scale.getX() == 1.0 && scale.getY() == 1.0 && scale.getZ() == 1.0)) {
                    if (scale.getX() == scale.getY() && scale.getY() == scale.getZ()
                            && caps.isOpenGL1_2Supported()
                            && rendRecord.getNormalMode() != GL12.GL_RESCALE_NORMAL) {
                        if (rendRecord.getNormalMode() == GL11.GL_NORMALIZE) {
                            GL11.glDisable(GL11.GL_NORMALIZE);
                        }/*w w  w. jav a 2s.c  o  m*/
                        GL11.glEnable(GL12.GL_RESCALE_NORMAL);
                        rendRecord.setNormalMode(GL12.GL_RESCALE_NORMAL);
                    } else if (rendRecord.getNormalMode() != GL11.GL_NORMALIZE) {
                        if (rendRecord.getNormalMode() == GL12.GL_RESCALE_NORMAL) {
                            GL11.glDisable(GL12.GL_RESCALE_NORMAL);
                        }
                        GL11.glEnable(GL11.GL_NORMALIZE);
                        rendRecord.setNormalMode(GL11.GL_NORMALIZE);
                    }
                } else {
                    if (rendRecord.getNormalMode() == GL12.GL_RESCALE_NORMAL) {
                        GL11.glDisable(GL12.GL_RESCALE_NORMAL);
                    } else if (rendRecord.getNormalMode() == GL11.GL_NORMALIZE) {
                        GL11.glDisable(GL11.GL_NORMALIZE);
                    }
                    rendRecord.setNormalMode(GL11.GL_ZERO);
                }
            } else {
                if (!worldTransform.getMatrix().isIdentity()) {
                    // *might* be scaled...
                    if (rendRecord.getNormalMode() != GL11.GL_NORMALIZE) {
                        if (rendRecord.getNormalMode() == GL12.GL_RESCALE_NORMAL) {
                            GL11.glDisable(GL12.GL_RESCALE_NORMAL);
                        }
                        GL11.glEnable(GL11.GL_NORMALIZE);
                        rendRecord.setNormalMode(GL11.GL_NORMALIZE);
                    }
                } else {
                    // not scaled
                    if (rendRecord.getNormalMode() == GL12.GL_RESCALE_NORMAL) {
                        GL11.glDisable(GL12.GL_RESCALE_NORMAL);
                    } else if (rendRecord.getNormalMode() == GL11.GL_NORMALIZE) {
                        GL11.glDisable(GL11.GL_NORMALIZE);
                    }
                    rendRecord.setNormalMode(GL11.GL_ZERO);
                }
            }
            break;
        case AlwaysNormalize:
            if (rendRecord.getNormalMode() != GL11.GL_NORMALIZE) {
                if (rendRecord.getNormalMode() == GL12.GL_RESCALE_NORMAL) {
                    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
                }
                GL11.glEnable(GL11.GL_NORMALIZE);
                rendRecord.setNormalMode(GL11.GL_NORMALIZE);
            }
            break;
        case UseProvided:
        default:
            if (rendRecord.getNormalMode() == GL12.GL_RESCALE_NORMAL) {
                GL11.glDisable(GL12.GL_RESCALE_NORMAL);
            } else if (rendRecord.getNormalMode() == GL11.GL_NORMALIZE) {
                GL11.glDisable(GL11.GL_NORMALIZE);
            }
            rendRecord.setNormalMode(GL11.GL_ZERO);
            break;
        }
    } else {
        if (rendRecord.getNormalMode() == GL12.GL_RESCALE_NORMAL) {
            GL11.glDisable(GL12.GL_RESCALE_NORMAL);
        } else if (rendRecord.getNormalMode() == GL11.GL_NORMALIZE) {
            GL11.glDisable(GL11.GL_NORMALIZE);
        }
        rendRecord.setNormalMode(GL11.GL_ZERO);
    }
}

From source file:com.ardor3d.scene.state.lwjgl.LwjglBlendStateUtil.java

License:Open Source License

protected static int getGLSrcValue(final SourceFunction function, final ContextCapabilities caps) {
    switch (function) {
    case Zero://from  w  w w .java2s  .com
        return GL11.GL_ZERO;
    case DestinationColor:
        return GL11.GL_DST_COLOR;
    case OneMinusDestinationColor:
        return GL11.GL_ONE_MINUS_DST_COLOR;
    case SourceAlpha:
        return GL11.GL_SRC_ALPHA;
    case OneMinusSourceAlpha:
        return GL11.GL_ONE_MINUS_SRC_ALPHA;
    case DestinationAlpha:
        return GL11.GL_DST_ALPHA;
    case OneMinusDestinationAlpha:
        return GL11.GL_ONE_MINUS_DST_ALPHA;
    case SourceAlphaSaturate:
        return GL11.GL_SRC_ALPHA_SATURATE;
    case ConstantColor:
        if (caps.isConstantBlendColorSupported()) {
            return EXTBlendColor.GL_CONSTANT_COLOR_EXT;
        }
        // FALLS THROUGH
    case OneMinusConstantColor:
        if (caps.isConstantBlendColorSupported()) {
            return EXTBlendColor.GL_ONE_MINUS_CONSTANT_COLOR_EXT;
        }
        // FALLS THROUGH
    case ConstantAlpha:
        if (caps.isConstantBlendColorSupported()) {
            return EXTBlendColor.GL_CONSTANT_ALPHA_EXT;
        }
        // FALLS THROUGH
    case OneMinusConstantAlpha:
        if (caps.isConstantBlendColorSupported()) {
            return EXTBlendColor.GL_ONE_MINUS_CONSTANT_ALPHA_EXT;
        }
        // FALLS THROUGH
    case One:
        return GL11.GL_ONE;
    }
    throw new IllegalArgumentException("Invalid source function type: " + function);
}

From source file:com.ardor3d.scene.state.lwjgl.LwjglBlendStateUtil.java

License:Open Source License

protected static int getGLDstValue(final DestinationFunction function, final ContextCapabilities caps) {
    switch (function) {
    case Zero://from  w  w w. j a va  2  s .  c om
        return GL11.GL_ZERO;
    case SourceColor:
        return GL11.GL_SRC_COLOR;
    case OneMinusSourceColor:
        return GL11.GL_ONE_MINUS_SRC_COLOR;
    case SourceAlpha:
        return GL11.GL_SRC_ALPHA;
    case OneMinusSourceAlpha:
        return GL11.GL_ONE_MINUS_SRC_ALPHA;
    case DestinationAlpha:
        return GL11.GL_DST_ALPHA;
    case OneMinusDestinationAlpha:
        return GL11.GL_ONE_MINUS_DST_ALPHA;
    case ConstantColor:
        if (caps.isConstantBlendColorSupported()) {
            return EXTBlendColor.GL_CONSTANT_COLOR_EXT;
        }
        // FALLS THROUGH
    case OneMinusConstantColor:
        if (caps.isConstantBlendColorSupported()) {
            return EXTBlendColor.GL_ONE_MINUS_CONSTANT_COLOR_EXT;
        }
        // FALLS THROUGH
    case ConstantAlpha:
        if (caps.isConstantBlendColorSupported()) {
            return EXTBlendColor.GL_CONSTANT_ALPHA_EXT;
        }
        // FALLS THROUGH
    case OneMinusConstantAlpha:
        if (caps.isConstantBlendColorSupported()) {
            return EXTBlendColor.GL_ONE_MINUS_CONSTANT_ALPHA_EXT;
        }
        // FALLS THROUGH
    case One:
        return GL11.GL_ONE;
    }
    throw new IllegalArgumentException("Invalid destination function type: " + function);
}

From source file:com.ardor3d.scene.state.lwjgl.LwjglStencilStateUtil.java

License:Open Source License

private static int getGLStencilOp(final StencilOperation operation, final ContextCapabilities caps) {
    switch (operation) {
    case Keep:// w  w w  .java2s  . co m
        return GL11.GL_KEEP;
    case DecrementWrap:
        if (caps.isStencilWrapSupported()) {
            return EXTStencilWrap.GL_DECR_WRAP_EXT;
        }
        // FALLS THROUGH
    case Decrement:
        return GL11.GL_DECR;
    case IncrementWrap:
        if (caps.isStencilWrapSupported()) {
            return EXTStencilWrap.GL_INCR_WRAP_EXT;
        }
        // FALLS THROUGH
    case Increment:
        return GL11.GL_INCR;
    case Invert:
        return GL11.GL_INVERT;
    case Replace:
        return GL11.GL_REPLACE;
    case Zero:
        return GL11.GL_ZERO;
    }
    throw new IllegalArgumentException("unknown operation: " + operation);
}

From source file:com.builtbroken.atomic.content.items.cell.RendererItemCell.java

protected void preRender() {
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);
}

From source file:com.builtbroken.atomic.content.items.cell.RendererItemCell.java

protected void postRender() {
    OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);
}

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

public int factorToGlConstant(BlendMode.Factor blendFactor) {

    switch (blendFactor) {
    case Zero:// ww  w.  j av  a2s.co m
        return GL11.GL_ZERO;
    case One:
        return GL11.GL_ONE;
    case SrcColor:
        return GL11.GL_SRC_COLOR;
    case OneMinusSrcColor:
        return GL11.GL_ONE_MINUS_SRC_COLOR;
    case DstColor:
        return GL11.GL_DST_COLOR;
    case OneMinusDstColor:
        return GL11.GL_ONE_MINUS_DST_COLOR;
    case SrcAlpha:
        return GL11.GL_SRC_ALPHA;
    case OneMinusSrcAlpha:
        return GL11.GL_ONE_MINUS_SRC_ALPHA;
    case DstAlpha:
        return GL11.GL_DST_ALPHA;
    case OneMinusDstAlpha:
        return GL11.GL_ONE_MINUS_DST_ALPHA;
    }

    return -1;

}

From source file:cuchaz.jfxgl.prism.JFXGLContext.java

License:Open Source License

private static int translateScaleFactor(int scaleFactor) {
    switch (scaleFactor) {
    case GLContext.GL_ZERO:
        return GL11.GL_ZERO;
    case GLContext.GL_ONE:
        return GL11.GL_ONE;
    case GLContext.GL_SRC_COLOR:
        return GL11.GL_SRC_COLOR;
    case GLContext.GL_ONE_MINUS_SRC_COLOR:
        return GL11.GL_ONE_MINUS_SRC_COLOR;
    case GLContext.GL_DST_COLOR:
        return GL11.GL_DST_COLOR;
    case GLContext.GL_ONE_MINUS_DST_COLOR:
        return GL11.GL_ONE_MINUS_DST_COLOR;
    case GLContext.GL_SRC_ALPHA:
        return GL11.GL_SRC_ALPHA;
    case GLContext.GL_ONE_MINUS_SRC_ALPHA:
        return GL11.GL_ONE_MINUS_SRC_ALPHA;
    case GLContext.GL_DST_ALPHA:
        return GL11.GL_DST_ALPHA;
    case GLContext.GL_ONE_MINUS_DST_ALPHA:
        return GL11.GL_ONE_MINUS_DST_ALPHA;
    case GLContext.GL_CONSTANT_COLOR:
        return GL14.GL_CONSTANT_COLOR;
    case GLContext.GL_ONE_MINUS_CONSTANT_COLOR:
        return GL14.GL_ONE_MINUS_CONSTANT_COLOR;
    case GLContext.GL_CONSTANT_ALPHA:
        return GL14.GL_CONSTANT_ALPHA;
    case GLContext.GL_ONE_MINUS_CONSTANT_ALPHA:
        return GL14.GL_ONE_MINUS_CONSTANT_ALPHA;
    case GLContext.GL_SRC_ALPHA_SATURATE:
        return GL11.GL_SRC_ALPHA_SATURATE;
    default:/*from w ww .  j  ava  2 s  .  c  o m*/
        // don't know what to do, just return zero
        return GL11.GL_ZERO;
    }
}