Example usage for org.lwjgl.opengl GL11 glFrontFace

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

Introduction

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

Prototype

public static void glFrontFace(@NativeType("GLenum") int dir) 

Source Link

Document

The first step of polygon rasterization is to determine if the polygon is back-facing or front-facing.

Usage

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

License:Open Source License

private static void setGLPolygonWind(final PolygonWind windOrder, final CullStateRecord record) {
    if (!record.isValid() || record.windOrder != windOrder) {
        switch (windOrder) {
        case CounterClockWise:
            GL11.glFrontFace(GL11.GL_CCW);
            break;
        case ClockWise:
            GL11.glFrontFace(GL11.GL_CW);
            break;
        }//ww  w  . jav  a  2  s.c  om
        record.windOrder = windOrder;
    }
}

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

License:Apache License

public void glFrontFace(int mode) {
    GL11.glFrontFace(mode);
}

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

License:Apache License

public final void glFrontFace(int mode) {
    GL11.glFrontFace(mode);
}

From source file:com.mtbs3d.minecrift.provider.MCOculus.java

License:LGPL

public void endFrame() {
    GL11.glDisable(GL11.GL_CULL_FACE); // Oculus wants CW orientations, avoid the problem by turning off culling...
    GL11.glDisable(GL11.GL_DEPTH_TEST); // Nothing is drawn with depth test on...
    //GL30.glBindVertexArray(0);
    GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0); // Unbind GL_ARRAY_BUFFER for my own vertex arrays to work...
    GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, 0);

    // End the frame
    super.endFrame();

    GL11.glFrontFace(GL11.GL_CCW); // Needed for OVR SDK 0.4.0
    GL11.glEnable(GL11.GL_CULL_FACE); // Turn back on...
    GL11.glEnable(GL11.GL_DEPTH_TEST); // Turn back on...
    GL11.glClearDepth(1); // Oculus set this to 0 (the near plane), return to normal...
    ARBShaderObjects.glUseProgramObjectARB(0); // Oculus shader is still active, turn it off...

    Display.processMessages();/*w w w  .jav  a  2  s  .c o  m*/
}

From source file:com.runescape.client.revised.client.lwjgl.RenderUtilities.java

License:Open Source License

public static void initializeGraphics() {
    GL11.glClearColor(0.0F, 0.0F, 0.0F, 0.0F);
    GL11.glFrontFace(GL11.GL_CW);
    GL11.glCullFace(GL11.GL_BACK);/*www . ja va 2 s  .c  o  m*/
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glEnable(GL30.GL_FRAMEBUFFER_SRGB);
    // TODO: Depth clamp
}

From source file:com.shinoow.abyssalcraft.client.handlers.AbyssalCraftClientEventHooks.java

License:Apache License

private void renderStarSpawnPlayer(EntityPlayer player, float partialTicks) {

    mc.renderEngine.bindTexture(new ResourceLocation("abyssalcraft:textures/model/tentacles.png"));

    for (int j = 0; j < 1; ++j) {
        GL11.glColor4f(1F, 1F, 1F, 1F);/*from w  w  w. ja  v a 2 s .  c  o m*/
        float f10 = player.prevRotationYawHead
                + (player.rotationYawHead - player.prevRotationYawHead) * partialTicks
                - (player.prevRenderYawOffset
                        + (player.renderYawOffset - player.prevRenderYawOffset) * partialTicks);
        float f2 = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * partialTicks;
        GL11.glPushMatrix();
        GL11.glFrontFace(GL11.GL_CW);
        GL11.glRotatef(f10, 0.0F, 1.0F, 0.0F);
        GL11.glRotatef(f2, 1.0F, 0.0F, 0.0F);
        GL11.glTranslatef(0, -0.22F, 0);
        GL11.glScalef(1, 1, 1);
        model.renderTentacles(0.0625F);
        GL11.glFrontFace(GL11.GL_CCW);
        GL11.glPopMatrix();
    }
}

From source file:com.voxelplugineering.voxelsniper.render.RenderMain.java

