Example usage for org.lwjgl.opengl GL11 glNormal3f

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

Introduction

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

Prototype

public static native void glNormal3f(@NativeType("GLfloat") float nx, @NativeType("GLfloat") float ny,
        @NativeType("GLfloat") float nz);

Source Link

Document

Sets the current normal.

Usage

From source file:game.states.State_PREFAB_EDITOR.java

License:Open Source License

private void DrawFloor(int x, int y, int i) {
    GL11.glBegin(GL11.GL_QUADS);//from   w  w  w.j a  v  a2  s.  c om
    TileDefinition.setColor(i);
    GL11.glNormal3f(0, 1, 0);
    GL11.glVertex3f(-1f, -1f, 0f);
    GL11.glVertex3f(1f, -1f, 0f);
    GL11.glVertex3f(1f, 1f, 0f);
    GL11.glVertex3f(-1f, 1f, 0f);
    GL11.glEnd();

}

From source file:io.flob.blackheart.CollectableGold.java

License:Open Source License

@Override
public void _render() {
    GL11.glEnd();//  ww  w  . j  a  va 2  s .  c om

    GL11.glPushMatrix();
    GL11.glTranslatef(position().getX(), position().getY(), position().getZ());
    FloatBuffer modelview = BufferUtils.createFloatBuffer(16);
    GL11.glGetFloat(GL11.GL_MODELVIEW_MATRIX, modelview);
    for (int i = 0; i < 3; i += 2) {
        for (int j = 0; j < 3; j++) {
            if (i == j) {
                modelview.put(i * 4 + j, 1.0f);
            } else {
                modelview.put(i * 4 + j, 0.0f);
            }
        }
    }
    GL11.glLoadMatrix(modelview);
    GL11.glBegin(GL11.GL_QUADS);
    GL11.glNormal3f(0f, 0f, 1f);
    GL11.glTexCoord2f(_texture[state].getU(), _texture[state].getV2());
    GL11.glVertex2f(-size(), -size());
    GL11.glTexCoord2f(_texture[state].getU2(), _texture[state].getV2());
    GL11.glVertex2f(size(), -size());
    GL11.glTexCoord2f(_texture[state].getU2(), _texture[state].getV());
    GL11.glVertex2f(size(), size());
    GL11.glTexCoord2f(_texture[state].getU(), _texture[state].getV());
    GL11.glVertex2f(-size(), size());
    GL11.glEnd();
    GL11.glPopMatrix();

    GL11.glBegin(GL11.GL_QUADS);
}

From source file:io.flob.blackheart.FloorBlood.java

License:Open Source License

@Override
public void _render() {
    if (texture == null) {
        texture = TextureLibrary.placeholder;
    }//from   ww  w  . j a  va  2 s .  co m
    GL11.glNormal3f(0, 1, 0);
    GL11.glTexCoord2f(texture.getU(), texture.getV());
    GL11.glVertex3f(-size + position.getX(), size + position.getY(), -size + position.getZ());
    GL11.glTexCoord2f(texture.getU(), texture.getV2());
    GL11.glVertex3f(-size + position.getX(), size + position.getY(), size + position.getZ());
    GL11.glTexCoord2f(texture.getU2(), texture.getV2());
    GL11.glVertex3f(size + position.getX(), size + position.getY(), size + position.getZ());
    GL11.glTexCoord2f(texture.getU2(), texture.getV());
    GL11.glVertex3f(size + position.getX(), size + position.getY(), -size + position.getZ());
}

From source file:io.flob.blackheart.ICeiling.java

License:Open Source License

@Override
public void _render() {
    if (texture == null) {
        texture = TextureLibrary.placeholder;
    }/*from   ww  w  .  j a  va  2 s.co  m*/
    GL11.glNormal3f(0, -1, 0);
    GL11.glTexCoord2f(texture.getU2(), texture.getV());
    GL11.glVertex3f(-size + position.getX(), -size + position.getY(), -size + position.getZ());
    GL11.glTexCoord2f(texture.getU(), texture.getV());
    GL11.glVertex3f(size + position.getX(), -size + position.getY(), -size + position.getZ());
    GL11.glTexCoord2f(texture.getU(), texture.getV2());
    GL11.glVertex3f(size + position.getX(), -size + position.getY(), size + position.getZ());
    GL11.glTexCoord2f(texture.getU2(), texture.getV2());
    GL11.glVertex3f(-size + position.getX(), -size + position.getY(), size + position.getZ());
}

From source file:io.flob.blackheart.ICollectable.java

License:Open Source License

