Example usage for org.lwjgl.opengl GL11 glHint

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

Introduction

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

Prototype

public static void glHint(@NativeType("GLenum") int target, @NativeType("GLenum") int hint) 

Source Link

Document

Certain aspects of GL behavior, when there is room for variation, may be controlled with this function.

Usage

From source file:$.DrawSystem.java

License:Open Source License

@Override
    protected void processEntities(ImmutableBag<Entity> entities) {
        GL11.glClearColor(0.1f, 0, 0, 1f);
        GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
        List<Entity> entititesSortedByZ = new ArrayList<>(entities.size());
        for (int i = 0, n = entities.size(); i < n; ++i) {
            final Entity e = entities.get(i);
            if (e.isEnabled()) {
                entititesSortedByZ.add(e);
            }/*w  w w  . ja  v a2  s.co  m*/
        }
        Collections.sort(entititesSortedByZ, zComparator);

        GL11.glPushAttrib(GL11.GL_ENABLE_BIT | GL11.GL_TRANSFORM_BIT | GL11.GL_HINT_BIT | GL11.GL_COLOR_BUFFER_BIT
                | GL11.GL_SCISSOR_BIT | GL11.GL_LINE_BIT | GL11.GL_TEXTURE_BIT);
        GL11.glMatrixMode(GL11.GL_PROJECTION);
        GL11.glPushMatrix();
        GL11.glLoadIdentity();

        updateViewPort();
        GL11.glViewport(viewPort.x, viewPort.y, viewPort.width, viewPort.height);
        GLU.gluOrtho2D(-toolkit.getVirtualResolutionWidth() / 2.0f, toolkit.getVirtualResolutionWidth() / 2.0f,
                toolkit.getVirtualResolutionHeight() / 2.0f, -toolkit.getVirtualResolutionHeight() / 2.0f);
        GL11.glMatrixMode(GL11.GL_MODELVIEW);
        GL11.glPushMatrix();
        GL11.glLoadIdentity();
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glEnable(GL11.GL_LINE_SMOOTH);
        GL11.glDisable(GL11.GL_DEPTH_TEST);
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glDisable(GL11.GL_SCISSOR_TEST);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST);

        Game game = (Game) world;
        Entity hero = game.getHero();
        if (null != hero) {
            Sprite heroSprite = spriteMapper.get(hero);
            Vector heroPos = spriteProjector.project(heroSprite.getPosition());
            GL11.glTranslatef(-heroPos.x, -heroPos.y, 0.0f);
        }

        for (Entity e : entititesSortedByZ) {
            MainMenu mainMenu = mainMenuMapper.getSafe(e);
            if (null != mainMenu) {
                mainMenu.draw();
            }
            DialogueComponent dialog = dialogMapper.getSafe(e);
            if (null != dialog) {
                dialog.draw();
            }
            Level level = levelMapper.getSafe(e);
            if (null != level) {
                drawLevel(level);
            }
            Sprite sprite = spriteMapper.getSafe(e);
            if (null != sprite) {
                drawSprite(sprite);
            }
        }
        GL11.glPopMatrix();
        GL11.glMatrixMode(GL11.GL_PROJECTION);
        GL11.glPopMatrix();
        GL11.glPopAttrib();

    }

From source file:com.aelitis.azureus.plugins.view3d.ViewTest2.java

License:Open Source License

