Example usage for org.lwjgl.opengl GL11 GL_MODELVIEW

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

Introduction

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

Prototype

int GL_MODELVIEW

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

Click Source Link

Document

MatrixMode

Usage

From source file:fr.mcnanotech.kevin_68.nanotechmod.main.client.renderer.RenderFlyingCreeper.java

License:Creative Commons License

protected int renderMobFlyingCreeperPassModel(MobFlyingCreeper mob, int par2, float par3) {
    if (mob.getPowered()) {
        if (par2 == 1) {
            float var4 = (float) mob.ticksExisted + par3;
            this.bindTexture(new ResourceLocation("textures/entity/creeper/creeper_armor.png"));
            GL11.glMatrixMode(GL11.GL_TEXTURE);
            GL11.glLoadIdentity();/*from  www. j av  a2 s.  c  om*/
            float var5 = var4 * 0.01F;
            float var6 = var4 * 0.01F;
            GL11.glTranslatef(var5, var6, 0.0F);
            this.setRenderPassModel(this.model);
            GL11.glMatrixMode(GL11.GL_MODELVIEW);
            GL11.glEnable(GL11.GL_BLEND);
            float var7 = 0.5F;
            GL11.glColor4f(var7, var7, var7, 1.0F);
            GL11.glDisable(GL11.GL_LIGHTING);
            GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE);
            return 1;
        }

        if (par2 == 2) {
            GL11.glMatrixMode(GL11.GL_TEXTURE);
            GL11.glLoadIdentity();
            GL11.glMatrixMode(GL11.GL_MODELVIEW);
            GL11.glEnable(GL11.GL_LIGHTING);
            GL11.glDisable(GL11.GL_BLEND);
        }
    }

    return -1;
}

From source file:fr.mcnanotech.kevin_68.nanotechmod.main.client.renderer.RenderSuperCreeper.java

License:Creative Commons License

protected int renderMobSuperCreeperPassModel(MobSuperCreeper mob, int par2, float par3) {
    if (mob.getPowered()) {
        if (par2 == 1) {
            float var4 = (float) mob.ticksExisted + par3;
            this.bindTexture(new ResourceLocation("textures/entity/creeper/creeper_armor.png"));
            GL11.glMatrixMode(GL11.GL_TEXTURE);
            GL11.glLoadIdentity();//from   ww  w  .j av  a  2 s  . c om
            float var5 = var4 * 0.01F;
            float var6 = var4 * 0.01F;
            GL11.glTranslatef(var5, var6, 0.0F);
            this.setRenderPassModel(this.model);
            GL11.glMatrixMode(GL11.GL_MODELVIEW);
            GL11.glEnable(GL11.GL_BLEND);
            float var7 = 0.5F;
            GL11.glColor4f(var7, var7, var7, 1.0F);
            GL11.glDisable(GL11.GL_LIGHTING);
            GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE);
            return 1;
        }

        if (par2 == 2) {
            GL11.glMatrixMode(GL11.GL_TEXTURE);
            GL11.glLoadIdentity();
            GL11.glMatrixMode(GL11.GL_MODELVIEW);
            GL11.glEnable(GL11.GL_LIGHTING);
            GL11.glDisable(GL11.GL_BLEND);
        }
    }

    return -1;
}

From source file:fr.theshark34.sharkengine.Game.java

License:Apache License

/**
 * Create the Game//from w  w  w .  j av a 2 s.  c  o m
 * 
 * @param name
 *            The name of the Game
 * @param title
 *            The title of the Game window
 * @param icon
 *            The icon of the Game window
 * @param firstGUI
 *            The first displayed GUI
 * @param clearColor
 *            The clear color (= background color)
 */