@Override
public void _render() {
    GL11.glEnd();//from w ww  . j a v  a  2  s .  c om

    if (texture == null) {
        texture = TextureLibrary.placeholder;
    }
    GL11.glPushMatrix();
    GL11.glTranslatef(position.getX(), position.getY(), position.getZ());
    FloatBuffer modelview = BufferUtils.createFloatBuffer(16);
    GL11.glGetFloat(GL11.GL_MODELVIEW_MATRIX, modelview);
    for (int i = 0; i < 3; i += 2) {
        for (int j = 0; j < 3; j++) {
            if (i == j) {
                modelview.put(i * 4 + j, 1.0f);
            } else {
                modelview.put(i * 4 + j, 0.0f);
            }
        }
    }
    GL11.glLoadMatrix(modelview);
    GL11.glBegin(GL11.GL_QUADS);
    GL11.glNormal3f(0f, 0f, 1f);
    GL11.glTexCoord2f(texture.getU(), texture.getV2());
    GL11.glVertex2f(-size, -size);
    GL11.glTexCoord2f(texture.getU2(), texture.getV2());
    GL11.glVertex2f(size, -size);
    GL11.glTexCoord2f(texture.getU2(), texture.getV());
    GL11.glVertex2f(size, size);
    GL11.glTexCoord2f(texture.getU(), texture.getV());
    GL11.glVertex2f(-size, size);
    GL11.glEnd();
    GL11.glPopMatrix();

    GL11.glBegin(GL11.GL_QUADS);
}

From source file:io.flob.blackheart.IDoor.java

License:Open Source License

private void render_front() {
    TextureUV _texture;// w w w  .  ja  va 2s. c o m
    float offset = -Level.texture_bleed_offset;
    if (parallel) {
        _texture = texture_face;
    } else {
        _texture = texture_side;
    }
    GL11.glNormal3f(0f, 0f, 1f);
    GL11.glTexCoord2f(_texture.getU(), _texture.getV2());
    GL11.glVertex3f(-size + position.getX(), -size + position.getY(), size + position.getZ() + offset);
    GL11.glTexCoord2f(_texture.getU2(), _texture.getV2());
    GL11.glVertex3f(size + position.getX(), -size + position.getY(), size + position.getZ() + offset);
    GL11.glTexCoord2f(_texture.getU2(), _texture.getV());
    GL11.glVertex3f(size + position.getX(), size + position.getY(), size + position.getZ() + offset);
    GL11.glTexCoord2f(_texture.getU(), _texture.getV());
    GL11.glVertex3f(-size + position.getX(), size + position.getY(), size + position.getZ() + offset);
}

From source file:io.flob.blackheart.IDoor.java

License:Open Source License

private void render_back() {
    TextureUV _texture;//from w w  w .  j av  a 2 s . c o  m
    float offset;
    if (parallel) {
        _texture = texture_face;
        offset = Level.texture_bleed_offset;
    } else {
        _texture = texture_side;
        offset = -Level.texture_bleed_offset;
    }
    GL11.glNormal3f(0f, 0f, -1f);
    GL11.glTexCoord2f(_texture.getU2(), _texture.getV2());
    GL11.glVertex3f(-size + position.getX(), -size + position.getY(), -size + position.getZ() + offset);
    GL11.glTexCoord2f(_texture.getU2(), _texture.getV());
    GL11.glVertex3f(-size + position.getX(), size + position.getY(), -size + position.getZ() + offset);
    GL11.glTexCoord2f(_texture.getU(), _texture.getV());
    GL11.glVertex3f(size + position.getX(), size + position.getY(), -size + position.getZ() + offset);
    GL11.glTexCoord2f(_texture.getU(), _texture.getV2());
    GL11.glVertex3f(size + position.getX(), -size + position.getY(), -size + position.getZ() + offset);
}

From source file:io.flob.blackheart.IDoor.java

License:Open Source License

private void render_left() {
    TextureUV _texture;//  w  w w. ja  va2s  .com
    float offset = Level.texture_bleed_offset;
    if (parallel) {
        _texture = texture_side;
    } else {
        _texture = texture_face;
    }
    GL11.glNormal3f(-1, 0, 0);
    GL11.glTexCoord2f(_texture.getU(), _texture.getV2());
    GL11.glVertex3f(-size + position.getX() + offset, -size + position.getY(), -size + position.getZ());
    GL11.glTexCoord2f(_texture.getU2(), _texture.getV2());
    GL11.glVertex3f(-size + position.getX() + offset, -size + position.getY(), size + position.getZ());
    GL11.glTexCoord2f(_texture.getU2(), _texture.getV());
    GL11.glVertex3f(-size + position.getX() + offset, size + position.getY(), size + position.getZ());
    GL11.glTexCoord2f(_texture.getU(), _texture.getV());
    GL11.glVertex3f(-size + position.getX() + offset, size + position.getY(), -size + position.getZ());
}

From source file:io.flob.blackheart.IDoor.java

License:Open Source License