public static void main(String[] args) {
    final Display display = new Display();
    Shell shell = new Shell(display);
    shell.setLayout(new FillLayout());
    Composite comp = new Composite(shell, SWT.NONE);
    comp.setLayout(new FillLayout());
    GLData data = new GLData();
    data.doubleBuffer = true;//from   ww  w . j  a v  a  2 s .com
    data.accumAlphaSize = 8;
    data.accumBlueSize = 8;
    data.accumGreenSize = 8;
    data.accumRedSize = 8;

    final GLCanvas canvas = new GLCanvas(comp, SWT.NONE, data);

    canvas.setCurrent();
    try {
        GLContext.useContext(canvas);
    } catch (LWJGLException e) {
        e.printStackTrace();
    }

    canvas.addListener(SWT.Resize, new Listener() {
        public void handleEvent(Event event) {
            Rectangle bounds = canvas.getBounds();
            float fAspect = (float) bounds.width / (float) bounds.height;
            canvas.setCurrent();
            try {
                GLContext.useContext(canvas);
            } catch (LWJGLException e) {
                e.printStackTrace();
            }
            GL11.glViewport(0, 0, bounds.width, bounds.height);
            GL11.glMatrixMode(GL11.GL_PROJECTION);
            GL11.glLoadIdentity();
            GLU.gluPerspective(45.0f, fAspect, 0.5f, 400.0f);
            GL11.glMatrixMode(GL11.GL_MODELVIEW);
            GL11.glLoadIdentity();
        }
    });

    GL11.glLineWidth(1);
    GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST);
    GL11.glEnable(GL11.GL_LINE_SMOOTH);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

    GL11.glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
    GL11.glColor3f(1.0f, 0.0f, 0.0f);
    GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST);
    GL11.glClearDepth(1.0);
    GL11.glLineWidth(2);
    GL11.glEnable(GL11.GL_DEPTH_TEST);

    GL11.glShadeModel(GL11.GL_FLAT);

    GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
    GL11.glClearAccum(0.0f, 0.0f, 0.0f, 0.0f);

    shell.setText("SWT/LWJGL Example");
    shell.setSize(640, 480);
    shell.open();

    final Runnable run = new Runnable() {
        float rot = 0;

        public void run() {
            if (!canvas.isDisposed()) {
                canvas.setCurrent();
                try {
                    GLContext.useContext(canvas);
                } catch (LWJGLException e) {
                    e.printStackTrace();
                }

                int ACSIZE = 8;

                int[] viewport = getViewport();

                GL11.glClear(GL11.GL_ACCUM_BUFFER_BIT);

                for (int jitter = 0; jitter < ACSIZE; jitter++) {
                    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);

                    double jit_x = jits[jitter][0];
                    double jit_y = jits[jitter][1];

                    accPerspective(50.0, (double) viewport[2] / (double) viewport[3], 1.0, 15.0, jit_x, jit_y,
                            0.0, 0.0, 1.0);

                    {

                        GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
                        GL11.glClearColor(.3f, .5f, .8f, 1.0f);
                        GL11.glLoadIdentity();
                        GL11.glTranslatef(0.0f, 0.0f, -10.0f);
                        float frot = rot;
                        GL11.glRotatef(0.15f * rot, 2.0f * frot, 10.0f * frot, 1.0f);
                        GL11.glRotatef(0.3f * rot, 3.0f * frot, 1.0f * frot, 1.0f);
                        GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_FILL);
                        GL11.glColor3f(0.9f, 0.9f, 0.9f);
                        drawCylinder(2, 3, 50, 0);
                        drawTorus(1, 1.9f + ((float) Math.sin((0.004f * frot))), 15, 15);
                    }

                    GL11.glAccum(GL11.GL_ACCUM, 1.0f / ACSIZE);
                }

                GL11.glAccum(GL11.GL_RETURN, 1.0f);
                GL11.glFlush();

                rot += 0.1;

                canvas.swapBuffers();
                display.asyncExec(this);
            }
        }
    };
    canvas.addListener(SWT.Paint, new Listener() {
        public void handleEvent(Event event) {
            run.run();
        }
    });
    display.asyncExec(run);

    while (!shell.isDisposed()) {
        if (!display.readAndDispatch())
            display.sleep();
    }
    display.dispose();
}

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

License:Open Source License

