List of usage examples for org.lwjgl.opengl GL11 glColorMask
public static void glColorMask(@NativeType("GLboolean") boolean red, @NativeType("GLboolean") boolean green, @NativeType("GLboolean") boolean blue, @NativeType("GLboolean") boolean alpha)
From source file:com.mtbs3d.minecrift.VRRenderer.java
License:LGPL
public void renderWorld(float renderPartialTicks, long nextFrameTime, int renderSceneNumber) { RenderGlobal renderGlobal = this.mc.renderGlobal; EffectRenderer effectRenderer = this.mc.effectRenderer; EntityLivingBase renderViewEntity = this.mc.renderViewEntity; //TODO: fog color isn't quite right yet when eyes split water/air this.updateFogColor(renderPartialTicks); GL11.glClearColor(fogColorRed, fogColorGreen, fogColorBlue, 0.5f); GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); GL11.glEnable(GL11.GL_CULL_FACE);//from w w w . j av a2 s . co m GL11.glEnable(GL11.GL_DEPTH_TEST); //mc.checkGLError("FBO init"); this.mc.mcProfiler.startSection("lightTex"); if (this.lightmapUpdateNeeded) { this.updateLightmap(renderPartialTicks); } ActiveRenderInfo.updateRenderInfo(this.mc.thePlayer, this.mc.gameSettings.thirdPersonView == 2); this.mc.mcProfiler.endStartSection("frustrum"); ClippingHelperImpl.getInstance(); // setup clip, using current modelview / projection matrices if (!Config.isSkyEnabled() && !Config.isSunMoonEnabled() && !Config.isStarsEnabled()) { GL11.glDisable(GL11.GL_BLEND); } else { this.setupFog(-1, renderPartialTicks); this.mc.mcProfiler.endStartSection("sky"); renderGlobal.renderSky(renderPartialTicks); } GL11.glEnable(GL11.GL_FOG); this.setupFog(1, renderPartialTicks); if (this.mc.gameSettings.ambientOcclusion != 0) { GL11.glShadeModel(GL11.GL_SMOOTH); } this.mc.mcProfiler.endStartSection("culling"); Frustrum frustrum = new Frustrum(); frustrum.setPosition(renderOriginX, renderOriginY, renderOriginZ); this.mc.renderGlobal.clipRenderersByFrustum(frustrum, renderPartialTicks); if (renderSceneNumber == 0) { this.mc.mcProfiler.endStartSection("updatechunks"); while (!this.mc.renderGlobal.updateRenderers(renderViewEntity, false) && nextFrameTime != 0L) { long var15 = nextFrameTime - System.nanoTime(); if (var15 < 0L || var15 > 1000000000L) { break; } } } if (renderViewEntity.posY < 128.0D) { this.renderCloudsCheck(renderGlobal, renderPartialTicks); } this.mc.mcProfiler.endStartSection("prepareterrain"); this.setupFog(0, renderPartialTicks); GL11.glEnable(GL11.GL_FOG); this.mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture); RenderHelper.disableStandardItemLighting(); this.mc.mcProfiler.endStartSection("terrain"); renderGlobal.sortAndRender(renderViewEntity, 0, (double) renderPartialTicks); GL11.glShadeModel(GL11.GL_FLAT); boolean var16 = Reflector.ForgeHooksClient.exists(); EntityPlayer var18; if (this.debugViewDirection == 0) { RenderHelper.enableStandardItemLighting(); this.mc.mcProfiler.endStartSection("entities"); if (var16) { Reflector.callVoid(Reflector.ForgeHooksClient_setRenderPass, new Object[] { Integer.valueOf(0) }); } //TODO: multiple render passes for entities? renderGlobal.renderEntities(renderViewEntity.getPosition(renderPartialTicks), frustrum, renderPartialTicks); if (var16) { Reflector.callVoid(Reflector.ForgeHooksClient_setRenderPass, new Object[] { Integer.valueOf(-1) }); } RenderHelper.disableStandardItemLighting(); } GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glDepthMask(true); this.setupFog(0, renderPartialTicks); GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_CULL_FACE); this.mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture); WrUpdates.resumeBackgroundUpdates(); if (Config.isWaterFancy()) { this.mc.mcProfiler.endStartSection("water"); if (this.mc.gameSettings.ambientOcclusion != 0) { GL11.glShadeModel(GL11.GL_SMOOTH); } GL11.glColorMask(false, false, false, false); int var17 = renderGlobal.renderAllSortedRenderers(1, (double) renderPartialTicks); if (this.mc.gameSettings.anaglyph) { if (anaglyphField == 0) { GL11.glColorMask(false, true, true, true); } else { GL11.glColorMask(true, false, false, true); } } else { GL11.glColorMask(true, true, true, true); } if (var17 > 0) { renderGlobal.renderAllSortedRenderers(1, (double) renderPartialTicks); } GL11.glShadeModel(GL11.GL_FLAT); } else { this.mc.mcProfiler.endStartSection("water"); renderGlobal.renderAllSortedRenderers(1, (double) renderPartialTicks); } WrUpdates.pauseBackgroundUpdates(); if (var16 && this.debugViewDirection == 0) { RenderHelper.enableStandardItemLighting(); this.mc.mcProfiler.endStartSection("entities"); Reflector.callVoid(Reflector.ForgeHooksClient_setRenderPass, new Object[] { Integer.valueOf(1) }); this.mc.renderGlobal.renderEntities(renderViewEntity.getPosition(renderPartialTicks), frustrum, renderPartialTicks); Reflector.callVoid(Reflector.ForgeHooksClient_setRenderPass, new Object[] { Integer.valueOf(-1) }); RenderHelper.disableStandardItemLighting(); } GL11.glDepthMask(true); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_BLEND); boolean renderOutline = this.mc.vrSettings.alwaysRenderBlockOutline || !this.mc.gameSettings.hideGUI; if (this.mc.currentScreen == null && this.cameraZoom == 1.0D && renderViewEntity instanceof EntityPlayer && this.mc.objectMouseOver != null && !renderViewEntity.isInsideOfMaterial(Material.water) && renderOutline) { var18 = (EntityPlayer) renderViewEntity; GL11.glDisable(GL11.GL_ALPHA_TEST); this.mc.mcProfiler.endStartSection("outline"); if (!var16 || !Reflector.callBoolean(Reflector.ForgeHooksClient_onDrawBlockHighlight, new Object[] { renderGlobal, var18, this.mc.objectMouseOver, Integer.valueOf(0), var18.inventory.getCurrentItem(), Float.valueOf(renderPartialTicks) })) { renderGlobal.drawSelectionBox(var18, this.mc.objectMouseOver, 0, renderPartialTicks); } GL11.glEnable(GL11.GL_ALPHA_TEST); } if (this.mc.currentScreen == null && this.cameraZoom == 1.0D && renderViewEntity instanceof EntityPlayer && !renderViewEntity.isInsideOfMaterial(Material.water) && renderOutline && this.mc.vrSettings.showEntityOutline) { var18 = (EntityPlayer) renderViewEntity; if (var18 != null) { GL11.glDisable(GL11.GL_ALPHA_TEST); this.mc.mcProfiler.endStartSection("entityOutline"); if (this.bb != null) drawBoundingBox(var18, this.bb, renderPartialTicks); GL11.glEnable(GL11.GL_ALPHA_TEST); } } this.mc.mcProfiler.endStartSection("destroyProgress"); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); renderGlobal.drawBlockDamageTexture(Tessellator.instance, renderViewEntity, renderPartialTicks); GL11.glDisable(GL11.GL_BLEND); this.mc.mcProfiler.endStartSection("weather"); this.renderRainSnow(renderPartialTicks); GL11.glDisable(GL11.GL_FOG); if (renderViewEntity.posY >= 128.0D) { this.renderCloudsCheck(renderGlobal, renderPartialTicks); } this.enableLightmap((double) renderPartialTicks); this.mc.mcProfiler.endStartSection("litParticles"); RenderHelper.enableStandardItemLighting(); effectRenderer.renderLitParticles(renderViewEntity, renderPartialTicks); RenderHelper.disableStandardItemLighting(); this.setupFog(0, renderPartialTicks); this.mc.mcProfiler.endStartSection("particles"); effectRenderer.renderParticles(renderViewEntity, renderPartialTicks); this.disableLightmap((double) renderPartialTicks); if (var16) { this.mc.mcProfiler.endStartSection("FRenderLast"); Reflector.callVoid(Reflector.ForgeHooksClient_dispatchRenderLast, new Object[] { renderGlobal, Float.valueOf(renderPartialTicks) }); } if (this.mc.vrSettings.renderFullFirstPersonModel == false) { GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT); this.renderHand(renderPartialTicks, renderSceneNumber); } GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); //white crosshair, with blending //Draw crosshair boolean renderCrosshair = this.mc.vrSettings.alwaysRenderInGameCrosshair || !this.mc.gameSettings.hideGUI; if (this.mc.currentScreen == null && this.mc.gameSettings.thirdPersonView == 0 && renderCrosshair) { this.mc.mcProfiler.endStartSection("crosshair"); float crossDepth = (float) Math.sqrt((crossX * crossX + crossY * crossY + crossZ * crossZ)); float scale = 0.025f * crossDepth * this.mc.vrSettings.crosshairScale; GL11.glPushMatrix(); GL11.glTranslatef(crossX, crossY, crossZ); GL11.glRotatef(-this.aimYaw, 0.0F, 1.0F, 0.0F); GL11.glRotatef(this.aimPitch, 1.0F, 0.0F, 0.0F); if (this.mc.vrSettings.crosshairRollsWithHead) GL11.glRotatef(this.cameraRoll, 0.0F, 0.0F, 1.0F); GL11.glScalef(-scale, -scale, scale); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_ONE_MINUS_DST_COLOR, GL11.GL_ONE_MINUS_SRC_COLOR); this.mc.getTextureManager().bindTexture(Gui.icons); float var7 = 0.00390625F; float var8 = 0.00390625F; Tessellator.instance.startDrawingQuads(); Tessellator.instance.addVertexWithUV(-1, +1, 0, 0, 16 * var8); Tessellator.instance.addVertexWithUV(+1, +1, 0, 16 * var7, 16 * var8); Tessellator.instance.addVertexWithUV(+1, -1, 0, 16 * var7, 0); Tessellator.instance.addVertexWithUV(-1, -1, 0, 0, 0); Tessellator.instance.draw(); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glPopMatrix(); //mc.checkGLError("crosshair"); } this.mc.mcProfiler.endSection(); }
From source file:glvis.renderers.BeautifulGlitch.java
@Override public void render() { Display.sync(120);//from ww w . j ava 2 s . c o m if (initial) { GL11.glClear(16384); initial = false; } int LIGHT_POINTS = 288; // 1152 // LIGHT_POINTS = 2; // int LIGHT_POINTS = 1152; // 1152 float LIGHT_POINT_SEPARATION = 4.42f; float LIGHT_Y = 256f; float LIGHT_X = 0f; short raw = 0; float fraw = 0; float calc = 0; float distx = 0; float disty = 0; boolean swch = false; int hak = 0; int mx = MouseInfo.getPointerInfo().getLocation().x + 320; int my = MouseInfo.getPointerInfo().getLocation().y + 180; short rraw = 0; float vdist = 0f; boolean chswch = false; GL11.glEnable(GL11.GL_BLEND); //Enable blending. GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); if (initial) { initial = false; GL11.glColor4f(0f, 0f, 0f, 1f); } else GL11.glColor4f(0f, 0f, 0f, 0.2f); GL11.glBegin(GL11.GL_QUADS); GL11.glVertex2f(0, 0); GL11.glVertex2f(1280, 0); GL11.glVertex2f(1280, 720); GL11.glVertex2f(0, 720); GL11.glEnd(); short[] samp = provider.getCurrentSample(); int samplen = provider.getCurrentSampleLength(); GL11.glColor4f(1f, 1f, 1f, 1f); // GL11.glPolygonMode( GL11.GL_FRONT_AND_BACK, GL11.GL_LINE ); float a1 = 0f, a2 = 0f, a3 = 0f, a4 = 0f, a5 = 0f, a6 = 0f, a7 = 0f, a8 = 0f, a9 = 0f; for (int ie = 0; ie < LIGHT_POINTS; ie++) { //GL11.glColor4f(((float)ie)/LIGHT_POINTS,((float)ie)/LIGHT_POINTS,((float)ie)/LIGHT_POINTS,1f); // this.skip = false; itra++; itra %= samplen; raw = samp[itra]; rraw = samp[samplen - (itra + 1)]; mx = 1220 + raw / 764; my = 690 + rraw / 764; // itra ++; // itra %= Player.samplen; // raw = Player.samp[itra]; // rraw = Player.samp[Player.samplen-(itra+1)]; // itra ++; // itra %= Player.samplen; // raw += Player.samp[itra]; // rraw += Player.samp[Player.samplen-(itra+1)]; // raw/=2; // rraw/=2; // // phys_x[ie]/=1.5f-rand[itra]/2; // phys_y[ie]/=1.5f-rand[Player.samplen-itra]/2; distx = (mx / 2 - 1280 / 2) - loc_x[ie]; disty = (my / 2 - 720 / 2) - loc_y[ie]; phys_x[ie] /= distx / 20f; phys_y[ie] /= disty / 20f; // if(Math.abs(distx) < 1)distx *= 100; // if(Math.abs(disty) < 1)disty *= 100; phys_x[ie] += distx;//+ raw/96f; phys_y[ie] += disty;//+ rraw/96f; // phys_x[ie] += distx + raw/128f; // phys_y[ie] += disty + rraw/128f; loc_x[ie] += phys_x[ie] / 16f; loc_y[ie] += phys_y[ie] / 16f; vdist = Math.abs(distx) + Math.abs(disty); vdist /= 4f; R[ie] /= 1.08; G[ie] /= 1.08; B[ie] /= 1.08; R[ie] += ((Math.abs(loc_y[ie] % 2f) + Math.abs(loc_x[ie] % 2f)) * vdist) / 1024f; G[ie] += ((loc_x[ie] % 2f + Math.abs(loc_y[ie] % 2f)) * vdist) / 512f; B[ie] += ((Math.abs(loc_x[ie] % 2f) + loc_y[ie] % 2f) * vdist) / 512f; LIGHT_X = loc_x[ie] * 2 + 1280 / 2; LIGHT_Y = loc_y[ie] * 2 + 720 / 2; GL11.glBegin(GL11.GL_TRIANGLE_STRIP); a1 = (R[ie] + G[ie] + B[ie]) / 3f; a2 = (lR[ie] + lG[ie] + lB[ie]) / 3f; a3 = (lR2[ie] + lG2[ie] + lB2[ie]) / 3f; a4 = (lR3[ie] + lG3[ie] + lB3[ie]) / 3f; a5 = (lR4[ie] + lG4[ie] + lB4[ie]) / 3f; a6 = (lR5[ie] + lG5[ie] + lB5[ie]) / 3f; a7 = (lR6[ie] + lG6[ie] + lB6[ie]) / 3f; GL11.glColor4f(lR6[ie], lG6[ie], lB6[ie], a7); GL11.glVertex2f(lastx6[ie], lasty6[ie]); GL11.glColor4f(lR5[ie], lG5[ie], lB5[ie], a6); GL11.glVertex2f(lastx5[ie], lasty5[ie]); GL11.glColor4f(lR4[ie], lG4[ie], lB4[ie], a5); GL11.glVertex2f(lastx4[ie], lasty4[ie]); GL11.glColor4f(lR3[ie], lG3[ie], lB3[ie], a4); GL11.glVertex2f(lastx3[ie], lasty3[ie]); GL11.glColor4f(lR2[ie], lG2[ie], lB2[ie], a3); GL11.glVertex2f(lastx2[ie], lasty2[ie]); GL11.glColor4f(lR[ie], lG[ie], lB[ie], a2); GL11.glVertex2f(lastx[ie], lasty[ie]); GL11.glColor4f(R[ie] * 2, G[ie] * 2, B[ie] * 2, a1); GL11.glVertex2f(LIGHT_X, LIGHT_Y); lastx9[ie] = lastx8[ie]; lasty9[ie] = lasty8[ie]; lastx8[ie] = lastx7[ie]; lasty8[ie] = lasty7[ie]; lastx7[ie] = lastx6[ie]; lasty7[ie] = lasty6[ie]; lastx6[ie] = lastx5[ie]; lasty6[ie] = lasty5[ie]; lastx5[ie] = lastx4[ie]; lasty5[ie] = lasty4[ie]; lastx4[ie] = lastx3[ie]; lasty4[ie] = lasty3[ie]; lastx3[ie] = lastx2[ie]; lasty3[ie] = lasty2[ie]; lastx2[ie] = lastx[ie]; lasty2[ie] = lasty[ie]; // lastx[ie] = LIGHT_X; // lasty[ie] = LIGHT_Y; lastx[ie] = LIGHT_X; lasty[ie] = LIGHT_Y; lR9[ie] = lR8[ie]; lG9[ie] = lG8[ie]; lB9[ie] = lB8[ie]; lR8[ie] = lR7[ie]; lG8[ie] = lG7[ie]; lB8[ie] = lB7[ie]; lR7[ie] = lR6[ie]; lG7[ie] = lG6[ie]; lB7[ie] = lB6[ie]; lR6[ie] = lR5[ie] / 1.2f; lG6[ie] = lG5[ie] / 1.2f; lB6[ie] = lB5[ie] / 1.2f; lR5[ie] = lR4[ie] / 1.2f; lG5[ie] = lG4[ie] / 1.2f; lB5[ie] = lB4[ie] / 1.2f; lR4[ie] = lR3[ie] / 1.2f; lG4[ie] = lG3[ie] / 1.2f; lB4[ie] = lB3[ie] / 1.2f; lR3[ie] = lR2[ie] / 1.2f; lG3[ie] = lG2[ie] / 1.2f; lB3[ie] = lB2[ie] / 1.2f; lR2[ie] = lR[ie] / 1.2f; lG2[ie] = lG[ie] / 1.2f; lB2[ie] = lB[ie] / 1.2f; lR[ie] = R[ie] * 2; lG[ie] = G[ie] * 2; lB[ie] = B[ie] * 2; GL11.glEnd(); } GL11.glDisable(GL11.GL_BLEND); //Enable blending. for (int ie = 0; ie < LIGHT_POINTS; ie++) { // LIGHT_X = loc_x[ie]*4+1280/2; // LIGHT_Y = loc_y[ie]*4+720/2; LIGHT_X = loc_x[ie] * 2 + 1280 / 2; LIGHT_Y = loc_y[ie] * 2 + 720 / 2; GL11.glColorMask(true, true, true, true); GL20.glUseProgram(this.shaderProgram); GL20.glUniform2f(GL20.glGetUniformLocation(this.shaderProgram, (CharSequence) "location"), LIGHT_X, 720.0F - LIGHT_Y); GL20.glUniform3f(GL20.glGetUniformLocation(this.shaderProgram, (CharSequence) "colour"), R[ie] / 9, G[ie] / 9, B[ie] / 9); GL11.glEnable(3042); GL11.glBlendFunc(1, 1); GL11.glBegin(7); GL11.glVertex2f(0.0F, 0.0F); GL11.glVertex2f(0.0F, 720.0F); GL11.glVertex2f(1280.0F, 720.0F); GL11.glVertex2f(1280.0F, 0.0F); GL11.glEnd(); GL11.glDisable(3042); GL20.glUseProgram(0); // GL11.glColor3f(lR9[ie], lG9[ie], lB9[ie]); // GL11.glVertex2f(lastx9[ie], lasty9[ie]); // GL11.glColor3f(lR8[ie], lG8[ie], lB8[ie]); // GL11.glVertex2f(lastx8[ie], lasty8[ie]); // GL11.glColor3f(lR7[ie], lG7[ie], lB7[ie]); // GL11.glVertex2f(lastx7[ie], lasty7[ie]); } // }
From source file:glvis.renderers.DemandingLightningTriangleStrip.java
@Override public void render() { if (initial) { GL11.glClear(16384);/*from w w w . j a v a2 s . c om*/ initial = false; } int LIGHT_POINTS = 288; // 1152 LIGHT_POINTS = 2; // int LIGHT_POINTS = 1152; // 1152 float LIGHT_POINT_SEPARATION = 4.42f; float LIGHT_Y = 256f; float LIGHT_X = 0f; short raw = 0; float fraw = 0; float calc = 0; float distx = 0; float disty = 0; boolean swch = false; int hak = 0; short rraw = 0; float vdist = 0f; boolean chswch = false; GL11.glEnable(GL11.GL_BLEND); //Enable blending. GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); if (initial) { initial = false; GL11.glColor4f(0f, 0f, 0f, 1f); } else GL11.glColor4f(0f, 0f, 0f, 0.01f); GL11.glBegin(GL11.GL_QUADS); GL11.glVertex2f(0, 0); GL11.glVertex2f(1280, 0); GL11.glVertex2f(1280, 720); GL11.glVertex2f(0, 720); short[] samp = provider.getCurrentSample(); int samplen = provider.getCurrentSampleLength(); GL11.glDisable(GL11.GL_BLEND); //Enable blending. GL11.glColor4f(1f, 1f, 1f, 1f); // GL11.glPolygonMode( GL11.GL_FRONT_AND_BACK, GL11.GL_LINE ); for (int ie = 0; ie < LIGHT_POINTS; ie++) { GL11.glBegin(GL11.GL_TRIANGLE_STRIP); //GL11.glColor4f(((float)ie)/LIGHT_POINTS,((float)ie)/LIGHT_POINTS,((float)ie)/LIGHT_POINTS,1f); itra++; itra %= samplen; raw = samp[itra]; rraw = samp[samplen - (itra + 1)]; phys_x[ie] /= 2f; phys_y[ie] /= 2f; distx = -loc_x[ie]; disty = -loc_y[ie]; // phys_x[ie] += distx + raw/64f; // phys_y[ie] += disty + rraw/64f; phys_x[ie] += distx + raw / 64f; phys_y[ie] += disty + rraw / 64f; loc_x[ie] += phys_x[ie] / 16f; loc_y[ie] += phys_y[ie] / 16f; LIGHT_X = loc_x[ie] * 4 + 1280 / 2; LIGHT_Y = loc_y[ie] * 4 + 720 / 2; vdist = Math.abs(distx) + Math.abs(disty); vdist /= 4f; R[ie] /= 1.08; G[ie] /= 1.08; B[ie] /= 1.08; R[ie] += ((Math.abs(loc_y[ie] % 2f) + Math.abs(loc_x[ie] % 2f)) * vdist) / 1024f; G[ie] += ((loc_x[ie] % 2f + Math.abs(loc_y[ie] % 2f)) * vdist) / 512f; B[ie] += ((Math.abs(loc_x[ie] % 2f) + loc_y[ie] % 2f) * vdist) / 512f; LIGHT_X = loc_x[ie] * 2 + 1280 / 2; LIGHT_Y = loc_y[ie] * 2 + 720 / 2; // GL11.glColor3f(lR9[ie], lG9[ie], lB9[ie]); // GL11.glVertex2f(lastx9[ie], lasty9[ie]); // GL11.glColor3f(lR8[ie], lG8[ie], lB8[ie]); // GL11.glVertex2f(lastx8[ie], lasty8[ie]); // GL11.glColor3f(lR7[ie], lG7[ie], lB7[ie]); // GL11.glVertex2f(lastx7[ie], lasty7[ie]); GL11.glColor3f(lR6[ie], lG6[ie], lB6[ie]); GL11.glVertex2f(lastx6[ie], lasty6[ie]); GL11.glColor3f(lR5[ie], lG5[ie], lB5[ie]); GL11.glVertex2f(lastx5[ie], lasty5[ie]); GL11.glColor3f(lR4[ie], lG4[ie], lB4[ie]); GL11.glVertex2f(lastx4[ie], lasty4[ie]); GL11.glColor3f(lR3[ie], lG3[ie], lB3[ie]); GL11.glVertex2f(lastx3[ie], lasty3[ie]); GL11.glColor3f(lR2[ie], lG2[ie], lB2[ie]); GL11.glVertex2f(lastx2[ie], lasty2[ie]); GL11.glColor3f(lR[ie], lG[ie], lB[ie]); GL11.glVertex2f(lastx[ie], lasty[ie]); GL11.glColor3f(R[ie] * 2, G[ie] * 2, B[ie] * 2); GL11.glVertex2f(LIGHT_X, LIGHT_Y); lastx9[ie] = lastx8[ie]; lasty9[ie] = lasty8[ie]; lastx8[ie] = lastx7[ie]; lasty8[ie] = lasty7[ie]; lastx7[ie] = lastx6[ie]; lasty7[ie] = lasty6[ie]; lastx6[ie] = lastx5[ie]; lasty6[ie] = lasty5[ie]; lastx5[ie] = lastx4[ie]; lasty5[ie] = lasty4[ie]; lastx4[ie] = lastx3[ie]; lasty4[ie] = lasty3[ie]; lastx3[ie] = lastx2[ie]; lasty3[ie] = lasty2[ie]; lastx2[ie] = lastx[ie]; lasty2[ie] = lasty[ie]; // lastx[ie] = LIGHT_X; // lasty[ie] = LIGHT_Y; lastx[ie] = LIGHT_X; lasty[ie] = LIGHT_Y; lR9[ie] = lR8[ie]; lG9[ie] = lG8[ie]; lB9[ie] = lB8[ie]; lR8[ie] = lR7[ie]; lG8[ie] = lG7[ie]; lB8[ie] = lB7[ie]; lR7[ie] = lR6[ie]; lG7[ie] = lG6[ie]; lB7[ie] = lB6[ie]; lR6[ie] = lR5[ie] / 1.2f; lG6[ie] = lG5[ie] / 1.2f; lB6[ie] = lB5[ie] / 1.2f; lR5[ie] = lR4[ie] / 1.2f; lG5[ie] = lG4[ie] / 1.2f; lB5[ie] = lB4[ie] / 1.2f; lR4[ie] = lR3[ie] / 1.2f; lG4[ie] = lG3[ie] / 1.2f; lB4[ie] = lB3[ie] / 1.2f; lR3[ie] = lR2[ie] / 1.2f; lG3[ie] = lG2[ie] / 1.2f; lB3[ie] = lB2[ie] / 1.2f; lR2[ie] = lR[ie] / 1.2f; lG2[ie] = lG[ie] / 1.2f; lB2[ie] = lB[ie] / 1.2f; lR[ie] = R[ie] * 2; lG[ie] = G[ie] * 2; lB[ie] = B[ie] * 2; GL11.glEnd(); } for (int ie = 0; ie < LIGHT_POINTS; ie++) { LIGHT_X = loc_x[ie] * 2 + 1280 / 2; LIGHT_Y = loc_y[ie] * 2 + 720 / 2; GL11.glColorMask(true, true, true, true); GL20.glUseProgram(this.shaderProgram); GL20.glUniform2f(GL20.glGetUniformLocation(this.shaderProgram, (CharSequence) "location"), LIGHT_X, 720.0F - LIGHT_Y); GL20.glUniform3f(GL20.glGetUniformLocation(this.shaderProgram, (CharSequence) "colour"), R[ie] / 2, G[ie] / 2, B[ie] / 2); GL11.glEnable(3042); GL11.glBlendFunc(1, 1); GL11.glBegin(7); GL11.glVertex2f(0.0F, 0.0F); GL11.glVertex2f(0.0F, 720.0F); GL11.glVertex2f(1280.0F, 720.0F); GL11.glVertex2f(1280.0F, 0.0F); GL11.glEnd(); GL11.glDisable(3042); GL20.glUseProgram(0); } // Display.sync(600); }
From source file:glvis.renderers.HighIntensityAccurate.java
@Override public void render() { Display.sync(120);//from w w w.j ava2s .c o m if (initial) { GL11.glClear(16384); initial = false; } int LIGHT_POINTS = 288; // 1152 // LIGHT_POINTS = 2; // int LIGHT_POINTS = 1152; // 1152 float LIGHT_POINT_SEPARATION = 4.42f; float LIGHT_Y = 256f; float LIGHT_X = 0f; short raw = 0; float fraw = 0; float calc = 0; float distx = 0; float disty = 0; boolean swch = false; int hak = 0; short rraw = 0; float vdist = 0f; boolean chswch = false; GL11.glEnable(GL11.GL_BLEND); //Enable blending. GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); if (initial) { initial = false; GL11.glColor4f(0f, 0f, 0f, 1f); } else GL11.glColor4f(0f, 0f, 0f, 0.4f); GL11.glBegin(GL11.GL_QUADS); GL11.glVertex2f(0, 0); GL11.glVertex2f(1280, 0); GL11.glVertex2f(1280, 720); GL11.glVertex2f(0, 720); GL11.glEnd(); short[] samp = provider.getCurrentSample(); int samplen = provider.getCurrentSampleLength(); GL11.glColor4f(1f, 1f, 1f, 1f); // GL11.glPolygonMode( GL11.GL_FRONT_AND_BACK, GL11.GL_LINE ); float a1 = 0f, a2 = 0f, a3 = 0f, a4 = 0f, a5 = 0f, a6 = 0f, a7 = 0f, a8 = 0f, a9 = 0f; for (int ie = 0; ie < LIGHT_POINTS; ie++) { //GL11.glColor4f(((float)ie)/LIGHT_POINTS,((float)ie)/LIGHT_POINTS,((float)ie)/LIGHT_POINTS,1f); // this.skip = false; itra++; itra %= samplen; raw = samp[itra]; rraw = samp[samplen - (itra + 1)]; // itra ++; // itra %= samplen; // raw = samp[itra]; // rraw = samp[samplen-(itra+1)]; // itra ++; // itra %= samplen; // raw += samp[itra]; // rraw += samp[samplen-(itra+1)]; // raw/=2; // rraw/=2; // phys_x[ie] /= 2f; phys_y[ie] /= 2f; distx = -loc_x[ie]; disty = -loc_y[ie]; phys_x[ie] += distx + raw / 64f; phys_y[ie] += disty + rraw / 64f; // phys_x[ie] += distx + raw/128f; // phys_y[ie] += disty + rraw/128f; loc_x[ie] += phys_x[ie] / 16f; loc_y[ie] += phys_y[ie] / 16f; vdist = Math.abs(distx) + Math.abs(disty); vdist /= 4f; R[ie] /= 1.08; G[ie] /= 1.08; B[ie] /= 1.08; R[ie] += ((Math.abs(loc_y[ie] % 2f) + Math.abs(loc_x[ie] % 2f)) * vdist) / 1024f; G[ie] += ((loc_x[ie] % 2f + Math.abs(loc_y[ie] % 2f)) * vdist) / 512f; B[ie] += ((Math.abs(loc_x[ie] % 2f) + loc_y[ie] % 2f) * vdist) / 512f; LIGHT_X = loc_x[ie] * 2 + 1280 / 2; LIGHT_Y = loc_y[ie] * 2 + 720 / 2; GL11.glBegin(GL11.GL_TRIANGLE_STRIP); a1 = (R[ie] + G[ie] + B[ie]) / 3f; a2 = (lR[ie] + lG[ie] + lB[ie]) / 3f; a3 = (lR2[ie] + lG2[ie] + lB2[ie]) / 3f; a4 = (lR3[ie] + lG3[ie] + lB3[ie]) / 3f; a5 = (lR4[ie] + lG4[ie] + lB4[ie]) / 3f; a6 = (lR5[ie] + lG5[ie] + lB5[ie]) / 3f; a7 = (lR6[ie] + lG6[ie] + lB6[ie]) / 3f; GL11.glColor4f(lR6[ie], lG6[ie], lB6[ie], a7); GL11.glVertex2f(lastx6[ie], lasty6[ie]); GL11.glColor4f(lR5[ie], lG5[ie], lB5[ie], a6); GL11.glVertex2f(lastx5[ie], lasty5[ie]); GL11.glColor4f(lR4[ie], lG4[ie], lB4[ie], a5); GL11.glVertex2f(lastx4[ie], lasty4[ie]); GL11.glColor4f(lR3[ie], lG3[ie], lB3[ie], a4); GL11.glVertex2f(lastx3[ie], lasty3[ie]); GL11.glColor4f(lR2[ie], lG2[ie], lB2[ie], a3); GL11.glVertex2f(lastx2[ie], lasty2[ie]); GL11.glColor4f(lR[ie], lG[ie], lB[ie], a2); GL11.glVertex2f(lastx[ie], lasty[ie]); GL11.glColor4f(R[ie] * 2, G[ie] * 2, B[ie] * 2, a1); GL11.glVertex2f(LIGHT_X, LIGHT_Y); lastx9[ie] = lastx8[ie]; lasty9[ie] = lasty8[ie]; lastx8[ie] = lastx7[ie]; lasty8[ie] = lasty7[ie]; lastx7[ie] = lastx6[ie]; lasty7[ie] = lasty6[ie]; lastx6[ie] = lastx5[ie]; lasty6[ie] = lasty5[ie]; lastx5[ie] = lastx4[ie]; lasty5[ie] = lasty4[ie]; lastx4[ie] = lastx3[ie]; lasty4[ie] = lasty3[ie]; lastx3[ie] = lastx2[ie]; lasty3[ie] = lasty2[ie]; lastx2[ie] = lastx[ie]; lasty2[ie] = lasty[ie]; // lastx[ie] = LIGHT_X; // lasty[ie] = LIGHT_Y; lastx[ie] = LIGHT_X; lasty[ie] = LIGHT_Y; lR9[ie] = lR8[ie]; lG9[ie] = lG8[ie]; lB9[ie] = lB8[ie]; lR8[ie] = lR7[ie]; lG8[ie] = lG7[ie]; lB8[ie] = lB7[ie]; lR7[ie] = lR6[ie]; lG7[ie] = lG6[ie]; lB7[ie] = lB6[ie]; lR6[ie] = lR5[ie] / 1.2f; lG6[ie] = lG5[ie] / 1.2f; lB6[ie] = lB5[ie] / 1.2f; lR5[ie] = lR4[ie] / 1.2f; lG5[ie] = lG4[ie] / 1.2f; lB5[ie] = lB4[ie] / 1.2f; lR4[ie] = lR3[ie] / 1.2f; lG4[ie] = lG3[ie] / 1.2f; lB4[ie] = lB3[ie] / 1.2f; lR3[ie] = lR2[ie] / 1.2f; lG3[ie] = lG2[ie] / 1.2f; lB3[ie] = lB2[ie] / 1.2f; lR2[ie] = lR[ie] / 1.2f; lG2[ie] = lG[ie] / 1.2f; lB2[ie] = lB[ie] / 1.2f; lR[ie] = R[ie] * 2; lG[ie] = G[ie] * 2; lB[ie] = B[ie] * 2; GL11.glEnd(); } GL11.glDisable(GL11.GL_BLEND); //Enable blending. for (int ie = 0; ie < LIGHT_POINTS; ie++) { // LIGHT_X = loc_x[ie]*4+1280/2; // LIGHT_Y = loc_y[ie]*4+720/2; LIGHT_X = loc_x[ie] * 2 + 1280 / 2; LIGHT_Y = loc_y[ie] * 2 + 720 / 2; GL11.glColorMask(true, true, true, true); GL20.glUseProgram(this.shaderProgram); GL20.glUniform2f(GL20.glGetUniformLocation(this.shaderProgram, (CharSequence) "location"), LIGHT_X, 720.0F - LIGHT_Y); GL20.glUniform3f(GL20.glGetUniformLocation(this.shaderProgram, (CharSequence) "colour"), R[ie] / 5, G[ie] / 5, B[ie] / 5); GL11.glEnable(3042); GL11.glBlendFunc(1, 1); GL11.glBegin(7); GL11.glVertex2f(0.0F, 0.0F); GL11.glVertex2f(0.0F, 720.0F); GL11.glVertex2f(1280.0F, 720.0F); GL11.glVertex2f(1280.0F, 0.0F); GL11.glEnd(); GL11.glDisable(3042); GL20.glUseProgram(0); // GL11.glColor3f(lR9[ie], lG9[ie], lB9[ie]); // GL11.glVertex2f(lastx9[ie], lasty9[ie]); // GL11.glColor3f(lR8[ie], lG8[ie], lB8[ie]); // GL11.glVertex2f(lastx8[ie], lasty8[ie]); // GL11.glColor3f(lR7[ie], lG7[ie], lB7[ie]); // GL11.glVertex2f(lastx7[ie], lasty7[ie]); } // }
From source file:glvis.renderers.HighIntensityOrbit.java
@Override public void render() { Display.sync(120);/* w ww . java2 s. co m*/ if (initial) { GL11.glClear(16384); initial = false; } int LIGHT_POINTS = 288; // 1152 // LIGHT_POINTS = 2; // int LIGHT_POINTS = 1152; // 1152 float LIGHT_POINT_SEPARATION = 4.42f; float LIGHT_Y = 256f; float LIGHT_X = 0f; short raw = 0; float fraw = 0; float calc = 0; float distx = 0; float disty = 0; boolean swch = false; int hak = 0; int mx, my; short rraw = 0; float vdist = 0f; boolean chswch = false; GL11.glEnable(GL11.GL_BLEND); //Enable blending. GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); if (initial) { initial = false; GL11.glColor4f(0f, 0f, 0f, 1f); } else GL11.glColor4f(0f, 0f, 0f, 0.06f); GL11.glBegin(GL11.GL_QUADS); GL11.glVertex2f(0, 0); GL11.glVertex2f(1280, 0); GL11.glVertex2f(1280, 720); GL11.glVertex2f(0, 720); GL11.glEnd(); short[] samp = provider.getCurrentSample(); int samplen = provider.getCurrentSampleLength(); GL11.glColor4f(1f, 1f, 1f, 1f); // GL11.glPolygonMode( GL11.GL_FRONT_AND_BACK, GL11.GL_LINE ); float a1 = 0f, a2 = 0f, a3 = 0f, a4 = 0f, a5 = 0f, a6 = 0f, a7 = 0f, a8 = 0f, a9 = 0f; for (int ie = 0; ie < LIGHT_POINTS; ie++) { //GL11.glColor4f(((float)ie)/LIGHT_POINTS,((float)ie)/LIGHT_POINTS,((float)ie)/LIGHT_POINTS,1f); // this.skip = false; itra++; itra %= samplen; raw = samp[itra]; rraw = samp[samplen - (itra + 1)]; mx = 1280 + raw / 32; my = 720 + rraw / 32; // itra ++; // itra %= samplen; // raw = samp[itra]; // rraw = samp[samplen-(itra+1)]; // itra ++; // itra %= samplen; // raw += samp[itra]; // rraw += samp[samplen-(itra+1)]; // raw/=2; // rraw/=2; // phys_x[ie] /= 1.5f - rand[itra] / 2; phys_y[ie] /= 1.5f - rand[samplen - itra] / 2; distx = (mx / 2 - 1280 / 2) - loc_x[ie]; disty = (my / 2 - 720 / 2) - loc_y[ie]; // phys_x[ie]/=distx/6f;phys_y[ie]/=disty/6f; // if(Math.abs(distx) < 1)distx *= 100; // if(Math.abs(disty) < 1)disty *= 100; phys_x[ie] += distx;//+ raw/96f; phys_y[ie] += disty;//+ rraw/96f; // phys_x[ie] += distx + raw/128f; // phys_y[ie] += disty + rraw/128f; loc_x[ie] += phys_x[ie] / 16f; loc_y[ie] += phys_y[ie] / 16f; vdist = Math.abs(distx) + Math.abs(disty); vdist /= 4f; R[ie] /= 1.08; G[ie] /= 1.08; B[ie] /= 1.08; R[ie] += ((Math.abs(loc_y[ie] % 2f) + Math.abs(loc_x[ie] % 2f)) * vdist) / 4096f; G[ie] += ((loc_x[ie] % 2f + Math.abs(loc_y[ie] % 2f)) * vdist) / 2048f; B[ie] += ((Math.abs(loc_x[ie] % 2f) + loc_y[ie] % 2f) * vdist) / 2048f; LIGHT_X = loc_x[ie] * 2 + 1280 / 2; LIGHT_Y = loc_y[ie] * 2 + 720 / 2; GL11.glBegin(GL11.GL_TRIANGLE_STRIP); a1 = (R[ie] + G[ie] + B[ie]) / 3f; a2 = (lR[ie] + lG[ie] + lB[ie]) / 3f; a3 = (lR2[ie] + lG2[ie] + lB2[ie]) / 3f; a4 = (lR3[ie] + lG3[ie] + lB3[ie]) / 3f; a5 = (lR4[ie] + lG4[ie] + lB4[ie]) / 3f; a6 = (lR5[ie] + lG5[ie] + lB5[ie]) / 3f; a7 = (lR6[ie] + lG6[ie] + lB6[ie]) / 3f; GL11.glColor4f(lR6[ie], lG6[ie], lB6[ie], a7); GL11.glVertex2f(lastx6[ie], lasty6[ie]); GL11.glColor4f(lR5[ie], lG5[ie], lB5[ie], a6); GL11.glVertex2f(lastx5[ie], lasty5[ie]); GL11.glColor4f(lR4[ie], lG4[ie], lB4[ie], a5); GL11.glVertex2f(lastx4[ie], lasty4[ie]); GL11.glColor4f(lR3[ie], lG3[ie], lB3[ie], a4); GL11.glVertex2f(lastx3[ie], lasty3[ie]); GL11.glColor4f(lR2[ie], lG2[ie], lB2[ie], a3); GL11.glVertex2f(lastx2[ie], lasty2[ie]); GL11.glColor4f(lR[ie], lG[ie], lB[ie], a2); GL11.glVertex2f(lastx[ie], lasty[ie]); GL11.glColor4f(R[ie] * 2, G[ie] * 2, B[ie] * 2, a1); GL11.glVertex2f(LIGHT_X, LIGHT_Y); lastx9[ie] = lastx8[ie]; lasty9[ie] = lasty8[ie]; lastx8[ie] = lastx7[ie]; lasty8[ie] = lasty7[ie]; lastx7[ie] = lastx6[ie]; lasty7[ie] = lasty6[ie]; lastx6[ie] = lastx5[ie]; lasty6[ie] = lasty5[ie]; lastx5[ie] = lastx4[ie]; lasty5[ie] = lasty4[ie]; lastx4[ie] = lastx3[ie]; lasty4[ie] = lasty3[ie]; lastx3[ie] = lastx2[ie]; lasty3[ie] = lasty2[ie]; lastx2[ie] = lastx[ie]; lasty2[ie] = lasty[ie]; // lastx[ie] = LIGHT_X; // lasty[ie] = LIGHT_Y; lastx[ie] = LIGHT_X; lasty[ie] = LIGHT_Y; lR9[ie] = lR8[ie]; lG9[ie] = lG8[ie]; lB9[ie] = lB8[ie]; lR8[ie] = lR7[ie]; lG8[ie] = lG7[ie]; lB8[ie] = lB7[ie]; lR7[ie] = lR6[ie]; lG7[ie] = lG6[ie]; lB7[ie] = lB6[ie]; lR6[ie] = lR5[ie] / 1.2f; lG6[ie] = lG5[ie] / 1.2f; lB6[ie] = lB5[ie] / 1.2f; lR5[ie] = lR4[ie] / 1.2f; lG5[ie] = lG4[ie] / 1.2f; lB5[ie] = lB4[ie] / 1.2f; lR4[ie] = lR3[ie] / 1.2f; lG4[ie] = lG3[ie] / 1.2f; lB4[ie] = lB3[ie] / 1.2f; lR3[ie] = lR2[ie] / 1.2f; lG3[ie] = lG2[ie] / 1.2f; lB3[ie] = lB2[ie] / 1.2f; lR2[ie] = lR[ie] / 1.2f; lG2[ie] = lG[ie] / 1.2f; lB2[ie] = lB[ie] / 1.2f; lR[ie] = R[ie] * 2; lG[ie] = G[ie] * 2; lB[ie] = B[ie] * 2; GL11.glEnd(); } GL11.glDisable(GL11.GL_BLEND); //Enable blending. for (int ie = 0; ie < LIGHT_POINTS; ie++) { // LIGHT_X = loc_x[ie]*4+1280/2; // LIGHT_Y = loc_y[ie]*4+720/2; LIGHT_X = loc_x[ie] * 2 + 1280 / 2; LIGHT_Y = loc_y[ie] * 2 + 720 / 2; GL11.glColorMask(true, true, true, true); GL20.glUseProgram(this.shaderProgram); GL20.glUniform2f(GL20.glGetUniformLocation(this.shaderProgram, (CharSequence) "location"), LIGHT_X, 720.0F - LIGHT_Y); GL20.glUniform3f(GL20.glGetUniformLocation(this.shaderProgram, (CharSequence) "colour"), R[ie] / 4, G[ie] / 4, B[ie] / 4); GL11.glEnable(3042); GL11.glBlendFunc(1, 1); GL11.glBegin(7); GL11.glVertex2f(0.0F, 0.0F); GL11.glVertex2f(0.0F, 720.0F); GL11.glVertex2f(1280.0F, 720.0F); GL11.glVertex2f(1280.0F, 0.0F); GL11.glEnd(); GL11.glDisable(3042); GL20.glUseProgram(0); // GL11.glColor3f(lR9[ie], lG9[ie], lB9[ie]); // GL11.glVertex2f(lastx9[ie], lasty9[ie]); // GL11.glColor3f(lR8[ie], lG8[ie], lB8[ie]); // GL11.glVertex2f(lastx8[ie], lasty8[ie]); // GL11.glColor3f(lR7[ie], lG7[ie], lB7[ie]); // GL11.glVertex2f(lastx7[ie], lasty7[ie]); } // }
From source file:glvis.renderers.HighIntensityOrbitMouse.java
@Override public void render() { Display.sync(120);/*w w w .ja v a 2 s.c o m*/ if (initial) { GL11.glClear(16384); initial = false; } int LIGHT_POINTS = 288; // 1152 // LIGHT_POINTS = 2; // int LIGHT_POINTS = 1152; // 1152 float LIGHT_POINT_SEPARATION = 4.42f; float LIGHT_Y = 256f; float LIGHT_X = 0f; short raw = 0; float fraw = 0; float calc = 0; float distx = 0; float disty = 0; boolean swch = false; int hak = 0; int mxo = MouseInfo.getPointerInfo().getLocation().x + 320; int myo = MouseInfo.getPointerInfo().getLocation().y + 180; int mx, my; short rraw = 0; float vdist = 0f; boolean chswch = false; GL11.glEnable(GL11.GL_BLEND); //Enable blending. GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); if (initial) { initial = false; GL11.glColor4f(0f, 0f, 0f, 1f); } else GL11.glColor4f(0f, 0f, 0f, 0.06f); GL11.glBegin(GL11.GL_QUADS); GL11.glVertex2f(0, 0); GL11.glVertex2f(1280, 0); GL11.glVertex2f(1280, 720); GL11.glVertex2f(0, 720); GL11.glEnd(); short[] samp = provider.getCurrentSample(); int samplen = provider.getCurrentSampleLength(); GL11.glColor4f(1f, 1f, 1f, 1f); // GL11.glPolygonMode( GL11.GL_FRONT_AND_BACK, GL11.GL_LINE ); float a1 = 0f, a2 = 0f, a3 = 0f, a4 = 0f, a5 = 0f, a6 = 0f, a7 = 0f, a8 = 0f, a9 = 0f; for (int ie = 0; ie < LIGHT_POINTS; ie++) { //GL11.glColor4f(((float)ie)/LIGHT_POINTS,((float)ie)/LIGHT_POINTS,((float)ie)/LIGHT_POINTS,1f); // this.skip = false; itra++; itra %= samplen; raw = samp[itra]; rraw = samp[samplen - (itra + 1)]; mx = mxo + raw / 32; my = myo + rraw / 32; // itra ++; // itra %= samplen; // raw = samp[itra]; // rraw = samp[samplen-(itra+1)]; // itra ++; // itra %= samplen; // raw += samp[itra]; // rraw += samp[samplen-(itra+1)]; // raw/=2; // rraw/=2; // phys_x[ie] /= 1.5f - rand[itra] / 2; phys_y[ie] /= 1.5f - rand[samplen - itra] / 2; distx = (mx / 2 - 1280 / 2) - loc_x[ie]; disty = (my / 2 - 720 / 2) - loc_y[ie]; // phys_x[ie]/=distx/6f;phys_y[ie]/=disty/6f; // if(Math.abs(distx) < 1)distx *= 100; // if(Math.abs(disty) < 1)disty *= 100; phys_x[ie] += distx;//+ raw/96f; phys_y[ie] += disty;//+ rraw/96f; // phys_x[ie] += distx + raw/128f; // phys_y[ie] += disty + rraw/128f; loc_x[ie] += phys_x[ie] / 16f; loc_y[ie] += phys_y[ie] / 16f; vdist = Math.abs(distx) + Math.abs(disty); vdist /= 4f; R[ie] /= 1.08; G[ie] /= 1.08; B[ie] /= 1.08; R[ie] += ((Math.abs(loc_y[ie] % 2f) + Math.abs(loc_x[ie] % 2f)) * vdist) / 4096f; G[ie] += ((loc_x[ie] % 2f + Math.abs(loc_y[ie] % 2f)) * vdist) / 2048f; B[ie] += ((Math.abs(loc_x[ie] % 2f) + loc_y[ie] % 2f) * vdist) / 2048f; LIGHT_X = loc_x[ie] * 2 + 1280 / 2; LIGHT_Y = loc_y[ie] * 2 + 720 / 2; GL11.glBegin(GL11.GL_TRIANGLE_STRIP); a1 = (R[ie] + G[ie] + B[ie]) / 3f; a2 = (lR[ie] + lG[ie] + lB[ie]) / 3f; a3 = (lR2[ie] + lG2[ie] + lB2[ie]) / 3f; a4 = (lR3[ie] + lG3[ie] + lB3[ie]) / 3f; a5 = (lR4[ie] + lG4[ie] + lB4[ie]) / 3f; a6 = (lR5[ie] + lG5[ie] + lB5[ie]) / 3f; a7 = (lR6[ie] + lG6[ie] + lB6[ie]) / 3f; GL11.glColor4f(lR6[ie], lG6[ie], lB6[ie], a7); GL11.glVertex2f(lastx6[ie], lasty6[ie]); GL11.glColor4f(lR5[ie], lG5[ie], lB5[ie], a6); GL11.glVertex2f(lastx5[ie], lasty5[ie]); GL11.glColor4f(lR4[ie], lG4[ie], lB4[ie], a5); GL11.glVertex2f(lastx4[ie], lasty4[ie]); GL11.glColor4f(lR3[ie], lG3[ie], lB3[ie], a4); GL11.glVertex2f(lastx3[ie], lasty3[ie]); GL11.glColor4f(lR2[ie], lG2[ie], lB2[ie], a3); GL11.glVertex2f(lastx2[ie], lasty2[ie]); GL11.glColor4f(lR[ie], lG[ie], lB[ie], a2); GL11.glVertex2f(lastx[ie], lasty[ie]); GL11.glColor4f(R[ie] * 2, G[ie] * 2, B[ie] * 2, a1); GL11.glVertex2f(LIGHT_X, LIGHT_Y); lastx9[ie] = lastx8[ie]; lasty9[ie] = lasty8[ie]; lastx8[ie] = lastx7[ie]; lasty8[ie] = lasty7[ie]; lastx7[ie] = lastx6[ie]; lasty7[ie] = lasty6[ie]; lastx6[ie] = lastx5[ie]; lasty6[ie] = lasty5[ie]; lastx5[ie] = lastx4[ie]; lasty5[ie] = lasty4[ie]; lastx4[ie] = lastx3[ie]; lasty4[ie] = lasty3[ie]; lastx3[ie] = lastx2[ie]; lasty3[ie] = lasty2[ie]; lastx2[ie] = lastx[ie]; lasty2[ie] = lasty[ie]; // lastx[ie] = LIGHT_X; // lasty[ie] = LIGHT_Y; lastx[ie] = LIGHT_X; lasty[ie] = LIGHT_Y; lR9[ie] = lR8[ie]; lG9[ie] = lG8[ie]; lB9[ie] = lB8[ie]; lR8[ie] = lR7[ie]; lG8[ie] = lG7[ie]; lB8[ie] = lB7[ie]; lR7[ie] = lR6[ie]; lG7[ie] = lG6[ie]; lB7[ie] = lB6[ie]; lR6[ie] = lR5[ie] / 1.2f; lG6[ie] = lG5[ie] / 1.2f; lB6[ie] = lB5[ie] / 1.2f; lR5[ie] = lR4[ie] / 1.2f; lG5[ie] = lG4[ie] / 1.2f; lB5[ie] = lB4[ie] / 1.2f; lR4[ie] = lR3[ie] / 1.2f; lG4[ie] = lG3[ie] / 1.2f; lB4[ie] = lB3[ie] / 1.2f; lR3[ie] = lR2[ie] / 1.2f; lG3[ie] = lG2[ie] / 1.2f; lB3[ie] = lB2[ie] / 1.2f; lR2[ie] = lR[ie] / 1.2f; lG2[ie] = lG[ie] / 1.2f; lB2[ie] = lB[ie] / 1.2f; lR[ie] = R[ie] * 2; lG[ie] = G[ie] * 2; lB[ie] = B[ie] * 2; GL11.glEnd(); } GL11.glDisable(GL11.GL_BLEND); //Enable blending. for (int ie = 0; ie < LIGHT_POINTS; ie++) { // LIGHT_X = loc_x[ie]*4+1280/2; // LIGHT_Y = loc_y[ie]*4+720/2; LIGHT_X = loc_x[ie] * 2 + 1280 / 2; LIGHT_Y = loc_y[ie] * 2 + 720 / 2; GL11.glColorMask(true, true, true, true); GL20.glUseProgram(this.shaderProgram); GL20.glUniform2f(GL20.glGetUniformLocation(this.shaderProgram, (CharSequence) "location"), LIGHT_X, 720.0F - LIGHT_Y); GL20.glUniform3f(GL20.glGetUniformLocation(this.shaderProgram, (CharSequence) "colour"), R[ie] / 4, G[ie] / 4, B[ie] / 4); GL11.glEnable(3042); GL11.glBlendFunc(1, 1); GL11.glBegin(7); GL11.glVertex2f(0.0F, 0.0F); GL11.glVertex2f(0.0F, 720.0F); GL11.glVertex2f(1280.0F, 720.0F); GL11.glVertex2f(1280.0F, 0.0F); GL11.glEnd(); GL11.glDisable(3042); GL20.glUseProgram(0); // GL11.glColor3f(lR9[ie], lG9[ie], lB9[ie]); // GL11.glVertex2f(lastx9[ie], lasty9[ie]); // GL11.glColor3f(lR8[ie], lG8[ie], lB8[ie]); // GL11.glVertex2f(lastx8[ie], lasty8[ie]); // GL11.glColor3f(lR7[ie], lG7[ie], lB7[ie]); // GL11.glVertex2f(lastx7[ie], lasty7[ie]); } // }
From source file:glvis.renderers.HighIntensityOrbitMouseNoSoundTestGlitch.java
@Override public void render() { Display.sync(120);//from ww w . j av a 2 s . com if (initial) { GL11.glClear(16384); initial = false; } int LIGHT_POINTS = 288; // 1152 // LIGHT_POINTS = 2; // int LIGHT_POINTS = 1152; // 1152 float LIGHT_POINT_SEPARATION = 4.42f; float LIGHT_Y = 256f; float LIGHT_X = 0f; short raw = 0; float fraw = 0; float calc = 0; float distx = 0; float disty = 0; boolean swch = false; int hak = 0; int mx = MouseInfo.getPointerInfo().getLocation().x + 320; int my = MouseInfo.getPointerInfo().getLocation().y + 180; short rraw = 0; float vdist = 0f; boolean chswch = false; GL11.glEnable(GL11.GL_BLEND); //Enable blending. GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); if (initial) { initial = false; GL11.glColor4f(0f, 0f, 0f, 1f); } else GL11.glColor4f(0f, 0f, 0f, 0.2f); GL11.glBegin(GL11.GL_QUADS); GL11.glVertex2f(0, 0); GL11.glVertex2f(1280, 0); GL11.glVertex2f(1280, 720); GL11.glVertex2f(0, 720); GL11.glEnd(); GL11.glColor4f(1f, 1f, 1f, 1f); // GL11.glPolygonMode( GL11.GL_FRONT_AND_BACK, GL11.GL_LINE ); float a1 = 0f, a2 = 0f, a3 = 0f, a4 = 0f, a5 = 0f, a6 = 0f, a7 = 0f, a8 = 0f, a9 = 0f; for (int ie = 0; ie < LIGHT_POINTS; ie++) { //GL11.glColor4f(((float)ie)/LIGHT_POINTS,((float)ie)/LIGHT_POINTS,((float)ie)/LIGHT_POINTS,1f); // this.skip = false; // itra ++; // itra %= Player.samplen; // raw = Player.samp[itra]; // rraw = Player.samp[Player.samplen-(itra+1)]; // itra ++; // itra %= Player.samplen; // raw += Player.samp[itra]; // rraw += Player.samp[Player.samplen-(itra+1)]; // raw/=2; // rraw/=2; // distx = (mx / 2 - 1280 / 2) - loc_x[ie]; disty = (my / 2 - 720 / 2) - loc_y[ie]; phys_x[ie] += distx;//+ raw/96f; phys_y[ie] += disty;//+ rraw/96f; // phys_x[ie] += distx + raw/128f; // phys_y[ie] += disty + rraw/128f; loc_x[ie] += phys_x[ie] / 16f; loc_y[ie] += phys_y[ie] / 16f; vdist = Math.abs(distx) + Math.abs(disty); vdist /= 4f; R[ie] /= 1.08; G[ie] /= 1.08; B[ie] /= 1.08; R[ie] += ((Math.abs(loc_y[ie] % 2f) + Math.abs(loc_x[ie] % 2f)) * vdist) / 1024f; G[ie] += ((loc_x[ie] % 2f + Math.abs(loc_y[ie] % 2f)) * vdist) / 512f; B[ie] += ((Math.abs(loc_x[ie] % 2f) + loc_y[ie] % 2f) * vdist) / 512f; LIGHT_X = loc_x[ie] * 2 + 1280 / 2; LIGHT_Y = loc_y[ie] * 2 + 720 / 2; GL11.glBegin(GL11.GL_TRIANGLE_STRIP); a1 = (R[ie] + G[ie] + B[ie]) / 3f; a2 = (lR[ie] + lG[ie] + lB[ie]) / 3f; a3 = (lR2[ie] + lG2[ie] + lB2[ie]) / 3f; a4 = (lR3[ie] + lG3[ie] + lB3[ie]) / 3f; a5 = (lR4[ie] + lG4[ie] + lB4[ie]) / 3f; a6 = (lR5[ie] + lG5[ie] + lB5[ie]) / 3f; a7 = (lR6[ie] + lG6[ie] + lB6[ie]) / 3f; GL11.glColor4f(lR6[ie], lG6[ie], lB6[ie], a7); GL11.glVertex2f(lastx6[ie], lasty6[ie]); GL11.glColor4f(lR5[ie], lG5[ie], lB5[ie], a6); GL11.glVertex2f(lastx5[ie], lasty5[ie]); GL11.glColor4f(lR4[ie], lG4[ie], lB4[ie], a5); GL11.glVertex2f(lastx4[ie], lasty4[ie]); GL11.glColor4f(lR3[ie], lG3[ie], lB3[ie], a4); GL11.glVertex2f(lastx3[ie], lasty3[ie]); GL11.glColor4f(lR2[ie], lG2[ie], lB2[ie], a3); GL11.glVertex2f(lastx2[ie], lasty2[ie]); GL11.glColor4f(lR[ie], lG[ie], lB[ie], a2); GL11.glVertex2f(lastx[ie], lasty[ie]); GL11.glColor4f(R[ie] * 2, G[ie] * 2, B[ie] * 2, a1); GL11.glVertex2f(LIGHT_X, LIGHT_Y); lastx9[ie] = lastx8[ie]; lasty9[ie] = lasty8[ie]; lastx8[ie] = lastx7[ie]; lasty8[ie] = lasty7[ie]; lastx7[ie] = lastx6[ie]; lasty7[ie] = lasty6[ie]; lastx6[ie] = lastx5[ie]; lasty6[ie] = lasty5[ie]; lastx5[ie] = lastx4[ie]; lasty5[ie] = lasty4[ie]; lastx4[ie] = lastx3[ie]; lasty4[ie] = lasty3[ie]; lastx3[ie] = lastx2[ie]; lasty3[ie] = lasty2[ie]; lastx2[ie] = lastx[ie]; lasty2[ie] = lasty[ie]; // lastx[ie] = LIGHT_X; // lasty[ie] = LIGHT_Y; lastx[ie] = LIGHT_X; lasty[ie] = LIGHT_Y; lR9[ie] = lR8[ie]; lG9[ie] = lG8[ie]; lB9[ie] = lB8[ie]; lR8[ie] = lR7[ie]; lG8[ie] = lG7[ie]; lB8[ie] = lB7[ie]; lR7[ie] = lR6[ie]; lG7[ie] = lG6[ie]; lB7[ie] = lB6[ie]; lR6[ie] = lR5[ie] / 1.2f; lG6[ie] = lG5[ie] / 1.2f; lB6[ie] = lB5[ie] / 1.2f; lR5[ie] = lR4[ie] / 1.2f; lG5[ie] = lG4[ie] / 1.2f; lB5[ie] = lB4[ie] / 1.2f; lR4[ie] = lR3[ie] / 1.2f; lG4[ie] = lG3[ie] / 1.2f; lB4[ie] = lB3[ie] / 1.2f; lR3[ie] = lR2[ie] / 1.2f; lG3[ie] = lG2[ie] / 1.2f; lB3[ie] = lB2[ie] / 1.2f; lR2[ie] = lR[ie] / 1.2f; lG2[ie] = lG[ie] / 1.2f; lB2[ie] = lB[ie] / 1.2f; lR[ie] = R[ie] * 2; lG[ie] = G[ie] * 2; lB[ie] = B[ie] * 2; GL11.glEnd(); } GL11.glDisable(GL11.GL_BLEND); //Enable blending. for (int ie = 0; ie < LIGHT_POINTS; ie++) { // LIGHT_X = loc_x[ie]*4+1280/2; // LIGHT_Y = loc_y[ie]*4+720/2; LIGHT_X = loc_x[ie] * 2 + 1280 / 2; LIGHT_Y = loc_y[ie] * 2 + 720 / 2; GL11.glColorMask(true, true, true, true); GL20.glUseProgram(this.shaderProgram); GL20.glUniform2f(GL20.glGetUniformLocation(this.shaderProgram, (CharSequence) "location"), LIGHT_X, 720.0F - LIGHT_Y); GL20.glUniform3f(GL20.glGetUniformLocation(this.shaderProgram, (CharSequence) "colour"), R[ie] / 9, G[ie] / 9, B[ie] / 9); GL11.glEnable(3042); GL11.glBlendFunc(1, 1); GL11.glBegin(7); GL11.glVertex2f(0.0F, 0.0F); GL11.glVertex2f(0.0F, 720.0F); GL11.glVertex2f(1280.0F, 720.0F); GL11.glVertex2f(1280.0F, 0.0F); GL11.glEnd(); GL11.glDisable(3042); GL20.glUseProgram(0); // GL11.glColor3f(lR9[ie], lG9[ie], lB9[ie]); // GL11.glVertex2f(lastx9[ie], lasty9[ie]); // GL11.glColor3f(lR8[ie], lG8[ie], lB8[ie]); // GL11.glVertex2f(lastx8[ie], lasty8[ie]); // GL11.glColor3f(lR7[ie], lG7[ie], lB7[ie]); // GL11.glVertex2f(lastx7[ie], lasty7[ie]); } // }
From source file:glvis.renderers.HighIntensityTriangleStrip.java
@Override public void render() { GL11.glClear(16384);// w w w . ja v a 2s. co m int LIGHT_POINTS = 288; // 1152 // int LIGHT_POINTS = 1152; // 1152 float LIGHT_POINT_SEPARATION = 4.42f; float LIGHT_Y = 256f; float LIGHT_X = 0f; short raw = 0; float fraw = 0; float calc = 0; float distx = 0; float disty = 0; boolean swch = false; int hak = 0; short rraw = 0; float vdist = 0f; boolean chswch = false; // GL11.glEnable(GL11.GL_BLEND); //Enable blending. // GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f(1f, 1f, 1f, 1f); // GL11.glPolygonMode( GL11.GL_FRONT_AND_BACK, GL11.GL_LINE ); short[] samp = provider.getCurrentSample(); int samplen = provider.getCurrentSampleLength(); for (int ie = 0; ie < LIGHT_POINTS; ie++) { GL11.glBegin(GL11.GL_TRIANGLE_STRIP); //GL11.glColor4f(((float)ie)/LIGHT_POINTS,((float)ie)/LIGHT_POINTS,((float)ie)/LIGHT_POINTS,1f); itra++; itra %= samplen; raw = samp[itra]; rraw = samp[samplen - (itra + 1)]; phys_x[ie] /= 2f; phys_y[ie] /= 2f; distx = -loc_x[ie]; disty = -loc_y[ie]; // phys_x[ie] += distx + raw/64f; // phys_y[ie] += disty + rraw/64f; phys_x[ie] += distx + raw / 64f; phys_y[ie] += disty + rraw / 64f; loc_x[ie] += phys_x[ie] / 16f; loc_y[ie] += phys_y[ie] / 16f; LIGHT_X = loc_x[ie] * 4 + 1280 / 2; LIGHT_Y = loc_y[ie] * 4 + 720 / 2; vdist = Math.abs(distx) + Math.abs(disty); vdist /= 4f; R[ie] /= 1.08; G[ie] /= 1.08; B[ie] /= 1.08; R[ie] += ((Math.abs(loc_y[ie] % 2f) + Math.abs(loc_x[ie] % 2f)) * vdist) / 1024f; G[ie] += ((loc_x[ie] % 2f + Math.abs(loc_y[ie] % 2f)) * vdist) / 512f; B[ie] += ((Math.abs(loc_x[ie] % 2f) + loc_y[ie] % 2f) * vdist) / 512f; LIGHT_X = loc_x[ie] * 4 + 1280 / 2; LIGHT_Y = loc_y[ie] * 4 + 720 / 2; // GL11.glColor3f(lR9[ie], lG9[ie], lB9[ie]); // GL11.glVertex2f(lastx9[ie], lasty9[ie]); // GL11.glColor3f(lR8[ie], lG8[ie], lB8[ie]); // GL11.glVertex2f(lastx8[ie], lasty8[ie]); // GL11.glColor3f(lR7[ie], lG7[ie], lB7[ie]); // GL11.glVertex2f(lastx7[ie], lasty7[ie]); GL11.glColor3f(lR6[ie], lG6[ie], lB6[ie]); GL11.glVertex2f(lastx6[ie], lasty6[ie]); GL11.glColor3f(lR5[ie], lG5[ie], lB5[ie]); GL11.glVertex2f(lastx5[ie], lasty5[ie]); GL11.glColor3f(lR4[ie], lG4[ie], lB4[ie]); GL11.glVertex2f(lastx4[ie], lasty4[ie]); GL11.glColor3f(lR3[ie], lG3[ie], lB3[ie]); GL11.glVertex2f(lastx3[ie], lasty3[ie]); GL11.glColor3f(lR2[ie], lG2[ie], lB2[ie]); GL11.glVertex2f(lastx2[ie], lasty2[ie]); GL11.glColor3f(lR[ie], lG[ie], lB[ie]); GL11.glVertex2f(lastx[ie], lasty[ie]); GL11.glColor3f(R[ie] * 2, G[ie] * 2, B[ie] * 2); GL11.glVertex2f(LIGHT_X, LIGHT_Y); lastx9[ie] = lastx8[ie]; lasty9[ie] = lasty8[ie]; lastx8[ie] = lastx7[ie]; lasty8[ie] = lasty7[ie]; lastx7[ie] = lastx6[ie]; lasty7[ie] = lasty6[ie]; lastx6[ie] = lastx5[ie]; lasty6[ie] = lasty5[ie]; lastx5[ie] = lastx4[ie]; lasty5[ie] = lasty4[ie]; lastx4[ie] = lastx3[ie]; lasty4[ie] = lasty3[ie]; lastx3[ie] = lastx2[ie]; lasty3[ie] = lasty2[ie]; lastx2[ie] = lastx[ie]; lasty2[ie] = lasty[ie]; // lastx[ie] = LIGHT_X; // lasty[ie] = LIGHT_Y; lastx[ie] = LIGHT_X; lasty[ie] = LIGHT_Y; lR9[ie] = lR8[ie]; lG9[ie] = lG8[ie]; lB9[ie] = lB8[ie]; lR8[ie] = lR7[ie]; lG8[ie] = lG7[ie]; lB8[ie] = lB7[ie]; lR7[ie] = lR6[ie]; lG7[ie] = lG6[ie]; lB7[ie] = lB6[ie]; lR6[ie] = lR5[ie] / 1.2f; lG6[ie] = lG5[ie] / 1.2f; lB6[ie] = lB5[ie] / 1.2f; lR5[ie] = lR4[ie] / 1.2f; lG5[ie] = lG4[ie] / 1.2f; lB5[ie] = lB4[ie] / 1.2f; lR4[ie] = lR3[ie] / 1.2f; lG4[ie] = lG3[ie] / 1.2f; lB4[ie] = lB3[ie] / 1.2f; lR3[ie] = lR2[ie] / 1.2f; lG3[ie] = lG2[ie] / 1.2f; lB3[ie] = lB2[ie] / 1.2f; lR2[ie] = lR[ie] / 1.2f; lG2[ie] = lG[ie] / 1.2f; lB2[ie] = lB[ie] / 1.2f; lR[ie] = R[ie] * 2; lG[ie] = G[ie] * 2; lB[ie] = B[ie] * 2; GL11.glEnd(); } for (int ie = 0; ie < LIGHT_POINTS; ie++) { LIGHT_X = loc_x[ie] * 4 + 1280 / 2; LIGHT_Y = loc_y[ie] * 4 + 720 / 2; GL11.glColorMask(true, true, true, true); GL20.glUseProgram(this.shaderProgram); GL20.glUniform2f(GL20.glGetUniformLocation(this.shaderProgram, (CharSequence) "location"), LIGHT_X, 720.0F - LIGHT_Y); GL20.glUniform3f(GL20.glGetUniformLocation(this.shaderProgram, (CharSequence) "colour"), R[ie], G[ie], B[ie]); GL11.glEnable(3042); GL11.glBlendFunc(1, 1); GL11.glBegin(7); GL11.glVertex2f(0.0F, 0.0F); GL11.glVertex2f(0.0F, 720.0F); GL11.glVertex2f(1280.0F, 720.0F); GL11.glVertex2f(1280.0F, 0.0F); GL11.glEnd(); GL11.glDisable(3042); GL20.glUseProgram(0); } }
From source file:glvis.renderers.HighIntensityTriangleStripEarly.java
@Override public void render() { GL11.glClear(16384);// w w w . j av a2s . c om int LIGHT_POINTS = 288; // 1152 float LIGHT_POINT_SEPARATION = 4.42f; float LIGHT_Y = 256f; float LIGHT_X = 0f; short raw = 0; float fraw = 0; float calc = 0; float distx = 0; float disty = 0; boolean swch = false; int hak = 0; short rraw = 0; float vdist = 0f; boolean chswch = false; // GL11.glEnable(GL11.GL_BLEND); //Enable blending. // GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f(1f, 1f, 1f, 1f); // GL11.glPolygonMode( GL11.GL_FRONT_AND_BACK, GL11.GL_LINE ); short[] samp = provider.getCurrentSample(); int samplen = provider.getCurrentSampleLength(); for (int ie = 0; ie < LIGHT_POINTS; ie++) { GL11.glBegin(GL11.GL_TRIANGLE_STRIP); //GL11.glColor4f(((float)ie)/LIGHT_POINTS,((float)ie)/LIGHT_POINTS,((float)ie)/LIGHT_POINTS,1f); itra++; itra %= samplen; raw = samp[itra]; rraw = samp[samplen - (itra + 1)]; phys_x[ie] /= 2f; phys_y[ie] /= 2f; distx = -loc_x[ie]; disty = -loc_y[ie]; phys_x[ie] += distx + raw / 64f; phys_y[ie] += disty + rraw / 64f; loc_x[ie] += phys_x[ie] / 16f; loc_y[ie] += phys_y[ie] / 16f; LIGHT_X = loc_x[ie] * 4 + 1280 / 2; LIGHT_Y = loc_y[ie] * 4 + 720 / 2; vdist = Math.abs(distx) + Math.abs(disty); vdist /= 4f; R[ie] /= 1.08; G[ie] /= 1.08; B[ie] /= 1.08; R[ie] += ((Math.abs(loc_y[ie] % 2f) + Math.abs(loc_x[ie] % 2f)) * vdist) / 1024f; G[ie] += ((loc_x[ie] % 2f + Math.abs(loc_y[ie] % 2f)) * vdist) / 512f; B[ie] += ((Math.abs(loc_x[ie] % 2f) + loc_y[ie] % 2f) * vdist) / 512f; LIGHT_X = loc_x[ie] * 4 + 1280 / 2; LIGHT_Y = loc_y[ie] * 4 + 720 / 2; GL11.glColor3f(lR6[ie], lG6[ie], lB6[ie]); GL11.glVertex2f(lastx6[ie], lasty6[ie]); GL11.glColor3f(lR5[ie], lG5[ie], lB5[ie]); GL11.glVertex2f(lastx5[ie], lasty5[ie]); GL11.glColor3f(lR4[ie], lG4[ie], lB4[ie]); GL11.glVertex2f(lastx4[ie], lasty4[ie]); GL11.glColor3f(lR3[ie], lG3[ie], lB3[ie]); GL11.glVertex2f(lastx3[ie], lasty3[ie]); GL11.glColor3f(lR2[ie], lG2[ie], lB2[ie]); GL11.glVertex2f(lastx2[ie], lasty2[ie]); GL11.glColor3f(lR[ie], lG[ie], lB[ie]); GL11.glVertex2f(lastx[ie], lasty[ie]); GL11.glColor3f(R[ie] * 2, G[ie] * 2, B[ie] * 2); GL11.glVertex2f(LIGHT_X, LIGHT_Y); lastx6[ie] = lastx5[ie]; lasty6[ie] = lasty5[ie]; lastx5[ie] = lastx4[ie]; lasty5[ie] = lasty4[ie]; lastx4[ie] = lastx3[ie]; lasty4[ie] = lasty3[ie]; lastx3[ie] = lastx2[ie]; lasty3[ie] = lasty2[ie]; lastx2[ie] = lastx[ie]; lasty2[ie] = lasty[ie]; lastx[ie] = LIGHT_X; lasty[ie] = LIGHT_Y; lR6[ie] = lR5[ie]; lG6[ie] = lG5[ie]; lB6[ie] = lB5[ie]; lR5[ie] = lR4[ie]; lG5[ie] = lG4[ie]; lB5[ie] = lB4[ie]; lR4[ie] = lR3[ie]; lG4[ie] = lG3[ie]; lB4[ie] = lB3[ie]; lR3[ie] = lR2[ie]; lG3[ie] = lG2[ie]; lB3[ie] = lB2[ie]; lR2[ie] = lR[ie]; lG2[ie] = lG[ie]; lB2[ie] = lB[ie]; lR[ie] = R[ie] * 2; lG[ie] = G[ie] * 2; lB[ie] = B[ie] * 2; GL11.glEnd(); } for (int ie = 0; ie < LIGHT_POINTS; ie++) { LIGHT_X = loc_x[ie] * 4 + 1280 / 2; LIGHT_Y = loc_y[ie] * 4 + 720 / 2; GL11.glColorMask(true, true, true, true); GL20.glUseProgram(this.shaderProgram); GL20.glUniform2f(GL20.glGetUniformLocation(this.shaderProgram, (CharSequence) "location"), LIGHT_X, 720.0F - LIGHT_Y); GL20.glUniform3f(GL20.glGetUniformLocation(this.shaderProgram, (CharSequence) "colour"), R[ie], G[ie], B[ie]); GL11.glEnable(3042); GL11.glBlendFunc(1, 1); GL11.glBegin(7); GL11.glVertex2f(0.0F, 0.0F); GL11.glVertex2f(0.0F, 720.0F); GL11.glVertex2f(1280.0F, 720.0F); GL11.glVertex2f(1280.0F, 0.0F); GL11.glEnd(); GL11.glDisable(3042); GL20.glUseProgram(0); } }
From source file:glvis.renderers.LightsOnlyBasic.java
@Override public void render() { GL11.glClear(16384);/*from w w w .j ava 2 s. c om*/ int LIGHT_POINTS = 288; // 1152 float LIGHT_POINT_SEPARATION = 4.42f; float LIGHT_Y = 256f; float LIGHT_X = 0f; short raw = 0; float fraw = 0; float calc = 0; float distx = 0; float disty = 0; boolean swch = false; int hak = 0; short rraw = 0; float vdist = 0f; short[] samp = provider.getCurrentSample(); int samplen = provider.getCurrentSampleLength(); boolean chswch = false; for (int ie = 0; ie < LIGHT_POINTS; ie++) { // LIGHT_X = ((float)ie)*LIGHT_POINT_SEPARATION; itra++; itra %= samplen; raw = samp[itra]; rraw = samp[samplen - (itra + 1)]; // fraw = ((float) raw) / 65535f; // calc = ((float) raw) / 256f; // disty = loc_y[ie] + calc/2f; // LIGHT_Y = disty + (720 / 2); // loc_y[ie] = disty * .94f; // loc_y[ie] = loc_y[ie]+raw/6; // phys_x[ie]/=1.929f; // phys_y[ie]/=1.929f; phys_x[ie] /= 2f; phys_y[ie] /= 2f; distx = -loc_x[ie]; disty = -loc_y[ie]; phys_x[ie] += distx + raw / 64f; phys_y[ie] += disty + rraw / 64f; loc_x[ie] += phys_x[ie] / 16f; loc_y[ie] += phys_y[ie] / 16f; LIGHT_X = loc_x[ie] * 4 + 1280 / 2; LIGHT_Y = loc_y[ie] * 4 + 720 / 2; // LIGHT_X = rand[ie]*1280; // LIGHT_Y = rand[1023-ie]*720; ////////////// phys_x[ie]/=1.02f; ////////////// phys_y[ie]/=1.02f; ////////////// ////////////// loc_y[ie]/=1.02f; ////////////// loc_y[ie] +=raw/16 + phys_y[ie]; ////////////// loc_x[ie]/=1.02f; ////////////// loc_x[ie] +=rraw/16 + phys_x[ie]; ////////////// ////////////// distx = -loc_x[ie]; ////////////// disty = -loc_y[ie]; ////////////// ////////////// phys_x[ie] += distx; ////////////// phys_y[ie] += disty; ////////////// //////////////// loc_y[ie]/=1f+Math.abs(loc_y[ie]/548192f); ////////////// raw = (short) loc_y[ie]; ////////////// LIGHT_Y = 720/2+loc_y[ie]/16f; ////////////// LIGHT_X = 1280/2+loc_x[ie]/16f; // R[ie]*=.86f; // G[ie]*=.86f; // B[ie]*=.86f; // /*switch(itra%3){*/ // /*case 0: */R[ie]+=Math.abs(loc_y[ie]%4)/56f;/*break;*/ // /*case 1: */G[ie]+=Math.abs((4f+loc_y[ie])%4)/56f;/*break;*/ // /*case 2: */B[ie]+=Math.abs((8f+loc_y[ie])%4)/56f;/*break;*/ // /*}*/ // R[ie]=G[ie]=B[ie]=(Math.abs(loc_y[ie])+Math.abs(loc_x[ie]))/4432f; vdist = Math.abs(distx) + Math.abs(disty); vdist /= 4f; R[ie] /= 1.08; G[ie] /= 1.08; B[ie] /= 1.08; R[ie] += ((Math.abs(loc_y[ie] % 2f) + Math.abs(loc_x[ie] % 2f)) * vdist) / 1024f; G[ie] += ((loc_x[ie] % 2f + Math.abs(loc_y[ie] % 2f)) * vdist) / 512f; B[ie] += ((Math.abs(loc_x[ie] % 2f) + loc_y[ie] % 2f) * vdist) / 512f; // B[ie]/=2; // R[ie]=G[ie]=B[ie]=.1f; GL11.glColorMask(true, true, true, true); GL20.glUseProgram(this.shaderProgram); GL20.glUniform2f(GL20.glGetUniformLocation(this.shaderProgram, (CharSequence) "location"), LIGHT_X, 720.0F - LIGHT_Y); GL20.glUniform3f(GL20.glGetUniformLocation(this.shaderProgram, (CharSequence) "colour"), R[ie], G[ie], B[ie]); GL11.glEnable(3042); GL11.glBlendFunc(1, 1); GL11.glBegin(7); GL11.glVertex2f(0.0F, 0.0F); GL11.glVertex2f(0.0F, 720.0F); GL11.glVertex2f(1280.0F, 720.0F); GL11.glVertex2f(1280.0F, 0.0F); GL11.glEnd(); GL11.glDisable(3042); GL20.glUseProgram(0); GL11.glClear(1024); } }