Example usage for org.lwjgl.opengl GL11 glPolygonMode

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

Introduction

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

Prototype

public static void glPolygonMode(@NativeType("GLenum") int face, @NativeType("GLenum") int mode) 

Source Link

Document

Controls the interpretation of polygons for rasterization.

Usage

From source file:jake2.desktop.LWJGLAdapter.java

License:Open Source License

@Override
public void glPolygonMode(int i, int j) {
    GL11.glPolygonMode(i, j);
}

From source file:kuake2.render.lwjgl.Misc.java

License:Open Source License

void GL_SetDefaultState() {
    GL11.glClearColor(1f, 0f, 0.5f, 0.5f); // original quake2
    //GL11.glClearColor(0, 0, 0, 0); // replaced with black
    GL11.glCullFace(GL11.GL_FRONT);/*  w  w  w  .java 2  s . com*/
    GL11.glEnable(GL11.GL_TEXTURE_2D);

    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glAlphaFunc(GL11.GL_GREATER, 0.666f);

    GL11.glDisable(GL11.GL_DEPTH_TEST);
    GL11.glDisable(GL11.GL_CULL_FACE);
    GL11.glDisable(GL11.GL_BLEND);

    GL11.glColor4f(1, 1, 1, 1);

    GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_FILL);
    GL11.glShadeModel(GL11.GL_FLAT);

    GL_TextureMode(gl_texturemode.string);
    GL_TextureAlphaMode(gl_texturealphamode.string);
    GL_TextureSolidMode(gl_texturesolidmode.string);

    GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, gl_filter_min);
    GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, gl_filter_max);

    GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_REPEAT);
    GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_REPEAT);

    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

    GL_TexEnv(GL11.GL_REPLACE);

    if (qglPointParameterfEXT) {
        // float[] attenuations = { gl_particle_att_a.value, gl_particle_att_b.value, gl_particle_att_c.value };
        FloatBuffer att_buffer = BufferUtils.createFloatBuffer(4);
        att_buffer.put(0, gl_particle_att_a.value);
        att_buffer.put(1, gl_particle_att_b.value);
        att_buffer.put(2, gl_particle_att_c.value);

        GL11.glEnable(GL11.GL_POINT_SMOOTH);
        EXTPointParameters.glPointParameterfEXT(EXTPointParameters.GL_POINT_SIZE_MIN_EXT,
                gl_particle_min_size.value);
        EXTPointParameters.glPointParameterfEXT(EXTPointParameters.GL_POINT_SIZE_MAX_EXT,
                gl_particle_max_size.value);
        EXTPointParameters.glPointParameterEXT(EXTPointParameters.GL_DISTANCE_ATTENUATION_EXT, att_buffer);
    }

    if (qglColorTableEXT && gl_ext_palettedtexture.value != 0.0f) {
        GL11.glEnable(EXTSharedTexturePalette.GL_SHARED_TEXTURE_PALETTE_EXT);

        GL_SetTexturePalette(d_8to24table);
    }

    GL_UpdateSwapInterval();

    /*
     * vertex array extension
     */
    GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY);
    ARBMultitexture.glClientActiveTextureARB(GL_TEXTURE0);
    GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY);
}

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);//from   www  .  j  a v a 2 s  . c  o m
    GL11.glEnable(GL11.GL_CULL_FACE);

    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();
}

From source file:net.phatcode.rel.multimedia.Renderer.java

License:Open Source License

Renderer(int screenWidth, int screenHeight) {
    try {// www .ja  v a  2 s .  c o m
        Display.setDisplayMode(new DisplayMode(screenWidth, screenHeight));
        Display.create();
        Display.setTitle("AnyaBasic 0.4.0 beta");
    } catch (LWJGLException e) {
        e.printStackTrace();
    }

    this.screenWidth = screenWidth;
    this.screenHeight = screenHeight;

    GL11.glViewport(0, 0, screenWidth, screenHeight);

    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();

    GL11.glOrtho(0, screenWidth, screenHeight, 0, 1, -1);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);

    GL11.glLoadIdentity();

    GL11.glShadeModel(GL11.GL_SMOOTH); //set shading to smooth(try GL_FLAT)
    GL11.glClearColor(0.0f, 0.0f, 0.0f, 1.0f); //set Clear color to BLACK
    GL11.glClearDepth(1.0f); //Set Depth buffer to 1(z-Buffer)
    GL11.glDisable(GL11.GL_DEPTH_TEST); //Disable Depth Testing so that our z-buffer works

    GL11.glDepthFunc(GL11.GL_LEQUAL);

    GL11.glEnable(GL11.GL_COLOR_MATERIAL);

    GL11.glEnable(GL11.GL_TEXTURE_2D);

    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glAlphaFunc(GL11.GL_GREATER, 0);

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

    GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST);

    GL11.glDisable(GL11.GL_CULL_FACE);

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

    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glLoadIdentity();
    GL11.glTranslatef(0.375f, 0.375f, 0); // magic trick

}

From source file:net.smert.frameworkgl.opengl.OpenGL1.java

License:Apache License

public OpenGL1 disableLinePolygonFillMode() {
    GL11.glPolygonMode(GL11.GL_FRONT, GL11.GL_FILL);
    return this;
}

From source file:net.smert.frameworkgl.opengl.OpenGL1.java

License:Apache License

public OpenGL1 enableLinePolygonFillMode() {
    GL11.glPolygonMode(GL11.GL_FRONT, GL11.GL_LINE);
    return this;
}

From source file:net.smert.frameworkgl.opengl.OpenGL1.java

License:Apache License

public OpenGL1 setPolygonModeBackFill() {
    GL11.glPolygonMode(GL11.GL_BACK, GL11.GL_FILL);
    return this;
}

From source file:net.smert.frameworkgl.opengl.OpenGL1.java

License:Apache License

public OpenGL1 setPolygonModeBackLine() {
    GL11.glPolygonMode(GL11.GL_BACK, GL11.GL_LINE);
    return this;
}

From source file:net.smert.frameworkgl.opengl.OpenGL1.java

License:Apache License

public OpenGL1 setPolygonModeFrontAndBackFill() {
    GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_FILL);
    return this;
}

From source file:net.smert.frameworkgl.opengl.OpenGL1.java

License:Apache License

public OpenGL1 setPolygonModeFrontAndBackLine() {
    GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_LINE);
    return this;
}