public void setupLineParameters(final float lineWidth, final int stippleFactor, final short stipplePattern,
        final boolean antialiased) {
    final LineRecord lineRecord = ContextManager.getCurrentContext().getLineRecord();

    if (!lineRecord.isValid() || lineRecord.width != lineWidth) {
        GL11.glLineWidth(lineWidth);/* ww w.j  a v a2  s  .c  om*/
        lineRecord.width = lineWidth;
    }

    if (stipplePattern != (short) 0xFFFF) {
        if (!lineRecord.isValid() || !lineRecord.stippled) {
            GL11.glEnable(GL11.GL_LINE_STIPPLE);
            lineRecord.stippled = true;
        }

        if (!lineRecord.isValid() || stippleFactor != lineRecord.stippleFactor
                || stipplePattern != lineRecord.stipplePattern) {
            GL11.glLineStipple(stippleFactor, stipplePattern);
            lineRecord.stippleFactor = stippleFactor;
            lineRecord.stipplePattern = stipplePattern;
        }
    } else if (!lineRecord.isValid() || lineRecord.stippled) {
        GL11.glDisable(GL11.GL_LINE_STIPPLE);
        lineRecord.stippled = false;
    }

    if (antialiased) {
        if (!lineRecord.isValid() || !lineRecord.smoothed) {
            GL11.glEnable(GL11.GL_LINE_SMOOTH);
            lineRecord.smoothed = true;
        }
        if (!lineRecord.isValid() || lineRecord.smoothHint != GL11.GL_NICEST) {
            GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST);
            lineRecord.smoothHint = GL11.GL_NICEST;
        }
    } else if (!lineRecord.isValid() || lineRecord.smoothed) {
        GL11.glDisable(GL11.GL_LINE_SMOOTH);
        lineRecord.smoothed = false;
    }

    if (!lineRecord.isValid()) {
        lineRecord.validate();
    }
}

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

License:Open Source License

@Override
public void setupPointParameters(final float pointSize, final boolean antialiased, final boolean isSprite,
        final boolean useDistanceAttenuation, final FloatBuffer attenuationCoefficients,
        final float minPointSize, final float maxPointSize) {
    final RenderContext context = ContextManager.getCurrentContext();

    // TODO: make a record for point states
    GL11.glPointSize(pointSize);/*from ww  w  .  ja  v a2 s  .com*/

    if (isSprite && context.getCapabilities().isPointSpritesSupported()) {
        GL11.glEnable(ARBPointSprite.GL_POINT_SPRITE_ARB);
        GL11.glTexEnvi(ARBPointSprite.GL_POINT_SPRITE_ARB, ARBPointSprite.GL_COORD_REPLACE_ARB, GL11.GL_TRUE);
    }

    if (useDistanceAttenuation && context.getCapabilities().isPointParametersSupported()) {
        ARBPointParameters.glPointParameterARB(ARBPointParameters.GL_POINT_DISTANCE_ATTENUATION_ARB,
                attenuationCoefficients);
        ARBPointParameters.glPointParameterfARB(ARBPointParameters.GL_POINT_SIZE_MIN_ARB, minPointSize);
        ARBPointParameters.glPointParameterfARB(ARBPointParameters.GL_POINT_SIZE_MAX_ARB, maxPointSize);
    }

    if (antialiased) {
        GL11.glEnable(GL11.GL_POINT_SMOOTH);
        GL11.glHint(GL11.GL_POINT_SMOOTH_HINT, GL11.GL_NICEST);
    }
}

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

License:Open Source License

private static void applyFogHint(final Quality quality, final FogStateRecord record) {
    int glHint = 0;
    switch (quality) {
    case PerVertex:
        glHint = GL11.GL_FASTEST;//from w  w w. java  2  s .  c o  m
        break;
    case PerPixel:
        glHint = GL11.GL_NICEST;
        break;
    }

    if (!record.isValid() || record.fogHint != glHint) {
        GL11.glHint(GL11.GL_FOG_HINT, glHint);
        record.fogHint = glHint;
    }
}

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

License:Open Source License