License:Open Source License

private void setupOpenGL() {
    // Setup an OpenGL context with API version 3.2
    try {/*from   www .  ja  va  2 s.  c o  m*/
        PixelFormat pixelFormat = new PixelFormat();
        ContextAttribs contextAtrributes = new ContextAttribs(3, 2).withForwardCompatible(true)
                .withProfileCore(true);

        Display.setDisplayMode(new DisplayMode(this.width, this.height));
        Display.setTitle("VoxelGunsmithEngine");
        Display.create(pixelFormat, contextAtrributes);
        GL11.glViewport(0, 0, this.width, this.height);
    } catch (LWJGLException e) {
        if (Standalone.DEBUG) {
            System.out.println("Failed creating display");
        }
        e.printStackTrace();
        System.exit(-1);
    }

    // Setup an XNA like background color
    GL11.glClearColor(RenderingConstants.CLEAR_COLOUR_R, RenderingConstants.CLEAR_COLOUR_G,
            RenderingConstants.CLEAR_COLOUR_B, RenderingConstants.CLEAR_COLOUR_A);
    GL11.glViewport(0, 0, this.width, this.height);

    // cull back faces
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glCullFace(GL11.GL_BACK);
    GL11.glFrontFace(GL11.GL_CW);

    OpenGLUtilities.checkGLError("setup OpenGL");
}

From source file:io.root.gfx.glutils.GL.java

License:Apache License

public static void glFrontFace(int mode) {
    GL11.glFrontFace(mode);
}

From source file:jpcsp.graphics.RE.RenderingEngineLwjgl.java

License:Open Source License

@Override
public void setFrontFace(boolean cw) {
    GL11.glFrontFace(cw ? GL11.GL_CW : GL11.GL_CCW);
}

From source file:net.mechanicalcat.pycode.obj.Model.java

License:Open Source License

public void genList() {
    this.glList = GL11.glGenLists(1);
    GL11.glNewList(this.glList, GL11.GL_COMPILE);
    //        if use_texture: glEnable(GL_TEXTURE_2D)
    GL11.glFrontFace(GL11.GL_CCW);
    GL11.glEnable(GL11.GL_CULL_FACE);//from w w w  .j  av  a 2s. com

    GL11.glPolygonMode(GL11.GL_FRONT, GL11.GL_FILL);
    GL11.glDepthFunc(GL11.GL_LESS);
    GL11.glCullFace(GL11.GL_BACK);
    String currentMaterial = "";
    Material mtl;
    for (Face face : this.faces) {
        if (!face.material.equals(currentMaterial)) {
            currentMaterial = face.material;
            mtl = this.materials.get(face.material);
            if (mtl == null) {
                GL11.glColor3f(1, 1, 1);
            } else {
                //                    if 'texture_Kd' in mtl:
                //                    # use diffuse texmap
                //                    glBindTexture(GL_TEXTURE_2D, mtl['texture_Kd'])
                GL11.glColor3f(mtl.diffuse.x, mtl.diffuse.y, mtl.diffuse.z);
            }
        }

        GL11.glBegin(GL11.GL_POLYGON);
        for (int i = 0; i < face.vertexes.size(); i++) {
            if (face.normals.get(i) != 0) {
                Vector3f n = this.normals.get(face.normals.get(i));
                GL11.glNormal3f(n.x, n.y, n.z);
            }
            //                if texture_coords[i]:
            //                    glTexCoord2fv(self.texcoords[texture_coords[i] - 1])
            Vector3f v = this.vertices.get(face.vertexes.get(i));
            GL11.glVertex3f(v.x, v.y, v.z);
        }
        GL11.glEnd();
    }

    GL11.glCullFace(GL11.GL_BACK);
    GL11.glPolygonMode(GL11.GL_FRONT, GL11.GL_FILL);

    GL11.glDisable(GL11.GL_CULL_FACE);

    //      if use_texture: glDisable(GL11.GL_TEXTURE_2D);
    GL11.glEndList();
}