List of usage examples for org.lwjgl.opengl GL11 GL_MODULATE
int GL_MODULATE
To view the source code for org.lwjgl.opengl GL11 GL_MODULATE.
Click Source Link
From source file:lwjake2.render.lwjgl.Mesh.java
License:Open Source License
/** * R_DrawAliasModel/*from w ww .ja v a 2s . co m*/ */ void R_DrawAliasModel(entity_t e) { if ((e.flags & Defines.RF_WEAPONMODEL) == 0) { if (R_CullAliasModel(e)) return; } if ((e.flags & Defines.RF_WEAPONMODEL) != 0) { if (r_lefthand.value == 2.0f) return; } qfiles.dmdl_t paliashdr = (qfiles.dmdl_t) currentmodel.extradata; // // get lighting information // // PMM - rewrote, reordered to handle new shells & mixing // PMM - 3.20 code .. replaced with original way of doing it to keep mod authors happy // int i; if ((currententity.flags & (Defines.RF_SHELL_HALF_DAM | Defines.RF_SHELL_GREEN | Defines.RF_SHELL_RED | Defines.RF_SHELL_BLUE | Defines.RF_SHELL_DOUBLE)) != 0) { Math3D.VectorClear(shadelight); if ((currententity.flags & Defines.RF_SHELL_HALF_DAM) != 0) { shadelight[0] = 0.56f; shadelight[1] = 0.59f; shadelight[2] = 0.45f; } if ((currententity.flags & Defines.RF_SHELL_DOUBLE) != 0) { shadelight[0] = 0.9f; shadelight[1] = 0.7f; } if ((currententity.flags & Defines.RF_SHELL_RED) != 0) shadelight[0] = 1.0f; if ((currententity.flags & Defines.RF_SHELL_GREEN) != 0) shadelight[1] = 1.0f; if ((currententity.flags & Defines.RF_SHELL_BLUE) != 0) shadelight[2] = 1.0f; } else if ((currententity.flags & Defines.RF_FULLBRIGHT) != 0) { for (i = 0; i < 3; i++) shadelight[i] = 1.0f; } else { R_LightPoint(currententity.origin, shadelight); // player lighting hack for communication back to server // big hack! if ((currententity.flags & Defines.RF_WEAPONMODEL) != 0) { // pick the greatest component, which should be the same // as the mono value returned by software if (shadelight[0] > shadelight[1]) { if (shadelight[0] > shadelight[2]) r_lightlevel.value = 150 * shadelight[0]; else r_lightlevel.value = 150 * shadelight[2]; } else { if (shadelight[1] > shadelight[2]) r_lightlevel.value = 150 * shadelight[1]; else r_lightlevel.value = 150 * shadelight[2]; } } if (gl_monolightmap.string.charAt(0) != '0') { float s = shadelight[0]; if (s < shadelight[1]) s = shadelight[1]; if (s < shadelight[2]) s = shadelight[2]; shadelight[0] = s; shadelight[1] = s; shadelight[2] = s; } } if ((currententity.flags & Defines.RF_MINLIGHT) != 0) { for (i = 0; i < 3; i++) if (shadelight[i] > 0.1f) break; if (i == 3) { shadelight[0] = 0.1f; shadelight[1] = 0.1f; shadelight[2] = 0.1f; } } if ((currententity.flags & Defines.RF_GLOW) != 0) { // bonus items will pulse with time float scale; float min; scale = (float) (0.1f * Math.sin(r_newrefdef.time * 7)); for (i = 0; i < 3; i++) { min = shadelight[i] * 0.8f; shadelight[i] += scale; if (shadelight[i] < min) shadelight[i] = min; } } // ================= // PGM ir goggles color override if ((r_newrefdef.rdflags & Defines.RDF_IRGOGGLES) != 0 && (currententity.flags & Defines.RF_IR_VISIBLE) != 0) { shadelight[0] = 1.0f; shadelight[1] = 0.0f; shadelight[2] = 0.0f; } // PGM // ================= shadedots = r_avertexnormal_dots[((int) (currententity.angles[1] * (SHADEDOT_QUANT / 360.0))) & (SHADEDOT_QUANT - 1)]; float an = (float) (currententity.angles[1] / 180 * Math.PI); shadevector[0] = (float) Math.cos(-an); shadevector[1] = (float) Math.sin(-an); shadevector[2] = 1; Math3D.VectorNormalize(shadevector); // // locate the proper data // c_alias_polys += paliashdr.num_tris; // // draw all the triangles // if ((currententity.flags & Defines.RF_DEPTHHACK) != 0) // hack the depth range to prevent view model from poking into walls GL11.glDepthRange(gldepthmin, gldepthmin + 0.3 * (gldepthmax - gldepthmin)); if ((currententity.flags & Defines.RF_WEAPONMODEL) != 0 && (r_lefthand.value == 1.0f)) { GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glPushMatrix(); GL11.glLoadIdentity(); GL11.glScalef(-1, 1, 1); MYgluPerspective(r_newrefdef.fov_y, (float) r_newrefdef.width / r_newrefdef.height, 4, 4096); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glCullFace(GL11.GL_BACK); } GL11.glPushMatrix(); e.angles[PITCH] = -e.angles[PITCH]; // sigh. R_RotateForEntity(e); e.angles[PITCH] = -e.angles[PITCH]; // sigh. image_t skin; // select skin if (currententity.skin != null) skin = currententity.skin; // custom player skin else { if (currententity.skinnum >= qfiles.MAX_MD2SKINS) skin = currentmodel.skins[0]; else { skin = currentmodel.skins[currententity.skinnum]; if (skin == null) skin = currentmodel.skins[0]; } } if (skin == null) skin = r_notexture; // fallback... GL_Bind(skin.texnum); // draw it GL11.glShadeModel(GL11.GL_SMOOTH); GL_TexEnv(GL11.GL_MODULATE); if ((currententity.flags & Defines.RF_TRANSLUCENT) != 0) { GL11.glEnable(GL11.GL_BLEND); } if ((currententity.frame >= paliashdr.num_frames) || (currententity.frame < 0)) { VID.Printf(Defines.PRINT_ALL, "R_DrawAliasModel " + currentmodel.name + ": no such frame " + currententity.frame + '\n'); currententity.frame = 0; currententity.oldframe = 0; } if ((currententity.oldframe >= paliashdr.num_frames) || (currententity.oldframe < 0)) { VID.Printf(Defines.PRINT_ALL, "R_DrawAliasModel " + currentmodel.name + ": no such oldframe " + currententity.oldframe + '\n'); currententity.frame = 0; currententity.oldframe = 0; } if (r_lerpmodels.value == 0.0f) currententity.backlerp = 0; GL_DrawAliasFrameLerp(paliashdr, currententity.backlerp); GL_TexEnv(GL11.GL_REPLACE); GL11.glShadeModel(GL11.GL_FLAT); GL11.glPopMatrix(); if ((currententity.flags & Defines.RF_WEAPONMODEL) != 0 && (r_lefthand.value == 1.0F)) { GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glPopMatrix(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glCullFace(GL11.GL_FRONT); } if ((currententity.flags & Defines.RF_TRANSLUCENT) != 0) { GL11.glDisable(GL11.GL_BLEND); } if ((currententity.flags & Defines.RF_DEPTHHACK) != 0) GL11.glDepthRange(gldepthmin, gldepthmax); if (gl_shadows.value != 0.0f && (currententity.flags & (Defines.RF_TRANSLUCENT | Defines.RF_WEAPONMODEL)) == 0) { GL11.glPushMatrix(); R_RotateForEntity(e); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_BLEND); GL11.glColor4f(0, 0, 0, 0.5f); GL_DrawAliasShadow(paliashdr, currententity.frame); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); GL11.glPopMatrix(); } GL11.glColor4f(1, 1, 1, 1); }
From source file:org.fenggui.binding.render.lwjgl.LWJGLOpenGL.java
License:Open Source License
public void setTexEnvModeModulate() { GL11.glTexEnvf(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, GL11.GL_MODULATE); //GL11.glTexEnvf(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, GL11.GL_MODULATE); }
From source file:org.free.jake2.render.lwjgl.Main.java
License:Open Source License
/** * R_DrawSpriteModel/*from w w w . j av a2 s.c om*/ */ void R_DrawSpriteModel(entity_t e) { float alpha = 1.0F; qfiles.dsprframe_t frame; qfiles.dsprite_t psprite; // don't even bother culling, because it's just a single // polygon without a surface cache psprite = (qfiles.dsprite_t) currentmodel.extradata; e.frame %= psprite.numframes; frame = psprite.frames[e.frame]; if ((e.flags & Defines.RF_TRANSLUCENT) != 0) { alpha = e.alpha; } if (alpha != 1.0F) { GL11.glEnable(GL11.GL_BLEND); } GL11.glColor4f(1, 1, 1, alpha); GL_Bind(currentmodel.skins[e.frame].texnum); GL_TexEnv(GL11.GL_MODULATE); if (alpha == 1.0) { GL11.glEnable(GL11.GL_ALPHA_TEST); } else { GL11.glDisable(GL11.GL_ALPHA_TEST); } GL11.glBegin(GL11.GL_QUADS); GL11.glTexCoord2f(0, 1); Math3D.VectorMA(e.origin, -frame.origin_y, vup, point); Math3D.VectorMA(point, -frame.origin_x, vright, point); GL11.glVertex3f(point[0], point[1], point[2]); GL11.glTexCoord2f(0, 0); Math3D.VectorMA(e.origin, frame.height - frame.origin_y, vup, point); Math3D.VectorMA(point, -frame.origin_x, vright, point); GL11.glVertex3f(point[0], point[1], point[2]); GL11.glTexCoord2f(1, 0); Math3D.VectorMA(e.origin, frame.height - frame.origin_y, vup, point); Math3D.VectorMA(point, frame.width - frame.origin_x, vright, point); GL11.glVertex3f(point[0], point[1], point[2]); GL11.glTexCoord2f(1, 1); Math3D.VectorMA(e.origin, -frame.origin_y, vup, point); Math3D.VectorMA(point, frame.width - frame.origin_x, vright, point); GL11.glVertex3f(point[0], point[1], point[2]); GL11.glEnd(); GL11.glDisable(GL11.GL_ALPHA_TEST); GL_TexEnv(GL11.GL_REPLACE); if (alpha != 1.0F) { GL11.glDisable(GL11.GL_BLEND); } GL11.glColor4f(1, 1, 1, 1); }
From source file:org.free.jake2.render.lwjgl.Mesh.java
License:Open Source License
/** * R_DrawAliasModel/* ww w . j av a 2s .co m*/ */ void R_DrawAliasModel(entity_t e) { if ((e.flags & Defines.RF_WEAPONMODEL) == 0) { if (R_CullAliasModel(e)) { return; } } if ((e.flags & Defines.RF_WEAPONMODEL) != 0) { if (r_lefthand.value == 2.0f) { return; } } qfiles.dmdl_t paliashdr = (qfiles.dmdl_t) currentmodel.extradata; // // get lighting information // // PMM - rewrote, reordered to handle new shells & mixing // PMM - 3.20 code .. replaced with original way of doing it to keep mod authors happy // int i; if ((currententity.flags & (Defines.RF_SHELL_HALF_DAM | Defines.RF_SHELL_GREEN | Defines.RF_SHELL_RED | Defines.RF_SHELL_BLUE | Defines.RF_SHELL_DOUBLE)) != 0) { Math3D.VectorClear(shadelight); if ((currententity.flags & Defines.RF_SHELL_HALF_DAM) != 0) { shadelight[0] = 0.56f; shadelight[1] = 0.59f; shadelight[2] = 0.45f; } if ((currententity.flags & Defines.RF_SHELL_DOUBLE) != 0) { shadelight[0] = 0.9f; shadelight[1] = 0.7f; } if ((currententity.flags & Defines.RF_SHELL_RED) != 0) { shadelight[0] = 1.0f; } if ((currententity.flags & Defines.RF_SHELL_GREEN) != 0) { shadelight[1] = 1.0f; } if ((currententity.flags & Defines.RF_SHELL_BLUE) != 0) { shadelight[2] = 1.0f; } } else if ((currententity.flags & Defines.RF_FULLBRIGHT) != 0) { for (i = 0; i < 3; i++) { shadelight[i] = 1.0f; } } else { R_LightPoint(currententity.origin, shadelight); // player lighting hack for communication back to server // big hack! if ((currententity.flags & Defines.RF_WEAPONMODEL) != 0) { // pick the greatest component, which should be the same // as the mono value returned by software if (shadelight[0] > shadelight[1]) { if (shadelight[0] > shadelight[2]) { r_lightlevel.value = 150 * shadelight[0]; } else { r_lightlevel.value = 150 * shadelight[2]; } } else { if (shadelight[1] > shadelight[2]) { r_lightlevel.value = 150 * shadelight[1]; } else { r_lightlevel.value = 150 * shadelight[2]; } } } if (gl_monolightmap.string.charAt(0) != '0') { float s = shadelight[0]; if (s < shadelight[1]) { s = shadelight[1]; } if (s < shadelight[2]) { s = shadelight[2]; } shadelight[0] = s; shadelight[1] = s; shadelight[2] = s; } } if ((currententity.flags & Defines.RF_MINLIGHT) != 0) { for (i = 0; i < 3; i++) { if (shadelight[i] > 0.1f) { break; } } if (i == 3) { shadelight[0] = 0.1f; shadelight[1] = 0.1f; shadelight[2] = 0.1f; } } if ((currententity.flags & Defines.RF_GLOW) != 0) { // bonus items will pulse with time float scale; float min; scale = (float) (0.1f * Math.sin(r_newrefdef.time * 7)); for (i = 0; i < 3; i++) { min = shadelight[i] * 0.8f; shadelight[i] += scale; if (shadelight[i] < min) { shadelight[i] = min; } } } // ================= // PGM ir goggles color override if ((r_newrefdef.rdflags & Defines.RDF_IRGOGGLES) != 0 && (currententity.flags & Defines.RF_IR_VISIBLE) != 0) { shadelight[0] = 1.0f; shadelight[1] = 0.0f; shadelight[2] = 0.0f; } // PGM // ================= shadedots = r_avertexnormal_dots[((int) (currententity.angles[1] * (SHADEDOT_QUANT / 360.0))) & (SHADEDOT_QUANT - 1)]; float an = (float) (currententity.angles[1] / 180 * Math.PI); shadevector[0] = (float) Math.cos(-an); shadevector[1] = (float) Math.sin(-an); shadevector[2] = 1; Math3D.VectorNormalize(shadevector); // // locate the proper data // c_alias_polys += paliashdr.num_tris; // // draw all the triangles // if ((currententity.flags & Defines.RF_DEPTHHACK) != 0) // hack the depth range to prevent view model from poking into walls { GL11.glDepthRange(gldepthmin, gldepthmin + 0.3 * (gldepthmax - gldepthmin)); } if ((currententity.flags & Defines.RF_WEAPONMODEL) != 0 && (r_lefthand.value == 1.0f)) { GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glPushMatrix(); GL11.glLoadIdentity(); GL11.glScalef(-1, 1, 1); MYgluPerspective(r_newrefdef.fov_y, (float) r_newrefdef.width / r_newrefdef.height, 4, 4096); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glCullFace(GL11.GL_BACK); } GL11.glPushMatrix(); e.angles[PITCH] = -e.angles[PITCH]; // sigh. R_RotateForEntity(e); e.angles[PITCH] = -e.angles[PITCH]; // sigh. image_t skin; // select skin if (currententity.skin != null) { skin = currententity.skin; // custom player skin } else { if (currententity.skinnum >= qfiles.MAX_MD2SKINS) { skin = currentmodel.skins[0]; } else { skin = currentmodel.skins[currententity.skinnum]; if (skin == null) { skin = currentmodel.skins[0]; } } } if (skin == null) { skin = r_notexture; // fallback... } GL_Bind(skin.texnum); // draw it GL11.glShadeModel(GL11.GL_SMOOTH); GL_TexEnv(GL11.GL_MODULATE); if ((currententity.flags & Defines.RF_TRANSLUCENT) != 0) { GL11.glEnable(GL11.GL_BLEND); } if ((currententity.frame >= paliashdr.num_frames) || (currententity.frame < 0)) { VID.Printf(Defines.PRINT_ALL, "R_DrawAliasModel " + currentmodel.name + ": no such frame " + currententity.frame + '\n'); currententity.frame = 0; currententity.oldframe = 0; } if ((currententity.oldframe >= paliashdr.num_frames) || (currententity.oldframe < 0)) { VID.Printf(Defines.PRINT_ALL, "R_DrawAliasModel " + currentmodel.name + ": no such oldframe " + currententity.oldframe + '\n'); currententity.frame = 0; currententity.oldframe = 0; } if (r_lerpmodels.value == 0.0f) { currententity.backlerp = 0; } GL_DrawAliasFrameLerp(paliashdr, currententity.backlerp); GL_TexEnv(GL11.GL_REPLACE); GL11.glShadeModel(GL11.GL_FLAT); GL11.glPopMatrix(); if ((currententity.flags & Defines.RF_WEAPONMODEL) != 0 && (r_lefthand.value == 1.0F)) { GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glPopMatrix(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glCullFace(GL11.GL_FRONT); } if ((currententity.flags & Defines.RF_TRANSLUCENT) != 0) { GL11.glDisable(GL11.GL_BLEND); } if ((currententity.flags & Defines.RF_DEPTHHACK) != 0) { GL11.glDepthRange(gldepthmin, gldepthmax); } if (gl_shadows.value != 0.0f && (currententity.flags & (Defines.RF_TRANSLUCENT | Defines.RF_WEAPONMODEL)) == 0) { GL11.glPushMatrix(); R_RotateForEntity(e); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_BLEND); GL11.glColor4f(0, 0, 0, 0.5f); GL_DrawAliasShadow(paliashdr, currententity.frame); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); GL11.glPopMatrix(); } GL11.glColor4f(1, 1, 1, 1); }
From source file:org.free.jake2.render.lwjgl.Surf.java
License:Open Source License
/** * R_RenderBrushPoly/*w ww . j a va 2 s. com*/ */ void R_RenderBrushPoly(msurface_t fa) { c_brush_polys++; image_t image = R_TextureAnimation(fa.texinfo); if ((fa.flags & Defines.SURF_DRAWTURB) != 0) { GL_Bind(image.texnum); // warp texture, no lightmaps GL_TexEnv(GL11.GL_MODULATE); GL11.glColor4f(gl_state.inverse_intensity, gl_state.inverse_intensity, gl_state.inverse_intensity, 1.0F); EmitWaterPolys(fa); GL_TexEnv(GL11.GL_REPLACE); return; } else { GL_Bind(image.texnum); GL_TexEnv(GL11.GL_REPLACE); } // ====== // PGM if ((fa.texinfo.flags & Defines.SURF_FLOWING) != 0) { DrawGLFlowingPoly(fa.polys); } else { DrawGLPoly(fa.polys); } // PGM // ====== // ersetzt goto boolean gotoDynamic = false; /* ** check for lightmap modification */ int maps; for (maps = 0; maps < Defines.MAXLIGHTMAPS && fa.styles[maps] != (byte) 255; maps++) { if (r_newrefdef.lightstyles[fa.styles[maps] & 0xFF].white != fa.cached_light[maps]) { gotoDynamic = true; break; } } // this is a hack from cwei if (maps == 4) { maps--; } // dynamic this frame or dynamic previously boolean is_dynamic = false; if (gotoDynamic || (fa.dlightframe == r_framecount)) { // label dynamic: if (gl_dynamic.value != 0) { if ((fa.texinfo.flags & (Defines.SURF_SKY | Defines.SURF_TRANS33 | Defines.SURF_TRANS66 | Defines.SURF_WARP)) == 0) { is_dynamic = true; } } } if (is_dynamic) { if (((fa.styles[maps] & 0xFF) >= 32 || fa.styles[maps] == 0) && (fa.dlightframe != r_framecount)) { // ist ersetzt durch temp2: unsigned temp[34*34]; int smax, tmax; smax = (fa.extents[0] >> 4) + 1; tmax = (fa.extents[1] >> 4) + 1; R_BuildLightMap(fa, temp2, smax); R_SetCacheState(fa); GL_Bind(gl_state.lightmap_textures + fa.lightmaptexturenum); GL11.glTexSubImage2D(GL11.GL_TEXTURE_2D, 0, fa.light_s, fa.light_t, smax, tmax, GL_LIGHTMAP_FORMAT, GL11.GL_UNSIGNED_BYTE, temp2); fa.lightmapchain = gl_lms.lightmap_surfaces[fa.lightmaptexturenum]; gl_lms.lightmap_surfaces[fa.lightmaptexturenum] = fa; } else { fa.lightmapchain = gl_lms.lightmap_surfaces[0]; gl_lms.lightmap_surfaces[0] = fa; } } else { fa.lightmapchain = gl_lms.lightmap_surfaces[fa.lightmaptexturenum]; gl_lms.lightmap_surfaces[fa.lightmaptexturenum] = fa; } }
From source file:org.free.jake2.render.lwjgl.Surf.java
License:Open Source License
/** * R_DrawAlphaSurfaces// w w w. ja v a 2 s . c o m * Draw water surfaces and windows. * The BSP tree is waled front to back, so unwinding the chain * of alpha_surfaces will draw back to front, giving proper ordering. */ void R_DrawAlphaSurfaces() { r_world_matrix.clear(); // // go back to the world matrix // GL11.glLoadMatrix(r_world_matrix); GL11.glEnable(GL11.GL_BLEND); GL_TexEnv(GL11.GL_MODULATE); // the textures are prescaled up for a better lighting range, // so scale it back down float intens = gl_state.inverse_intensity; GL11.glInterleavedArrays(GL11.GL_T2F_V3F, Polygon.BYTE_STRIDE, globalPolygonInterleavedBuf); for (msurface_t s = r_alpha_surfaces; s != null; s = s.texturechain) { GL_Bind(s.texinfo.image.texnum); c_brush_polys++; if ((s.texinfo.flags & Defines.SURF_TRANS33) != 0) { GL11.glColor4f(intens, intens, intens, 0.33f); } else if ((s.texinfo.flags & Defines.SURF_TRANS66) != 0) { GL11.glColor4f(intens, intens, intens, 0.66f); } else { GL11.glColor4f(intens, intens, intens, 1); } if ((s.flags & Defines.SURF_DRAWTURB) != 0) { EmitWaterPolys(s); } else if ((s.texinfo.flags & Defines.SURF_FLOWING) != 0) // PGM 9/16/98 { DrawGLFlowingPoly(s.polys); // PGM } else { DrawGLPoly(s.polys); } } GL_TexEnv(GL11.GL_REPLACE); GL11.glColor4f(1, 1, 1, 1); GL11.glDisable(GL11.GL_BLEND); r_alpha_surfaces = null; }
From source file:org.free.jake2.render.lwjgl.Surf.java
License:Open Source License
/** * R_DrawBrushModel//from w w w . java 2 s . c om */ 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(); GL13.glClientActiveTexture(GL_TEXTURE1); GL11.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY); GL_EnableMultitexture(false); GL11.glPopMatrix(); }
From source file:org.free.jake2.render.lwjgl.Surf.java
License:Open Source License
/** * R_DrawWorld//from w ww . j a v a 2 s .c o m */ 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 GL13.glClientActiveTexture(GL_TEXTURE1); GL11.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY); GL_EnableMultitexture(false); DrawTextureChains(); R_DrawSkyBox(); R_DrawTriangleOutlines(); }
From source file:org.jogamp.glg2d.impl.gl2.GL2ImageDrawer.java
License:Apache License
@Override protected void begin(Texture texture, AffineTransform xform, Color bgcolor) { GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, GL11.GL_MODULATE); GL11.glTexParameterf(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, GL11.GL_BLEND); /*/* w w w . ja v a 2 s . co m*/ * FIXME This is unexpected since we never disable blending, but in some * cases it interacts poorly with multiple split panes, scroll panes and the * text renderer to disable blending. */ g2d.setComposite(g2d.getComposite()); GL11.glEnable(GL11.GL_TEXTURE_2D); texture.bind(); savedTransform = null; if (xform != null && !xform.isIdentity()) { savedTransform = g2d.getTransform(); g2d.transform(xform); } g2d.getColorHelper().setColorRespectComposite(bgcolor == null ? Color.white : bgcolor); }
From source file:org.jtrfp.mtmx.internal.TextureLoader.java
License:Open Source License
@Override public ITexture load(RawImage rawImage) throws EngineException { BufferedImage bufferedImage = null; try {//from ww w.jav a2 s . c om bufferedImage = rawImage.toImage(); } catch (FileStoreException e) { throw new EngineException("Could not convert texture image.", e); } final int type = GL11.GL_TEXTURE_2D; final int width = bufferedImage.getWidth(); final int height = bufferedImage.getHeight(); int textureId = createTextureId(); Texture texture = new Texture(type, textureId, width, height); GL11.glBindTexture(type, textureId); // really neccessary here? ByteBuffer buffer = makeByteBuffer(bufferedImage, width, height); GL11.glTexParameteri(type, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR); GL11.glTexParameteri(type, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR); GL11.glTexEnvf(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, GL11.GL_MODULATE); GL11.glTexImage2D(type, 0, GL11.GL_RGB, width, height, 0, GL11.GL_RGB, GL11.GL_UNSIGNED_BYTE, buffer); System.out.println("Created texture " + textureId); return texture; }