public static void apply(final TextureState state) {
    // ask for the current state record
    final RenderContext context = ContextManager.getCurrentContext();
    final ContextCapabilities caps = context.getCapabilities();
    final TextureStateRecord record = (TextureStateRecord) context.getStateRecord(StateType.Texture);
    context.setCurrentState(StateType.Texture, state);

    if (state.isEnabled()) {

        Texture texture;//from  w w  w  .  j a  v  a  2 s . c o  m
        Texture.Type type;
        TextureUnitRecord unitRecord;
        TextureRecord texRecord;

        final int glHint = LwjglTextureUtil.getPerspHint(state.getCorrectionType());
        if (!record.isValid() || record.hint != glHint) {
            // set up correction mode
            GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, glHint);
            record.hint = glHint;
        }

        // loop through all available texture units...
        for (int i = 0; i < caps.getNumberOfTotalTextureUnits(); i++) {
            unitRecord = record.units[i];

            // grab a texture for this unit, if available
            texture = state.getTexture(i);

            // pull our texture id for this texture, for this context.
            int textureId = texture != null ? texture.getTextureIdForContext(context.getGlContextRep()) : 0;

            // check for invalid textures - ones that have no opengl id and
            // no image data
            if (texture != null && textureId == 0 && texture.getImage() == null) {
                texture = null;
            }

            // null textures above fixed limit do not need to be disabled
            // since they are not really part of the pipeline.
            if (texture == null) {
                if (i >= caps.getNumberOfFixedTextureUnits()) {
                    continue;
                } else {
                    // a null texture indicates no texturing at this unit
                    // Disable texturing on this unit if enabled.
                    disableTexturing(unitRecord, record, i, caps);

                    if (i < state._keyCache.length) {
                        state._keyCache[i] = null;
                    }

                    // next texture!
                    continue;
                }
            }

            type = texture.getType();

            // disable other texturing types for this unit, if enabled.
            disableTexturing(unitRecord, record, i, type, caps);

            // Time to bind the texture, so see if we need to load in image
            // data for this texture.
            if (textureId == 0) {
                // texture not yet loaded.
                // this will load and bind and set the records...
                load(texture, i);
                textureId = texture.getTextureIdForContext(context.getGlContextRep());
                if (textureId == 0) {
                    continue;
                }
            } else if (texture.isDirty(context.getGlContextRep())) {
                update(texture, i);
                textureId = texture.getTextureIdForContext(context.getGlContextRep());
                if (textureId == 0) {
                    continue;
                }
            } else {
                // texture already exists in OpenGL, just bind it if needed
                if (!unitRecord.isValid() || unitRecord.boundTexture != textureId) {
                    checkAndSetUnit(i, record, caps);
                    GL11.glBindTexture(getGLType(type), textureId);
                    if (Constants.stats) {
                        StatCollector.addStat(StatType.STAT_TEXTURE_BINDS, 1);
                    }
                    unitRecord.boundTexture = textureId;
                }
            }

            // Use the Java Integer object for the getTextureRecord call to avoid
            // boxing/unboxing ints for map lookups.
            final Integer textureIdInteger = texture.getTextureIdForContextAsInteger(context.getGlContextRep());

            // Grab our record for this texture
            texRecord = record.getTextureRecord(textureIdInteger, texture.getType());

            // Set the keyCache value for this unit of this texture state
            // This is done so during state comparison we don't have to
            // spend a lot of time pulling out classes and finding field
            // data.
            state._keyCache[i] = texture.getTextureKey();

            // Some texture things only apply to fixed function pipeline
            if (i < caps.getNumberOfFixedTextureUnits()) {

                // Enable 2D texturing on this unit if not enabled.
                if (!unitRecord.isValid() || !unitRecord.enabled[type.ordinal()]) {
                    checkAndSetUnit(i, record, caps);
                    GL11.glEnable(getGLType(type));
                    unitRecord.enabled[type.ordinal()] = true;
                }

                // Set our blend color, if needed.
                applyBlendColor(texture, unitRecord, i, record, caps);

                // Set the texture environment mode if this unit isn't
                // already set properly
                applyEnvMode(texture.getApply(), unitRecord, i, record, caps);

                // If our mode is combine, and we support multitexturing
                // apply combine settings.
                if (texture.getApply() == ApplyMode.Combine && caps.isMultitextureSupported()
                        && caps.isEnvCombineSupported()) {
                    applyCombineFactors(texture, unitRecord, i, record, caps);
                }
            }

            // Other items only apply to textures below the frag unit limit
            if (i < caps.getNumberOfFragmentTextureUnits()) {

                // texture specific params
                applyFilter(texture, texRecord, i, record, caps);
                applyWrap(texture, texRecord, i, record, caps);
                applyShadow(texture, texRecord, i, record, caps);

                // Set our border color, if needed.
                applyBorderColor(texture, texRecord, i, record);

                // all states have now been applied for a tex record, so we
                // can safely make it valid
                if (!texRecord.isValid()) {
                    texRecord.validate();
                }

            }

            // Other items only apply to textures below the frag tex coord
            // unit limit
            if (i < caps.getNumberOfFragmentTexCoordUnits()) {

                // Now time to play with texture matrices
                // Determine which transforms to do.
                applyTextureTransforms(texture, i, record, caps);

                // Now let's look at automatic texture coordinate
                // generation.
                applyTexCoordGeneration(texture, unitRecord, i, record, caps);

                // Set our texture lod bias, if needed.
                applyLodBias(texture, unitRecord, i, record, caps);
            }

        }

    } else {
        // turn off texturing
        TextureUnitRecord unitRecord;

        if (caps.isMultitextureSupported()) {
            for (int i = 0; i < caps.getNumberOfFixedTextureUnits(); i++) {
                unitRecord = record.units[i];
                disableTexturing(unitRecord, record, i, caps);
            }
        } else {
            unitRecord = record.units[0];
            disableTexturing(unitRecord, record, 0, caps);
        }
    }

    if (!record.isValid()) {
        record.validate();
    }
}

