Package com.ardor3d.renderer

Examples of com.ardor3d.renderer.RenderContext


public abstract class LwjglColorMaskStateUtil {

    public static void apply(final ColorMaskState state) {
        // ask for the current state record
        final RenderContext context = ContextManager.getCurrentContext();
        final ColorMaskStateRecord record = (ColorMaskStateRecord) context.getStateRecord(StateType.ColorMask);
        context.setCurrentState(StateType.ColorMask, state);

        if (state.isEnabled()) {
            if (!record.isValid() || !record.is(state.getRed(), state.getGreen(), state.getBlue(), state.getAlpha())) {
                GL11.glColorMask(state.getRed(), state.getGreen(), state.getBlue(), state.getAlpha());
                record.set(state.getRed(), state.getGreen(), state.getBlue(), state.getAlpha());
View Full Code Here


        if (!shaderVariable.hasData()) {
            throw new IllegalArgumentException("shaderVariable has no data: " + shaderVariable.name + " type: "
                    + shaderVariable.getClass().getName());
        }

        final RenderContext context = ContextManager.getCurrentContext();
        final ContextCapabilities caps = context.getCapabilities();
        if (caps.isVBOSupported() && !useVBO) {
            renderer.unbindVBO();
        }

        final ShaderObjectsStateRecord record = (ShaderObjectsStateRecord) context.getStateRecord(StateType.GLSLShader);

        if (shaderVariable instanceof ShaderVariablePointerFloat) {
            updateShaderAttribute((ShaderVariablePointerFloat) shaderVariable, record, useVBO);
        } else if (shaderVariable instanceof ShaderVariablePointerFloatMatrix) {
            updateShaderAttribute((ShaderVariablePointerFloatMatrix) shaderVariable, record, useVBO);
View Full Code Here

    private static void updateShaderAttribute(final ShaderVariablePointerFloat variable,
            final ShaderObjectsStateRecord record, final boolean useVBO) {
        enableVertexAttribute(variable, record);
        if (useVBO) {
            final RenderContext context = ContextManager.getCurrentContext();
            final int vboId = LwjglRenderer.setupVBO(variable.data, context);
            LwjglRendererUtil.setBoundVBO(context.getRendererRecord(), vboId);
            ARBVertexProgram.glVertexAttribPointerARB(variable.variableID, variable.size, GL11.GL_FLOAT,
                    variable.normalized, variable.stride, 0);
        } else {
            variable.data.getBuffer().rewind();
            ARBVertexProgram.glVertexAttribPointerARB(variable.variableID, variable.size, variable.normalized,
View Full Code Here

    private static void updateShaderAttribute(final ShaderVariablePointerFloatMatrix variable,
            final ShaderObjectsStateRecord record, final boolean useVBO) {
        final int size = variable.size;
        final int length = variable.data.getBuffer().capacity() / size;
        final RenderContext context = ContextManager.getCurrentContext();
        int pos = 0;
        enableVertexAttribute(variable, record);
        for (int i = 0; i < size; i++) {
            pos = (i * length);
            if (useVBO) {
                final int vboId = LwjglRenderer.setupVBO(variable.data, context);
                LwjglRendererUtil.setBoundVBO(context.getRendererRecord(), vboId);
                ARBVertexProgram.glVertexAttribPointerARB(variable.variableID + i, size, GL11.GL_FLOAT,
                        variable.normalized, 0, pos);
            } else {
                variable.data.getBuffer().limit(pos + length - 1);
                variable.data.getBuffer().position(pos);
View Full Code Here

    private static void updateShaderAttribute(final ShaderVariablePointerByte variable,
            final ShaderObjectsStateRecord record, final boolean useVBO) {
        enableVertexAttribute(variable, record);
        if (useVBO) {
            final RenderContext context = ContextManager.getCurrentContext();
            final int vboId = LwjglRenderer.setupVBO(variable.data, context);
            LwjglRendererUtil.setBoundVBO(context.getRendererRecord(), vboId);
            ARBVertexProgram.glVertexAttribPointerARB(variable.variableID, variable.size,
                    variable.unsigned ? GL11.GL_UNSIGNED_BYTE : GL11.GL_BYTE, variable.normalized, variable.stride, 0);
        } else {
            variable.data.getBuffer().rewind();
            ARBVertexProgram.glVertexAttribPointerARB(variable.variableID, variable.size, variable.unsigned,
View Full Code Here

    private static void updateShaderAttribute(final ShaderVariablePointerInt variable,
            final ShaderObjectsStateRecord record, final boolean useVBO) {
        enableVertexAttribute(variable, record);
        if (useVBO) {
            final RenderContext context = ContextManager.getCurrentContext();
            final int vboId = LwjglRenderer.setupVBO(variable.data, context);
            LwjglRendererUtil.setBoundVBO(context.getRendererRecord(), vboId);
            ARBVertexProgram.glVertexAttribPointerARB(variable.variableID, variable.size,
                    variable.unsigned ? GL11.GL_UNSIGNED_INT : GL11.GL_INT, variable.normalized, variable.stride, 0);
        } else {
            variable.data.getBuffer().rewind();
            ARBVertexProgram.glVertexAttribPointerARB(variable.variableID, variable.size, variable.unsigned,
View Full Code Here

    private static void updateShaderAttribute(final ShaderVariablePointerShort variable,
            final ShaderObjectsStateRecord record, final boolean useVBO) {
        enableVertexAttribute(variable, record);
        if (useVBO) {
            final RenderContext context = ContextManager.getCurrentContext();
            final int vboId = LwjglRenderer.setupVBO(variable.data, context);
            LwjglRendererUtil.setBoundVBO(context.getRendererRecord(), vboId);
            ARBVertexProgram
                    .glVertexAttribPointerARB(variable.variableID, variable.size,
                            variable.unsigned ? GL11.GL_UNSIGNED_SHORT : GL11.GL_SHORT, variable.normalized,
                            variable.stride, 0);
        } else {
View Full Code Here

        return buf.get(0);
    }

    public static void apply(final FragmentProgramState state) {
        final RenderContext context = ContextManager.getCurrentContext();
        if (context.getCapabilities().isFragmentProgramSupported()) {
            final FragmentProgramStateRecord record = (FragmentProgramStateRecord) context
                    .getStateRecord(StateType.FragmentProgram);
            context.setCurrentState(StateType.FragmentProgram, state);

            if (!record.isValid() || record.getReference() != state) {
                record.setReference(state);
                if (state.isEnabled()) {
                    // Fragment program not yet loaded
View Full Code Here

import com.ardor3d.renderer.state.record.LightStateRecord;

public abstract class LwjglLightStateUtil {

    public static void apply(final LightState state) {
        final RenderContext context = ContextManager.getCurrentContext();
        final LightStateRecord record = (LightStateRecord) context.getStateRecord(StateType.Light);
        context.setCurrentState(StateType.Light, state);

        if (state.isEnabled() && LightState.LIGHTS_ENABLED) {
            setLightEnabled(true, record);
            setTwoSided(state.getTwoSidedLighting(), record);
            setLocalViewer(state.getLocalViewer(), record);
            if (context.getCapabilities().isOpenGL1_2Supported()) {
                setSpecularControl(state.getSeparateSpecular(), record);
            }

            for (int i = 0, max = state.getNumberOfChildren(); i < max; i++) {
                final Light light = state.get(i);
View Full Code Here

public abstract class LwjglClipStateUtil {

    public static void apply(final ClipState state) {
        // ask for the current state record
        final RenderContext context = ContextManager.getCurrentContext();
        final ClipStateRecord record = (ClipStateRecord) context.getStateRecord(StateType.Clip);
        context.setCurrentState(StateType.Clip, state);

        final ContextCapabilities caps = context.getCapabilities();
        final int max = Math.min(ClipState.MAX_CLIP_PLANES, caps.getMaxUserClipPlanes());

        if (state.isEnabled()) {
            for (int i = 0; i < max; i++) {
                enableClipPlane(i, state.getPlaneEnabled(i), state, record);
View Full Code Here

TOP

Related Classes of com.ardor3d.renderer.RenderContext

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.