public static void create(final String name, final String title, final BufferedImage icon, GUI firstGUI,
        Color clearColor) {
    try {
        // Setting up things
        Game.name = name;
        Game.title = title;
        Game.icon = icon;
        Game.clearColor = clearColor;
        running = true;

        // Creating the Display, the Mouse and the Keyboard
        DisplayUtil.setDisplayModeAndFullscreen();
        Display.setTitle(title);
        Display.create();
        Mouse.create();
        Keyboard.create();

        // Initializing OpenGL
        GL11.glMatrixMode(GL11.GL_PROJECTION);
        GL11.glLoadIdentity();
        GL11.glOrtho(0, Display.getWidth(), Display.getHeight(), 0, -1, 1);
        GL11.glMatrixMode(GL11.GL_MODELVIEW);

        // Displaying the first GUI
        setCurrentGUI(firstGUI);

        // Start the main loop
        while (running)
            update();

        // Destroy all
        Display.destroy();
        Mouse.destroy();
        Keyboard.destroy();
    } catch (LWJGLException e) {
        ErrorUtil.catchError(e);
    }
}

From source file:game.engine.game.Scene.java

License:Open Source License

/**
 * Draws the screen contents using OpenGL.
 *///from  w  w w . j ava  2  s  .  c  o m
public void draw() {
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();
    GL11.glOrtho(0, getScreenWidthUnits(), getScreenHeightUnits(), 0, -1, 1);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glLoadIdentity();
    GL11.glTranslatef(-screenX, -screenY, 0.0f);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
    for (GameObject gameObject : gameObjects) {
        gameObject.draw();
    }
}

From source file:game.states.State_PREFAB_EDITOR.java

License:Open Source License

@Override
protected void Init() {
    ButtonGUILayer = new GUI_Layer();
    ButtonGUILayer.SetEnabled(true);//from  www  .  j a v a2s .  com
    MenuGUILayer = new GUI_Layer();
    MenuGUILayer.SetEnabled(false);
    int ButtonStartX = 712;
    int ButtonStartY = 600;
    float xScale = 1.5f;
    float yScale = 1.5f;
    int Spacing = 145;
    int menuButtonStartX = 640 - 128;
    int menuButtonStartY = 150;
    float menuXScale = 1f;
    float menuYScale = 1f;
    int menuSpacing = 110;
    try {
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        BackGroundImage = TextureLoader.getTexture("PNG",
                ResourceLoader.getResourceAsStream("res/Materials/GUI/UI/GUIPrefab.png"));
        Texture button1 = TextureLoader.getTexture("PNG",
                ResourceLoader.getResourceAsStream("res/Materials/GUI/UI/SaveIconButton.png"), false,
                GL11.GL_NEAREST);
        ButtonGUILayer.AddButton(ButtonStartX + Spacing * 0, ButtonStartY,
                (int) (button1.getImageWidth() * xScale), (int) (button1.getImageHeight() * yScale), button1);
        Texture button2 = TextureLoader.getTexture("PNG",
                ResourceLoader.getResourceAsStream("res/Materials/GUI/UI/LoadIconButton.png"), false,
                GL11.GL_NEAREST);
        ButtonGUILayer.AddButton(ButtonStartX + Spacing * 1, ButtonStartY,
                (int) (button2.getImageWidth() * xScale), (int) (button2.getImageHeight() * yScale), button2);
        Texture button3 = TextureLoader.getTexture("PNG",
                ResourceLoader.getResourceAsStream("res/Materials/GUI/UI/OptionsIconButton.png"), false,
                GL11.GL_NEAREST);
        ButtonGUILayer.AddButton(ButtonStartX + Spacing * 2, ButtonStartY,
                (int) (button3.getImageWidth() * xScale), (int) (button3.getImageHeight() * yScale), button3);
        Texture button4 = TextureLoader.getTexture("PNG",
                ResourceLoader.getResourceAsStream("res/Materials/GUI/UI/HelpIconButton.png"), false,
                GL11.GL_NEAREST);
        ButtonGUILayer.AddButton(ButtonStartX + Spacing * 3, ButtonStartY,
                (int) (button4.getImageWidth() * xScale), (int) (button4.getImageHeight() * yScale), button4);

        Texture mButton0 = TextureLoader.getTexture("PNG",
                ResourceLoader.getResourceAsStream("res/Materials/GUI/Buttons/ReturnButton.png"), false,
                GL11.GL_NEAREST);
        MenuGUILayer.AddButton(menuButtonStartX, menuButtonStartY + menuSpacing * 0,
                (int) (mButton0.getImageWidth() * menuXScale), (int) (mButton0.getImageHeight() * menuYScale),
                mButton0);
        Texture mButton1 = TextureLoader.getTexture("PNG",
                ResourceLoader.getResourceAsStream("res/Materials/GUI/Buttons/LoadButton.png"), false,
                GL11.GL_NEAREST);
        MenuGUILayer.AddButton(menuButtonStartX, menuButtonStartY + menuSpacing * 1,
                (int) (mButton1.getImageWidth() * menuXScale), (int) (mButton1.getImageHeight() * menuYScale),
                mButton1);
        Texture mButton2 = TextureLoader.getTexture("PNG",
                ResourceLoader.getResourceAsStream("res/Materials/GUI/Buttons/SaveButton.png"), false,
                GL11.GL_NEAREST);
        MenuGUILayer.AddButton(menuButtonStartX, menuButtonStartY + menuSpacing * 2,
                (int) (mButton2.getImageWidth() * menuXScale), (int) (mButton2.getImageHeight() * menuYScale),
                mButton2);
        Texture mButton3 = TextureLoader.getTexture("PNG",
                ResourceLoader.getResourceAsStream("res/Materials/GUI/Buttons/BackButton.png"), false,
                GL11.GL_NEAREST);
        MenuGUILayer.AddButton(menuButtonStartX, menuButtonStartY + menuSpacing * 3,
                (int) (mButton3.getImageWidth() * menuXScale), (int) (mButton3.getImageHeight() * menuYScale),
                mButton3);

    } catch (IOException e) {
        e.printStackTrace();
    }

    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glEnable(GL11.GL_LIGHT0);
    GL11.glEnableClientState(GL11.GL_NORMAL_ARRAY);
    GL11.glEnableClientState(GL11.GL_COLOR_ARRAY);
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();

    GLU.gluPerspective(45.0f, (float) Display.getWidth() / (float) Display.getHeight(), 0.1f, 600.0f);
    GLU.gluLookAt(0, 20, 50, 0, -2, -100, 0, -1, 0);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glLoadIdentity();

    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
}