From source file:com.badlogic.gdx.backends.jglfw.JglfwGL20.java

License:Apache License

public void glHint(int target, int mode) {
    GL11.glHint(target, mode);
}

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

License:Apache License

public final void glHint(int target, int mode) {
    GL11.glHint(target, mode);
}

From source file:com.darkcart.xdolf.util.RenderUtils.java

License:Open Source License

public static void drawStrip(int x, int y, float width, double angle, float points, float radius, int color) {
    GL11.glPushMatrix();//from w ww.  jav  a 2  s.c o m
    float f1 = (float) (color >> 24 & 255) / 255.0F;
    float f2 = (float) (color >> 16 & 255) / 255.0F;
    float f3 = (float) (color >> 8 & 255) / 255.0F;
    float f4 = (float) (color & 255) / 255.0F;
    GL11.glTranslatef(x, y, 0);
    GL11.glColor4f(f2, f3, f4, f1);
    GL11.glLineWidth(width);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_DEPTH_TEST);
    GL11.glEnable(GL11.GL_LINE_SMOOTH);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST);
    GL11.glEnable(GL13.GL_MULTISAMPLE);

    if (angle > 0) {
        GL11.glBegin(GL11.GL_LINE_STRIP);

        for (int i = 0; i < angle; i++) {
            float a = (float) (i * (angle * Math.PI / points));
            float xc = (float) (Math.cos(a) * radius);
            float yc = (float) (Math.sin(a) * radius);
            GL11.glVertex2f(xc, yc);
        }

        GL11.glEnd();
    }

    if (angle < 0) {
        GL11.glBegin(GL11.GL_LINE_STRIP);

        for (int i = 0; i > angle; i--) {
            float a = (float) (i * (angle * Math.PI / points));
            float xc = (float) (Math.cos(a) * -radius);
            float yc = (float) (Math.sin(a) * -radius);
            GL11.glVertex2f(xc, yc);
        }

        GL11.glEnd();
    }

    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_LINE_SMOOTH);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glDisable(GL13.GL_MULTISAMPLE);
    GL11.glDisable(GL11.GL_MAP1_VERTEX_3);
    GL11.glPopMatrix();
}

From source file:com.gameminers.ethereal.architect.ModelCanvas.java

License:Open Source License