private void render_right() {
    TextureUV _texture;//from   ww w.  j a v  a 2 s .c  o  m
    float offset;
    if (parallel) {
        _texture = texture_side;
        offset = -Level.texture_bleed_offset;
    } else {
        _texture = texture_face;
        offset = Level.texture_bleed_offset;
    }
    GL11.glNormal3f(1, 0, 0);
    GL11.glTexCoord2f(_texture.getU2(), _texture.getV2());
    GL11.glVertex3f(size + position.getX() - offset, -size + position.getY(), -size + position.getZ());
    GL11.glTexCoord2f(_texture.getU2(), _texture.getV());
    GL11.glVertex3f(size + position.getX() - offset, size + position.getY(), -size + position.getZ());
    GL11.glTexCoord2f(_texture.getU(), _texture.getV());
    GL11.glVertex3f(size + position.getX() - offset, size + position.getY(), size + position.getZ());
    GL11.glTexCoord2f(_texture.getU(), _texture.getV2());
    GL11.glVertex3f(size + position.getX() - offset, -size + position.getY(), size + position.getZ());
}

From source file:io.flob.blackheart.IDoor.java

License:Open Source License

private void render_surround() {
    // Bottom//from   ww w  .  java 2s . c  o m
    GL11.glNormal3f(0, -1, 0);
    GL11.glTexCoord2f(texture_surround.getU2(), texture_surround.getV());
    GL11.glVertex3f(-size + position_start.getX(), -size + position_start.getY() + Level.texture_bleed_offset,
            -size + position_start.getZ());
    GL11.glTexCoord2f(texture_surround.getU(), texture_surround.getV());
    GL11.glVertex3f(size + position_start.getX(), -size + position_start.getY() + Level.texture_bleed_offset,
            -size + position_start.getZ());
    GL11.glTexCoord2f(texture_surround.getU(), texture_surround.getV2());
    GL11.glVertex3f(size + position_start.getX(), -size + position_start.getY() + Level.texture_bleed_offset,
            size + position_start.getZ());
    GL11.glTexCoord2f(texture_surround.getU2(), texture_surround.getV2());
    GL11.glVertex3f(-size + position_start.getX(), -size + position_start.getY() + Level.texture_bleed_offset,
            size + position_start.getZ());

    // Top
    GL11.glNormal3f(0, 1, 0);
    GL11.glTexCoord2f(texture_surround.getU(), texture_surround.getV());
    GL11.glVertex3f(-size + position_start.getX(), size + position_start.getY() - Level.texture_bleed_offset,
            -size + position_start.getZ());
    GL11.glTexCoord2f(texture_surround.getU(), texture_surround.getV2());
    GL11.glVertex3f(-size + position_start.getX(), size + position_start.getY() - Level.texture_bleed_offset,
            size + position_start.getZ());
    GL11.glTexCoord2f(texture_surround.getU2(), texture_surround.getV2());
    GL11.glVertex3f(size + position_start.getX(), size + position_start.getY() - Level.texture_bleed_offset,
            size + position_start.getZ());
    GL11.glTexCoord2f(texture_surround.getU2(), texture_surround.getV());
    GL11.glVertex3f(size + position_start.getX(), size + position_start.getY() - Level.texture_bleed_offset,
            -size + position_start.getZ());

    if (parallel) {
        // right 
        GL11.glNormal3f(1, 0, 0);
        GL11.glTexCoord2f(texture_surround.getU2(), texture_surround.getV2());
        GL11.glVertex3f(size + position_start.getX() - Level.texture_bleed_offset,
                -size + position_start.getY(), -size + position_start.getZ());
        GL11.glTexCoord2f(texture_surround.getU2(), texture_surround.getV());
        GL11.glVertex3f(size + position_start.getX() - Level.texture_bleed_offset, size + position_start.getY(),
                -size + position_start.getZ());
        GL11.glTexCoord2f(texture_surround.getU(), texture_surround.getV());
        GL11.glVertex3f(size + position_start.getX() - Level.texture_bleed_offset, size + position_start.getY(),
                size + position_start.getZ());
        GL11.glTexCoord2f(texture_surround.getU(), texture_surround.getV2());
        GL11.glVertex3f(size + position_start.getX() - Level.texture_bleed_offset,
                -size + position_start.getY(), size + position_start.getZ());
    } else {
        // back
        GL11.glNormal3f(0f, 0f, -1f);
        GL11.glTexCoord2f(texture_surround.getU2(), texture_surround.getV2());
        GL11.glVertex3f(-size + position_start.getX(), -size + position_start.getY(),
                -size + position_start.getZ() + Level.texture_bleed_offset);
        GL11.glTexCoord2f(texture_surround.getU2(), texture_surround.getV());
        GL11.glVertex3f(-size + position_start.getX(), size + position_start.getY(),
                -size + position_start.getZ() + Level.texture_bleed_offset);
        GL11.glTexCoord2f(texture_surround.getU(), texture_surround.getV());
        GL11.glVertex3f(size + position_start.getX(), size + position_start.getY(),
                -size + position_start.getZ() + Level.texture_bleed_offset);
        GL11.glTexCoord2f(texture_surround.getU(), texture_surround.getV2());
        GL11.glVertex3f(size + position_start.getX(), -size + position_start.getY(),
                -size + position_start.getZ() + Level.texture_bleed_offset);
    }
}