From source file:game.states.State_SINGLEPLAYER.java

License:Open Source License

@Override
protected void Init() {
    if (CreateNewGame) {
        CurrentSave = new GameSave();
        Worlds = new TileMap[] { new TileMap(), new TileMap(), new TileMap(), new TileMap(), new TileMap(),
                new TileMap(), new TileMap(), new TileMap(), new TileMap() };
        t = Worlds[0];/* w  ww .  jav  a 2s  . c o m*/
        CreateGUI();
        System.out.println("Loading worlds");
        for (int i = 0; i < Worlds.length; i++) {
            Worlds[i].Load(i == Worlds.length - 1, i == 0, i);
            CurrentSave.setIntMapData(TileMapGenerator.Map, i);
        }
    }
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glEnable(GL11.GL_LIGHT0);
    GL11.glEnableClientState(GL11.GL_NORMAL_ARRAY);
    GL11.glEnableClientState(GL11.GL_COLOR_ARRAY);
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();

    GLU.gluPerspective(45.0f, (float) Display.getWidth() / (float) Display.getHeight(), 0.1f, 600.0f);
    GLU.gluLookAt(0, 20, 50, 0, -2, -100, 0, -1, 0);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glLoadIdentity();
    if (CreateNewGame) {
        player = t.SpawnPlayer();
        PlayerGridX = player.getX();
        PlayerGridY = player.getY();
        PlayerY = 52 - CameraDisplacement * (PlayerGridY - 1);
        PlayerX = -6 + CameraDisplacement * (PlayerGridX - 1);
        PlayerZ = 0;
        SetGUI();
    }
    CreateNewGame = true;

    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
}

From source file:gravestone.models.block.memorials.ModelCreeperStatueMemorial.java

License:LGPL