@Override
protected void paintGL() {
    try {/*from www .  jav a 2  s.  c  o m*/
        if (getWidth() != current_width || getHeight() != current_height) {
            current_width = getWidth();
            current_height = getHeight();
            GL11.glViewport(0, 0, current_width, current_height);
        }
        GL11.glClearColor(0.0f, 0.6f, 0.5f, 1.0f);
        GL11.glClearDepth(1.0);
        GL11.glColor3f(1, 1, 1);
        GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
        GL11.glMatrixMode(GL11.GL_PROJECTION);
        GL11.glEnable(GL11.GL_DEPTH_TEST);
        GL11.glDepthFunc(GL11.GL_LEQUAL);
        GL11.glLoadIdentity();
        GLU.gluPerspective(45.0f, (float) getWidth() / (float) getHeight(), 0.1f, 1000.0f);
        GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST);
        GL11.glMatrixMode(GL11.GL_MODELVIEW);
        GL11.glPushMatrix();
        GL11.glTranslatef(0, 0, zoom);
        GL11.glRotatef(angle, 0f, 1f, 0f);
        GL11.glRotatef(tilt, 1f, 0f, 0f);
        GL11.glTranslatef(-16, -16, -16);
        if (lit) {
            GL11.glEnable(GL11.GL_LIGHTING);
            GL11.glEnable(GL11.GL_LIGHT0);
            GL11.glLight(GL11.GL_LIGHT0, GL11.GL_POSITION, lightPosition);
            GL11.glLight(GL11.GL_LIGHT0, GL11.GL_AMBIENT, lightAmbient);
        } else {
            GL11.glDisable(GL11.GL_LIGHTING);
        }
        if (textured) {
            GL11.glEnable(GL11.GL_TEXTURE_2D);
        } else {
            GL11.glDisable(GL11.GL_TEXTURE_2D);
        }
        if (model != null) {
            if (model.isAmbientOcclusionEnabled()) {
                GL11.glShadeModel(GL11.GL_SMOOTH);
            } else {
                GL11.glShadeModel(GL11.GL_FLAT);
            }
            for (ModelElement ele : model.getElements()) {
                GL11.glPushMatrix();
                if (ele.isShade()) {
                    GL11.glEnable(GL11.GL_LIGHTING);
                } else {
                    GL11.glDisable(GL11.GL_LIGHTING);
                }
                float fromX = ele.getFrom()[0];
                float fromY = ele.getFrom()[1];
                float fromZ = ele.getFrom()[2];
                float toX = ele.getTo()[0];
                float toY = ele.getTo()[1];
                float toZ = ele.getTo()[2];

                float fX = (fromX > toX ? fromX : toX);
                float fY = (fromY > toY ? fromY : toY);
                float fZ = (fromZ > toZ ? fromZ : toZ);
                float tX = (fromX > toX ? toX : fromX);
                float tY = (fromY > toY ? toY : fromY);
                float tZ = (fromZ > toZ ? toZ : fromZ);

                GL11.glTranslatef(fX, fY, fZ);
                float scaleX = tX - fX;
                float scaleY = tY - fY;
                float scaleZ = tZ - fZ;
                GL11.glBegin(GL11.GL_QUADS);
                GL11.glNormal3f(0, 0, -1f);
                for (int i = 0; i < vertices.length / 3; i++) {
                    int faceIdx = i / 4;
                    ModelFace face;
                    switch (faceIdx) {
                    case 0:
                        face = ele.getFaces().getNorth();
                        break;
                    case 1:
                        face = ele.getFaces().getSouth();
                        break;
                    case 2:
                        face = ele.getFaces().getUp();
                        break;
                    case 3:
                        face = ele.getFaces().getDown();
                        break;
                    case 4:
                        face = ele.getFaces().getWest();
                        break;
                    case 5:
                        face = ele.getFaces().getEast();
                        break;
                    default:
                        face = null;
                        break;
                    }
                    int idx = i * 3;
                    float vX = vertices[idx] * scaleX;
                    float vY = vertices[idx + 1] * scaleY;
                    float vZ = vertices[idx + 2] * scaleZ;
                    /*float u;
                    float v;
                    GL11.glTexCoord2f(u, v);*/
                    GL11.glVertex3f(vX, vY, vZ);
                }
                GL11.glEnd();
                GL11.glPopMatrix();
            }
        }
        GL11.glPopMatrix();
        swapBuffers();
        repaint();
    } catch (LWJGLException e) {
        throw new RuntimeException(e);
    }
}