Skip to content

Instantly share code, notes, and snippets.

@Unh0lyTigg
Created July 7, 2014 09:09
Show Gist options
  • Save Unh0lyTigg/ccd5c769654df15637c5 to your computer and use it in GitHub Desktop.
Save Unh0lyTigg/ccd5c769654df15637c5 to your computer and use it in GitHub Desktop.
non-Minecraft facsimile of Minecraft's glint rendering code
GL11.glDepthFunc(GL11.GL_EQUAL);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glBindTexture(glintTextureId);
GL11.glEnable(GL11.GL_BLEND);
if (GLContext.getCapabilities().OpenGL14) {
if (GLContext.getCapabilities().GL_EXT_blend_func_separate) {
EXTBlendFuncSeparate.glBlendFuncSeparateEXT(GL11.GL_SRC_COLOR, GL11.GL_ONE, GL11.GL_ONE, GL11.GL_ZERO);
} else {
GL14.glBlendFuncSeparate(GL11.GL_SRC_COLOR, GL11.GL_ONE, GL11.GL_ONE, GL11.GL_ZERO);
}
} else {
GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
}
GL11.glColor4f(0.38F, 0.19F, 0.608F, 1.0F);
GL11.glMatrixMode(GL11.GL_TEXTURE);
GL11.glPushMatrix();
GL11.glScalef(0.125F, 0.125F, 0.125F);
float a = (float)((Sys.getTime() * 1000L / Sys.getTimerResolution()) % 3000L) / 3000.0F * 8.0F;
GL11.glTranslatef(a, 0.0F, 0.0F);
GL11.glRotatef(-50.0f, 0.0F, 0.0F, 1.0F);
RENDERSTUFFHERE(); // REPLACE THIS!
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glScalef(0.125F, 0.125F, 0.125F);
a = (float)((Sys.getTime() * 1000L / Sys.getTimerResolution()) % 4873L) / 4873.0F * 8.0F;
GL11.glTranslatef(-a, 0.0F, 0.0F);
GL11.glRotatef(10.0f, 0.0F, 0.0F, 1.0F);
RENDERSTUFFHERE(); // REPLACE THIS!
GL11.glPopMatrix();
GL11.glMatrixMode(GL11.GL_MODELVIEW);
GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDepthFunc(GL_LEQUAL);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment