private void checkOcclusionQueryResult(int i, int j) { for(int k = i; k < j; k++) { if(!sortedWorldRenderers[k].isWaitingOnOcclusionQuery) { continue; } occlusionResult.clear(); ARBOcclusionQuery.glGetQueryObjectuARB(sortedWorldRenderers[k].glOcclusionQuery, 34919 /*GL_QUERY_RESULT_AVAILABLE_ARB*/, occlusionResult); if(occlusionResult.get(0) != 0) { sortedWorldRenderers[k].isWaitingOnOcclusionQuery = false; occlusionResult.clear(); ARBOcclusionQuery.glGetQueryObjectuARB(sortedWorldRenderers[k].glOcclusionQuery, 34918 /*GL_QUERY_RESULT_ARB*/, occlusionResult); sortedWorldRenderers[k].isVisible = occlusionResult.get(0) != 0; } } }
public TimingQuery nextTimerQuery() { for (int i = 0; i < timingQueries.size(); i++) { TimingQuery qo = timingQueries.get(i); if (!qo.used) { qo.used = true; qo.drawTime = false; return qo; } } int before = ARBOcclusionQuery.glGenQueriesARB(); int after = ARBOcclusionQuery.glGenQueriesARB(); TimingQuery q = new TimingQuery(); q.before = before; q.after = after; q.used = true; timingQueries.add(q); return q; }
private void checkOcclusionQueryResult(int p_72720_1_, int p_72720_2_) { for (int k = p_72720_1_; k < p_72720_2_; ++k) { if (this.sortedWorldRenderers[k].isWaitingOnOcclusionQuery) { this.occlusionResult.clear(); ARBOcclusionQuery.glGetQueryObjectuARB(this.sortedWorldRenderers[k].glOcclusionQuery, ARBOcclusionQuery.GL_QUERY_RESULT_AVAILABLE_ARB, this.occlusionResult); if (this.occlusionResult.get(0) != 0) { this.sortedWorldRenderers[k].isWaitingOnOcclusionQuery = false; this.occlusionResult.clear(); ARBOcclusionQuery.glGetQueryObjectuARB(this.sortedWorldRenderers[k].glOcclusionQuery, ARBOcclusionQuery.GL_QUERY_RESULT_ARB, this.occlusionResult); this.sortedWorldRenderers[k].isVisible = this.occlusionResult.get(0) != 0; } } } }
private void checkOcclusionQueryResult(int par1, int par2) { for (int k = par1; k < par2; ++k) { if (this.sortedWorldRenderers[k].isWaitingOnOcclusionQuery) { this.occlusionResult.clear(); ARBOcclusionQuery.glGetQueryObjectuARB(this.sortedWorldRenderers[k].glOcclusionQuery, ARBOcclusionQuery.GL_QUERY_RESULT_AVAILABLE_ARB, this.occlusionResult); if (this.occlusionResult.get(0) != 0) { this.sortedWorldRenderers[k].isWaitingOnOcclusionQuery = false; this.occlusionResult.clear(); ARBOcclusionQuery.glGetQueryObjectuARB(this.sortedWorldRenderers[k].glOcclusionQuery, ARBOcclusionQuery.GL_QUERY_RESULT_ARB, this.occlusionResult); this.sortedWorldRenderers[k].isVisible = this.occlusionResult.get(0) != 0; } } } }
private void checkOcclusionQueryResult(int startIndex, int endIndex, double px, double py, double pz) { for (int k = startIndex; k < endIndex; ++k) { WorldRenderer wr = this.sortedWorldRenderers[k]; if (wr.isWaitingOnOcclusionQuery) { this.occlusionResult.clear(); ARBOcclusionQuery.glGetQueryObjectuARB(wr.glOcclusionQuery, ARBOcclusionQuery.GL_QUERY_RESULT_AVAILABLE_ARB, this.occlusionResult); if (this.occlusionResult.get(0) != 0) { wr.isWaitingOnOcclusionQuery = false; this.occlusionResult.clear(); ARBOcclusionQuery.glGetQueryObjectuARB(wr.glOcclusionQuery, ARBOcclusionQuery.GL_QUERY_RESULT_ARB, this.occlusionResult); if (!wr.isUpdating && !wr.needsBoxUpdate) { boolean wasVisible = wr.isVisible; wr.isVisible = this.occlusionResult.get(0) > 0; if (wasVisible && wr.isVisible) { wr.isVisibleFromPosition = true; wr.visibleFromX = px; wr.visibleFromY = py; wr.visibleFromZ = pz; } } else { wr.isVisible = true; } } } } }
private void func_72720_a(int p_72720_1_, int p_72720_2_) { for(int var3 = p_72720_1_; var3 < p_72720_2_; ++var3) { if(this.field_72768_k[var3].field_78935_u) { this.field_72761_c.clear(); ARBOcclusionQuery.glGetQueryObjectuARB(this.field_72768_k[var3].field_78934_v, '\u8867', this.field_72761_c); if(this.field_72761_c.get(0) != 0) { this.field_72768_k[var3].field_78935_u = false; this.field_72761_c.clear(); ARBOcclusionQuery.glGetQueryObjectuARB(this.field_72768_k[var3].field_78934_v, '\u8866', this.field_72761_c); this.field_72768_k[var3].field_78936_t = this.field_72761_c.get(0) != 0; } } } }
public RenderGlobal(Minecraft minecraft, RenderEngine renderengine) { tileEntities = new ArrayList(); worldRenderersToUpdate = new ArrayList(); occlusionEnabled = false; cloudOffsetX = 0; renderDistance = -1; renderEntitiesStartupCounter = 2; dummyBuf50k = new int[50000]; occlusionResult = GLAllocation.createDirectIntBuffer(64); glRenderLists = new ArrayList(); dummyInt0 = 0; glDummyList = GLAllocation.generateDisplayLists(1); prevSortX = -9999D; prevSortY = -9999D; prevSortZ = -9999D; frustrumCheckOffset = 0; mc = minecraft; renderEngine = renderengine; byte byte0 = 64; glRenderListBase = GLAllocation.generateDisplayLists(byte0 * byte0 * byte0 * 3); occlusionEnabled = minecraft.getOpenGlCapsChecker().checkARBOcclusion(); if(occlusionEnabled) { occlusionResult.clear(); glOcclusionQueryBase = GLAllocation.createDirectIntBuffer(byte0 * byte0 * byte0); glOcclusionQueryBase.clear(); glOcclusionQueryBase.position(0); glOcclusionQueryBase.limit(byte0 * byte0 * byte0); ARBOcclusionQuery.glGenQueriesARB(glOcclusionQueryBase); } starGLCallList = GLAllocation.generateDisplayLists(3); GL11.glPushMatrix(); GL11.glNewList(starGLCallList, 4864 /*GL_COMPILE*/); renderStars(); GL11.glEndList(); GL11.glPopMatrix(); Tessellator tessellator = Tessellator.instance; glSkyList = starGLCallList + 1; GL11.glNewList(glSkyList, 4864 /*GL_COMPILE*/); byte byte1 = 64; int i = 256 / byte1 + 2; float f = 16F; for(int j = -byte1 * i; j <= byte1 * i; j += byte1) { for(int l = -byte1 * i; l <= byte1 * i; l += byte1) { tessellator.startDrawingQuads(); tessellator.addVertex(j + 0, f, l + 0); tessellator.addVertex(j + byte1, f, l + 0); tessellator.addVertex(j + byte1, f, l + byte1); tessellator.addVertex(j + 0, f, l + byte1); tessellator.draw(); } } GL11.glEndList(); glSkyList2 = starGLCallList + 2; GL11.glNewList(glSkyList2, 4864 /*GL_COMPILE*/); f = -16F; tessellator.startDrawingQuads(); for(int k = -byte1 * i; k <= byte1 * i; k += byte1) { for(int i1 = -byte1 * i; i1 <= byte1 * i; i1 += byte1) { tessellator.addVertex(k + byte1, f, i1 + 0); tessellator.addVertex(k + 0, f, i1 + 0); tessellator.addVertex(k + 0, f, i1 + byte1); tessellator.addVertex(k + byte1, f, i1 + byte1); } } tessellator.draw(); GL11.glEndList(); }
public static void frame() { Context ctx = CURRENT_CONTEXT.get(); ctx.frameEndTime = System.nanoTime(); float drawTime = 0.0f; if (ctx.caps.GL_ARB_timer_query) { /* End current code section (if not already ended) */ if (ctx.lastCodeSectionQuery != null) { ARBTimerQuery.glQueryCounter(ctx.lastCodeSectionQuery.after, ARBTimerQuery.GL_TIMESTAMP); ctx.lastCodeSectionQuery = null; } /* Reset current code section counter */ ctx.currentCodeSectionIndex = 0; /* Wait for all active query counters */ for (int i = 0; i < ctx.timingQueries.size(); i++) { TimingQuery q = ctx.timingQueries.get(i); if (!q.used) continue; while (ARBOcclusionQuery.glGetQueryObjectiARB(q.before, ARBOcclusionQuery.GL_QUERY_RESULT_AVAILABLE_ARB) == 0) ; while (ARBOcclusionQuery.glGetQueryObjectiARB(q.after, ARBOcclusionQuery.GL_QUERY_RESULT_AVAILABLE_ARB) == 0) ; long time0 = ARBTimerQuery.glGetQueryObjectui64(q.before, ARBOcclusionQuery.GL_QUERY_RESULT_ARB); long time1 = ARBTimerQuery.glGetQueryObjectui64(q.after, ARBOcclusionQuery.GL_QUERY_RESULT_ARB); q.time0 = time0; q.time1 = time1; if (q.drawTime) { drawTime += (time1 - time0) / 1E6f; // <- in ms. } q.used = false; } } ctx.drawCallTimeMs = drawTime; Profiling.frame(ctx); /* Reset counters for next frame */ ctx.verticesCount = 0; ctx.glCallCount = 0; ctx.frameStartTime = ctx.frameEndTime; /* Clear all code section timings */ for (TimedCodeSection section : ctx.codeSectionTimes) { section.queries.clear(); } }
public RenderGlobal(Minecraft par1Minecraft) { this.glListClouds = GLAllocation.generateDisplayLists(1); this.mc = par1Minecraft; this.renderEngine = par1Minecraft.getTextureManager(); byte maxChunkDim = 65; byte maxChunkHeight = 16; int countWorldRenderers = maxChunkDim * maxChunkDim * maxChunkHeight; int countStandardRenderLists = countWorldRenderers * 3; this.glRenderListBase = GLAllocation.generateDisplayLists(countStandardRenderLists); this.displayListEntitiesDirty = false; this.displayListEntities = GLAllocation.generateDisplayLists(1); this.occlusionEnabled = OpenGlCapsChecker.checkARBOcclusion(); if (this.occlusionEnabled) { this.occlusionResult.clear(); this.glOcclusionQueryBase = GLAllocation.createDirectIntBuffer(maxChunkDim * maxChunkDim * maxChunkHeight); this.glOcclusionQueryBase.clear(); this.glOcclusionQueryBase.position(0); this.glOcclusionQueryBase.limit(maxChunkDim * maxChunkDim * maxChunkHeight); ARBOcclusionQuery.glGenQueriesARB(this.glOcclusionQueryBase); } this.starGLCallList = GLAllocation.generateDisplayLists(3); GL11.glPushMatrix(); GL11.glNewList(this.starGLCallList, GL11.GL_COMPILE); this.renderStars(); GL11.glEndList(); GL11.glPopMatrix(); Tessellator var4 = Tessellator.instance; this.glSkyList = this.starGLCallList + 1; GL11.glNewList(this.glSkyList, GL11.GL_COMPILE); byte var6 = 64; int var7 = 256 / var6 + 2; float var5 = 16.0F; int var8; int var9; for (var8 = -var6 * var7; var8 <= var6 * var7; var8 += var6) { for (var9 = -var6 * var7; var9 <= var6 * var7; var9 += var6) { var4.startDrawingQuads(); var4.addVertex((double)(var8 + 0), (double)var5, (double)(var9 + 0)); var4.addVertex((double)(var8 + var6), (double)var5, (double)(var9 + 0)); var4.addVertex((double)(var8 + var6), (double)var5, (double)(var9 + var6)); var4.addVertex((double)(var8 + 0), (double)var5, (double)(var9 + var6)); var4.draw(); } } GL11.glEndList(); this.glSkyList2 = this.starGLCallList + 2; GL11.glNewList(this.glSkyList2, GL11.GL_COMPILE); var5 = -16.0F; var4.startDrawingQuads(); for (var8 = -var6 * var7; var8 <= var6 * var7; var8 += var6) { for (var9 = -var6 * var7; var9 <= var6 * var7; var9 += var6) { var4.addVertex((double)(var8 + var6), (double)var5, (double)(var9 + 0)); var4.addVertex((double)(var8 + 0), (double)var5, (double)(var9 + 0)); var4.addVertex((double)(var8 + 0), (double)var5, (double)(var9 + var6)); var4.addVertex((double)(var8 + var6), (double)var5, (double)(var9 + var6)); } } var4.draw(); GL11.glEndList(); }
public RenderGlobal(Minecraft p_i1249_1_) { this.mc = p_i1249_1_; this.renderEngine = p_i1249_1_.getTextureManager(); byte b0 = 34; byte b1 = 16; this.glRenderListBase = GLAllocation.generateDisplayLists(b0 * b0 * b1 * 3); this.displayListEntitiesDirty = false; this.displayListEntities = GLAllocation.generateDisplayLists(1); this.occlusionEnabled = OpenGlCapsChecker.checkARBOcclusion(); if (this.occlusionEnabled) { this.occlusionResult.clear(); this.glOcclusionQueryBase = GLAllocation.createDirectIntBuffer(b0 * b0 * b1); this.glOcclusionQueryBase.clear(); this.glOcclusionQueryBase.position(0); this.glOcclusionQueryBase.limit(b0 * b0 * b1); ARBOcclusionQuery.glGenQueriesARB(this.glOcclusionQueryBase); } this.starGLCallList = GLAllocation.generateDisplayLists(3); GL11.glPushMatrix(); GL11.glNewList(this.starGLCallList, GL11.GL_COMPILE); this.renderStars(); GL11.glEndList(); GL11.glPopMatrix(); Tessellator tessellator = Tessellator.instance; this.glSkyList = this.starGLCallList + 1; GL11.glNewList(this.glSkyList, GL11.GL_COMPILE); byte b2 = 64; int i = 256 / b2 + 2; float f = 16.0F; int j; int k; for (j = -b2 * i; j <= b2 * i; j += b2) { for (k = -b2 * i; k <= b2 * i; k += b2) { tessellator.startDrawingQuads(); tessellator.addVertex((double)(j + 0), (double)f, (double)(k + 0)); tessellator.addVertex((double)(j + b2), (double)f, (double)(k + 0)); tessellator.addVertex((double)(j + b2), (double)f, (double)(k + b2)); tessellator.addVertex((double)(j + 0), (double)f, (double)(k + b2)); tessellator.draw(); } } GL11.glEndList(); this.glSkyList2 = this.starGLCallList + 2; GL11.glNewList(this.glSkyList2, GL11.GL_COMPILE); f = -16.0F; tessellator.startDrawingQuads(); for (j = -b2 * i; j <= b2 * i; j += b2) { for (k = -b2 * i; k <= b2 * i; k += b2) { tessellator.addVertex((double)(j + b2), (double)f, (double)(k + 0)); tessellator.addVertex((double)(j + 0), (double)f, (double)(k + 0)); tessellator.addVertex((double)(j + 0), (double)f, (double)(k + b2)); tessellator.addVertex((double)(j + b2), (double)f, (double)(k + b2)); } } tessellator.draw(); GL11.glEndList(); }
public RenderGlobal(Minecraft p_i1249_1_) { this.field_72777_q = p_i1249_1_; this.field_72770_i = p_i1249_1_.func_110434_K(); byte var2 = 34; byte var3 = 32; this.field_72778_p = GLAllocation.func_74526_a(var2 * var2 * var3 * 3); this.field_72774_t = OpenGlCapsChecker.func_74371_a(); if(this.field_72774_t) { this.field_72761_c.clear(); this.field_72775_s = GLAllocation.func_74527_f(var2 * var2 * var3); this.field_72775_s.clear(); this.field_72775_s.position(0); this.field_72775_s.limit(var2 * var2 * var3); ARBOcclusionQuery.glGenQueriesARB(this.field_72775_s); } this.field_72772_v = GLAllocation.func_74526_a(3); GL11.glPushMatrix(); GL11.glNewList(this.field_72772_v, 4864); this.func_72730_g(); GL11.glEndList(); GL11.glPopMatrix(); Tessellator var4 = Tessellator.field_78398_a; this.field_72771_w = this.field_72772_v + 1; GL11.glNewList(this.field_72771_w, 4864); byte var6 = 64; int var7 = 256 / var6 + 2; float var5 = 16.0F; int var8; int var9; for(var8 = -var6 * var7; var8 <= var6 * var7; var8 += var6) { for(var9 = -var6 * var7; var9 <= var6 * var7; var9 += var6) { var4.func_78382_b(); var4.func_78377_a((double)(var8 + 0), (double)var5, (double)(var9 + 0)); var4.func_78377_a((double)(var8 + var6), (double)var5, (double)(var9 + 0)); var4.func_78377_a((double)(var8 + var6), (double)var5, (double)(var9 + var6)); var4.func_78377_a((double)(var8 + 0), (double)var5, (double)(var9 + var6)); var4.func_78381_a(); } } GL11.glEndList(); this.field_72781_x = this.field_72772_v + 2; GL11.glNewList(this.field_72781_x, 4864); var5 = -16.0F; var4.func_78382_b(); for(var8 = -var6 * var7; var8 <= var6 * var7; var8 += var6) { for(var9 = -var6 * var7; var9 <= var6 * var7; var9 += var6) { var4.func_78377_a((double)(var8 + var6), (double)var5, (double)(var9 + 0)); var4.func_78377_a((double)(var8 + 0), (double)var5, (double)(var9 + 0)); var4.func_78377_a((double)(var8 + 0), (double)var5, (double)(var9 + var6)); var4.func_78377_a((double)(var8 + var6), (double)var5, (double)(var9 + var6)); } } var4.func_78381_a(); GL11.glEndList(); }
public RenderGlobal(Minecraft par1Minecraft) { this.mc = par1Minecraft; this.renderEngine = par1Minecraft.getTextureManager(); byte b0 = 34; byte b1 = 32; this.glRenderListBase = GLAllocation.generateDisplayLists(b0 * b0 * b1 * 3); this.occlusionEnabled = OpenGlCapsChecker.checkARBOcclusion(); if (this.occlusionEnabled) { this.occlusionResult.clear(); this.glOcclusionQueryBase = GLAllocation.createDirectIntBuffer(b0 * b0 * b1); this.glOcclusionQueryBase.clear(); this.glOcclusionQueryBase.position(0); this.glOcclusionQueryBase.limit(b0 * b0 * b1); ARBOcclusionQuery.glGenQueriesARB(this.glOcclusionQueryBase); } this.starGLCallList = GLAllocation.generateDisplayLists(3); GL11.glPushMatrix(); GL11.glNewList(this.starGLCallList, GL11.GL_COMPILE); this.renderStars(); GL11.glEndList(); GL11.glPopMatrix(); Tessellator tessellator = Tessellator.instance; this.glSkyList = this.starGLCallList + 1; GL11.glNewList(this.glSkyList, GL11.GL_COMPILE); byte b2 = 64; int i = 256 / b2 + 2; float f = 16.0F; int j; int k; for (j = -b2 * i; j <= b2 * i; j += b2) { for (k = -b2 * i; k <= b2 * i; k += b2) { tessellator.startDrawingQuads(); tessellator.addVertex((double)(j + 0), (double)f, (double)(k + 0)); tessellator.addVertex((double)(j + b2), (double)f, (double)(k + 0)); tessellator.addVertex((double)(j + b2), (double)f, (double)(k + b2)); tessellator.addVertex((double)(j + 0), (double)f, (double)(k + b2)); tessellator.draw(); } } GL11.glEndList(); this.glSkyList2 = this.starGLCallList + 2; GL11.glNewList(this.glSkyList2, GL11.GL_COMPILE); f = -16.0F; tessellator.startDrawingQuads(); for (j = -b2 * i; j <= b2 * i; j += b2) { for (k = -b2 * i; k <= b2 * i; k += b2) { tessellator.addVertex((double)(j + b2), (double)f, (double)(k + 0)); tessellator.addVertex((double)(j + 0), (double)f, (double)(k + 0)); tessellator.addVertex((double)(j + 0), (double)f, (double)(k + b2)); tessellator.addVertex((double)(j + b2), (double)f, (double)(k + b2)); } } tessellator.draw(); GL11.glEndList(); }