List of usage examples for org.lwjgl.opengl GL11 glEnableClientState
public static native void glEnableClientState(@NativeType("GLenum") int cap);
From source file:ion2d.INDirector.java
License:Open Source License
protected void enableDefaultGLStates() { if (Display.isCreated() == false) return;//from w w w .j a v a 2 s .c om GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY); GL11.glEnableClientState(GL11.GL_COLOR_ARRAY); GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY); GL11.glEnable(GL11.GL_TEXTURE_2D); }
From source file:ion2d.INGrid3D.java
License:Open Source License
/** * Draw the Grid3D to the output//from w ww . j ava 2 s . com */ public void blit() { // Default GL states: GL_TEXTURE_2D, GL_VERTEX_ARRAY, GL_COLOR_ARRAY, GL_TEXTURE_COORD_ARRAY // Needed states: GL_TEXTURE_2D, GL_VERTEX_ARRAY, GL_TEXTURE_COORD_ARRAY // Unneeded states: GL_COLOR_ARRAY GL11.glDisableClientState(GL11.GL_COLOR_ARRAY); GL11.glVertexPointer(3, 0, this.vertices); GL11.glTexCoordPointer(2, 0, this.textureCoordinates); GL11.glDrawElements(GL11.GL_TRIANGLES, this.indices); //Restore GL Default State GL11.glEnableClientState(GL11.GL_COLOR_ARRAY); }
From source file:ion2d.INTiledGrid3D.java
License:Open Source License
/** * Draws the Grid3D to the output//from w ww .ja v a 2s . co m */ public void blit() { // Default GL states: GL_TEXTURE_2D, GL_VERTEX_ARRAY, GL_COLOR_ARRAY, GL_TEXTURE_COORD_ARRAY // Needed states: GL_TEXTURE_2D, GL_VERTEX_ARRAY, GL_TEXTURE_COORD_ARRAY // Unneeded states: GL_COLOR_ARRAY GL11.glDisableClientState(GL11.GL_COLOR_ARRAY); GL11.glVertexPointer(3, 0, this.vertices); GL11.glTexCoordPointer(2, 0, this.textureCoordinates); GL11.glDrawElements(GL11.GL_QUADS, this.indices); //Restore GL Default State GL11.glEnableClientState(GL11.GL_COLOR_ARRAY); }
From source file:jake2.desktop.LWJGLAdapter.java
License:Open Source License
public void glEnableClientState(int state) { GL11.glEnableClientState(state); }
From source file:jpcsp.graphics.RE.RenderingEngineLwjgl.java
License:Open Source License
@Override public void enableClientState(int type) { GL11.glEnableClientState(clientStateToGL[type]); }
From source file:kuake2.render.lwjgl.Main.java
License:Open Source License
/** * R_DrawParticles/*from w w w.j av a 2 s. co m*/ */ void R_DrawParticles() { if (gl_ext_pointparameters.value != 0.0f && qglPointParameterfEXT) { //GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY); GL11.glVertexPointer(3, 0, particle_t.vertexArray); GL11.glEnableClientState(GL11.GL_COLOR_ARRAY); GL11.glColorPointer(4, true, 0, particle_t.getColorAsByteBuffer()); GL11.glDepthMask(false); GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glPointSize(gl_particle_size.value); GL11.glDrawArrays(GL11.GL_POINTS, 0, r_newrefdef.num_particles); GL11.glDisableClientState(GL11.GL_COLOR_ARRAY); //GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY); GL11.glDisable(GL11.GL_BLEND); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glDepthMask(true); GL11.glEnable(GL11.GL_TEXTURE_2D); } else { GL_DrawParticles(r_newrefdef.num_particles); } }
From source file:kuake2.render.lwjgl.Mesh.java
License:Open Source License
/** * GL_DrawAliasFrameLerp//from www . ja v a 2s. c o m * <p/> * interpolates between two frames and origins * FIXME: batch lerp all vertexes */ void GL_DrawAliasFrameLerp(qfiles.dmdl_t paliashdr, float backlerp) { qfiles.daliasframe_t frame = paliashdr.aliasFrames[currententity.frame]; int[] verts = frame.verts; qfiles.daliasframe_t oldframe = paliashdr.aliasFrames[currententity.oldframe]; int[] ov = oldframe.verts; float alpha; if ((currententity.flags & Defines.RF_TRANSLUCENT) != 0) alpha = currententity.alpha; else alpha = 1.0f; // PMM - added double shell if ((currententity.flags & (Defines.RF_SHELL_RED | Defines.RF_SHELL_GREEN | Defines.RF_SHELL_BLUE | Defines.RF_SHELL_DOUBLE | Defines.RF_SHELL_HALF_DAM)) != 0) GL11.glDisable(GL11.GL_TEXTURE_2D); float frontlerp = 1.0f - backlerp; // move should be the delta back to the previous frame * backlerp Math3D.VectorSubtract(currententity.oldorigin, currententity.origin, frontv); Math3D.AngleVectors(currententity.angles, vectors[0], vectors[1], vectors[2]); move[0] = Math3D.DotProduct(frontv, vectors[0]); // forward move[1] = -Math3D.DotProduct(frontv, vectors[1]); // left move[2] = Math3D.DotProduct(frontv, vectors[2]); // up Math3D.VectorAdd(move, oldframe.translate, move); for (int i = 0; i < 3; i++) { move[i] = backlerp * move[i] + frontlerp * frame.translate[i]; frontv[i] = frontlerp * frame.scale[i]; backv[i] = backlerp * oldframe.scale[i]; } // ab hier wird optimiert GL_LerpVerts(paliashdr.num_xyz, ov, verts, move, frontv, backv); //GL11.glEnableClientState( GL11.GL_VERTEX_ARRAY ); GL11.glVertexPointer(3, 0, vertexArrayBuf); // PMM - added double damage shell if ((currententity.flags & (Defines.RF_SHELL_RED | Defines.RF_SHELL_GREEN | Defines.RF_SHELL_BLUE | Defines.RF_SHELL_DOUBLE | Defines.RF_SHELL_HALF_DAM)) != 0) { GL11.glColor4f(shadelight[0], shadelight[1], shadelight[2], alpha); } else { GL11.glEnableClientState(GL11.GL_COLOR_ARRAY); GL11.glColorPointer(4, 0, colorArrayBuf); // // pre light everything // FloatBuffer color = colorArrayBuf; float l; int size = paliashdr.num_xyz; int j = 0; for (int i = 0; i < size; i++) { l = shadedots[(verts[i] >>> 24) & 0xFF]; color.put(j, l * shadelight[0]); color.put(j + 1, l * shadelight[1]); color.put(j + 2, l * shadelight[2]); color.put(j + 3, alpha); j += 4; } } ARBMultitexture.glClientActiveTextureARB(GL_TEXTURE0); GL11.glTexCoordPointer(2, 0, textureArrayBuf); //GL11.glEnableClientState( GL11.GL_TEXTURE_COORD_ARRAY); int pos = 0; int[] counts = paliashdr.counts; IntBuffer srcIndexBuf = null; FloatBuffer dstTextureCoords = textureArrayBuf; FloatBuffer srcTextureCoords = paliashdr.textureCoordBuf; int dstIndex = 0; int srcIndex = 0; int count; int mode; int size = counts.length; for (int j = 0; j < size; j++) { // get the vertex count and primitive type count = counts[j]; if (count == 0) break; // done srcIndexBuf = paliashdr.indexElements[j]; mode = GL11.GL_TRIANGLE_STRIP; if (count < 0) { mode = GL11.GL_TRIANGLE_FAN; count = -count; } srcIndex = pos << 1; srcIndex--; for (int k = 0; k < count; k++) { dstIndex = srcIndexBuf.get(k) << 1; dstTextureCoords.put(dstIndex, srcTextureCoords.get(++srcIndex)); dstTextureCoords.put(++dstIndex, srcTextureCoords.get(++srcIndex)); } GL11.glDrawElements(mode, srcIndexBuf); pos += count; } // PMM - added double damage shell if ((currententity.flags & (Defines.RF_SHELL_RED | Defines.RF_SHELL_GREEN | Defines.RF_SHELL_BLUE | Defines.RF_SHELL_DOUBLE | Defines.RF_SHELL_HALF_DAM)) != 0) GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisableClientState(GL11.GL_COLOR_ARRAY); }
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);/*from www .ja v a2 s . c o m*/ 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:kuake2.render.lwjgl.Surf.java
License:Open Source License
/** * R_DrawBrushModel/* w w w.ja v a 2 s. co m*/ */ void R_DrawBrushModel(entity_t e) { if (currentmodel.nummodelsurfaces == 0) return; currententity = e; gl_state.currenttextures[0] = gl_state.currenttextures[1] = -1; boolean rotated; if (e.angles[0] != 0 || e.angles[1] != 0 || e.angles[2] != 0) { rotated = true; for (int i = 0; i < 3; i++) { mins[i] = e.origin[i] - currentmodel.radius; maxs[i] = e.origin[i] + currentmodel.radius; } } else { rotated = false; Math3D.VectorAdd(e.origin, currentmodel.mins, mins); Math3D.VectorAdd(e.origin, currentmodel.maxs, maxs); } if (R_CullBox(mins, maxs)) return; GL11.glColor3f(1, 1, 1); // memset (gl_lms.lightmap_surfaces, 0, sizeof(gl_lms.lightmap_surfaces)); // TODO wird beim multitexturing nicht gebraucht //gl_lms.clearLightmapSurfaces(); Math3D.VectorSubtract(r_newrefdef.vieworg, e.origin, modelorg); if (rotated) { Math3D.VectorCopy(modelorg, org); Math3D.AngleVectors(e.angles, forward, right, up); modelorg[0] = Math3D.DotProduct(org, forward); modelorg[1] = -Math3D.DotProduct(org, right); modelorg[2] = Math3D.DotProduct(org, up); } GL11.glPushMatrix(); e.angles[0] = -e.angles[0]; // stupid quake bug e.angles[2] = -e.angles[2]; // stupid quake bug R_RotateForEntity(e); e.angles[0] = -e.angles[0]; // stupid quake bug e.angles[2] = -e.angles[2]; // stupid quake bug GL_EnableMultitexture(true); GL_SelectTexture(GL_TEXTURE0); GL_TexEnv(GL11.GL_REPLACE); GL11.glInterleavedArrays(GL11.GL_T2F_V3F, Polygon.BYTE_STRIDE, globalPolygonInterleavedBuf); GL_SelectTexture(GL_TEXTURE1); GL_TexEnv(GL11.GL_MODULATE); GL11.glTexCoordPointer(2, Polygon.BYTE_STRIDE, globalPolygonTexCoord1Buf); GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY); R_DrawInlineBModel(); ARBMultitexture.glClientActiveTextureARB(GL_TEXTURE1); GL11.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY); GL_EnableMultitexture(false); GL11.glPopMatrix(); }
From source file:kuake2.render.lwjgl.Surf.java
License:Open Source License
/** * R_DrawWorld//from www. j av a 2s . com */ void R_DrawWorld() { if (r_drawworld.value == 0) return; if ((r_newrefdef.rdflags & Defines.RDF_NOWORLDMODEL) != 0) return; currentmodel = r_worldmodel; Math3D.VectorCopy(r_newrefdef.vieworg, modelorg); entity_t ent = worldEntity; // auto cycle the world frame for texture animation ent.clear(); ent.frame = (int) (r_newrefdef.time * 2); currententity = ent; gl_state.currenttextures[0] = gl_state.currenttextures[1] = -1; GL11.glColor3f(1, 1, 1); // memset (gl_lms.lightmap_surfaces, 0, sizeof(gl_lms.lightmap_surfaces)); // TODO wird bei multitexture nicht gebraucht //gl_lms.clearLightmapSurfaces(); R_ClearSkyBox(); GL_EnableMultitexture(true); GL_SelectTexture(GL_TEXTURE0); GL_TexEnv(GL11.GL_REPLACE); GL11.glInterleavedArrays(GL11.GL_T2F_V3F, Polygon.BYTE_STRIDE, globalPolygonInterleavedBuf); GL_SelectTexture(GL_TEXTURE1); GL11.glTexCoordPointer(2, Polygon.BYTE_STRIDE, globalPolygonTexCoord1Buf); GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY); if (gl_lightmap.value != 0) GL_TexEnv(GL11.GL_REPLACE); else GL_TexEnv(GL11.GL_MODULATE); R_RecursiveWorldNode(r_worldmodel.nodes[0]); // root node ARBMultitexture.glClientActiveTextureARB(GL_TEXTURE1); GL11.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY); GL_EnableMultitexture(false); DrawTextureChains(); R_DrawSkyBox(); R_DrawTriangleOutlines(); }