private void renderCreeperCharging() {
    float tickModifier = (float) (Minecraft.getSystemTime() % 3000L) / 3000.0F * 48.0F;
    float scale = 1.2F;
    float f4 = 0.5F;

    GL11.glTranslated(0, -0.5, 0);/*from w ww. java  2s. c om*/
    GL11.glScalef(scale, scale, scale);
    TileEntityGSMemorialRenderer.instance.bindTextureByName(Resources.CREEPER_AURA);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glDepthMask(true);
    GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
    GL11.glMatrixMode(GL11.GL_TEXTURE);

    for (int var21 = 0; var21 < 3; ++var21) {
        GL11.glLoadIdentity();
        float var23 = tickModifier * (0.001F + (float) var21 * 0.0015F) * 15;
        GL11.glTranslatef(0, var23, 0);
        renderCreeper();
    }

    GL11.glMatrixMode(GL11.GL_TEXTURE);
    GL11.glLoadIdentity();
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glDepthFunc(GL11.GL_LEQUAL);
    GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE);

    GL11.glTranslated(0, -0.19, 0);
}

From source file:gravestone.models.block.ModelGraveStone.java

License:LGPL

protected void renderEnchantment() {
    float tickModifier = (float) (Minecraft.getSystemTime() % 3000L) / 3000.0F * 48.0F;
    TileEntityGSGraveStoneRenderer.instance.bindTextureByName(Resources.SWORD_AURA);

    GL11.glEnable(GL11.GL_BLEND);// ww  w . j a v  a2s .  com
    GL11.glDepthMask(true);
    GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
    GL11.glMatrixMode(GL11.GL_TEXTURE);

    for (int var21 = 0; var21 < 3; var21++) {
        GL11.glDisable(GL11.GL_LIGHTING);
        float var22 = 0.76F;
        GL11.glColor4f(0.5F * var22, 0.25F * var22, 0.8F * var22, 1.0F);
        GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
        GL11.glMatrixMode(GL11.GL_TEXTURE);
        GL11.glLoadIdentity();
        float var23 = tickModifier * (0.001F + (float) var21 * 0.0015F) * 15;
        float var24 = 0.33333334F;
        GL11.glScalef(var24, var24, var24);
        GL11.glRotatef(30 - (float) var21 * 60, 0, 0, 1);
        GL11.glTranslatef(0, var23, 0);
        GL11.glMatrixMode(GL11.GL_MODELVIEW);
        renderAll();
    }

    GL11.glMatrixMode(GL11.GL_TEXTURE);
    GL11.glDepthMask(true);
    GL11.glLoadIdentity();
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glDepthFunc(GL11.GL_LEQUAL);
}

From source file:herzog3d.Camera.java

License:Open Source License

public void transform() {
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();/*from w ww.  j  a v a 2s. co  m*/
    GLU.gluPerspective(40, 1, 1, 100);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glLoadIdentity();
    Vector3f targetPos = new Vector3f(mech.getPos());
    GLU.gluLookAt(pos.x, pos.y, pos.z, targetPos.x, targetPos.y, targetPos.z, 0, 0, 1);
}

From source file:herzog3d.Game.java

License:Open Source License

/**
 * All rendering is done in here/*from  ww w.  j  a  v a  2  s  .c om*/
 */
public void draw() {
    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
    cam.transform();
    GLUtils.glLightPos(1.0f, 1.0f, 1.0f);
    GL11.glColor3f(1.0f, 1.0f, 1.0f);
    getMap().draw(cam);

    for (Unit unit : units) {
        if (unit.isActive()) {
            unit.draw();
        }
    }

    for (Base base : bases) {
        base.draw(map);
    }
    for (Effect effect : effects) {
        effect.draw();
    }

    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();
    GL11.glOrtho(0, 800, 600, 0, 0, 1);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glLoadIdentity();
    GL11.glDisable(GL11.GL_DEPTH_TEST);
    GL11.glDisable(GL11.GL_LIGHTING);
    Material.DEFAULT_WHITE.bind();
    for (HZWidget overlay : overlays) {
        if (overlay.isVisible()) {
            overlay.draw();
        }
    }
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glEnable(GL11.GL_DEPTH_TEST);

}