本文整理了Java中org.lwjgl.opengl.GL11
类的一些代码示例,展示了GL11
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GL11
类的具体详情如下:
包路径:org.lwjgl.opengl.GL11
类名称:GL11
[英]The OpenGL functionality up to version 1.1. Includes the deprecated symbols of the Compatibility Profile.
Extensions promoted to core in this release:
代码示例来源:origin: libgdx/libgdx
public void glEnable (int cap) {
GL11.glEnable(cap);
}
代码示例来源:origin: libgdx/libgdx
public void glClear (int mask) {
GL11.glClear(mask);
}
代码示例来源:origin: libgdx/libgdx
public void glViewport (int x, int y, int width, int height) {
GL11.glViewport(x, y, width, height);
}
代码示例来源:origin: MovingBlocks/Terasology
@Override
public void prepareToRender() {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
}
代码示例来源:origin: MovingBlocks/Terasology
public static void initOpenGLParams() {
glEnable(GL_CULL_FACE);
glEnable(GL_DEPTH_TEST);
glEnable(GL_NORMALIZE);
glDepthFunc(GL_LEQUAL);
}
代码示例来源:origin: libgdx/libgdx
public void create () {
glClearColor(0, 0, 0, 0);
glClearDepth(1);
glDisable(GL_LIGHTING);
batch = new SpriteBatch();
sampleNeheButton.doClick();
}
代码示例来源:origin: libgdx/libgdx
GL11.glClearColor(renderingBackgroundColor.r, renderingBackgroundColor.g, renderingBackgroundColor.b,
renderingBackgroundColor.a);
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
} else {
GL11.glClearColor(1, 1, 1, 1);
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
glEnable(GL_TEXTURE_2D);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glEnableClientState(GL_VERTEX_ARRAY);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glViewport(0, 0, width, height);
glScissor(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, width, height, 0, 1, -1);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glDisable(GL_TEXTURE_2D);
glColor4f(renderingBackgroundColor.r, renderingBackgroundColor.g, renderingBackgroundColor.b,
renderingBackgroundColor.a);
glBegin(GL_QUADS);
glVertex3f(0, 0, 0);
glVertex3f(0, texture.getHeight(), 0);
代码示例来源:origin: MovingBlocks/Terasology
glDeleteTextures(fbo.colorBufferTextureId);
createColorBuffer(fbo, dimensions, type);
glDeleteTextures(fbo.normalsBufferTextureId);
createNormalsBuffer(fbo, dimensions);
glDeleteTextures(fbo.lightBufferTextureId);
createLightBuffer(fbo, dimensions, type);
glDeleteTextures(fbo.depthStencilTextureId);
glDeleteRenderbuffersEXT(fbo.depthStencilRboId);
createDepthBuffer(fbo, dimensions, useStencilBuffer);
GL11.glBindTexture(GL11.GL_TEXTURE_2D, 0);
bufferIds.put(GL_COLOR_ATTACHMENT1_EXT);
bufferIds.put(GL_COLOR_ATTACHMENT2_EXT);
bufferIds.flip();
if (bufferIds.limit() == 0) {
GL11.glReadBuffer(GL11.GL_NONE);
GL20.glDrawBuffers(GL11.GL_NONE);
} else {
代码示例来源:origin: MovingBlocks/Terasology
@Override
public void unbindFrame() {
GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, 0);
GL11.glViewport(vp.get(0), vp.get(1), vp.get(2), vp.get(3));
glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, Display.getWidth(), Display.getHeight(), 0, 0, 2048f);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
代码示例来源:origin: nifty-gui/nifty-gui
private int createTextureID() {
IntBuffer tmp = createIntBuffer(1);
GL11.glGenTextures(tmp);
checkGLError();
return tmp.get(0);
}
代码示例来源:origin: SlimeKnights/TinkersConstruct
public static void saveGlTexture(String name, int textureId, int mipmapLevels) {
GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureId);
GL11.glPixelStorei(GL11.GL_PACK_ALIGNMENT, 1);
GL11.glPixelStorei(GL11.GL_UNPACK_ALIGNMENT, 1);
for(int level = 0; level <= mipmapLevels; level++) {
int width = GL11.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, level, GL11.GL_TEXTURE_WIDTH);
int height = GL11.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, level, GL11.GL_TEXTURE_HEIGHT);
int size = width * height;
BufferedImage bufferedimage = new BufferedImage(width, height, 2);
File output = new File(name + "_" + level + ".png");
IntBuffer buffer = BufferUtils.createIntBuffer(size);
int[] data = new int[size];
GL11.glGetTexImage(GL11.GL_TEXTURE_2D, level, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, buffer);
buffer.get(data);
bufferedimage.setRGB(0, 0, width, height, data, 0, width);
try {
ImageIO.write(bufferedimage, "png", output);
FMLLog.info("[TextureDump] Exported png to: " + output.getAbsolutePath());
} catch(IOException ioexception) {
FMLLog.info("[TextureDump] Unable to write: ", ioexception);
}
}
}
}
代码示例来源:origin: MovingBlocks/Terasology
@Override
public void preRender() {
glDisable(GL_DEPTH_TEST);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glOrtho(0, Display.getWidth(), Display.getHeight(), 0, 0, 2048f);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
modelView = new Matrix4f();
modelView.setIdentity();
modelView.setTranslation(new Vector3f(0, 0, -1024f));
MatrixUtils.matrixToFloatBuffer(modelView, matrixBuffer);
glLoadMatrix(matrixBuffer);
matrixBuffer.rewind();
glScalef(uiScale, uiScale, uiScale);
requestedCropRegion = Rect2i.createFromMinAndSize(0, 0, Display.getWidth(), Display.getHeight());
currentTextureCropRegion = requestedCropRegion;
textureMat.setFloat4(CROPPING_BOUNDARIES_PARAM, requestedCropRegion.minX(), requestedCropRegion.maxX(),
requestedCropRegion.minY(), requestedCropRegion.maxY());
}
代码示例来源:origin: MovingBlocks/Terasology
public void renderSolidLocally() {
CoreRegistry.get(ShaderManager.class).enableDefault();
if (displayListSolid == -1) {
generateDisplayListSolid();
}
glEnable(GL_BLEND);
glPushMatrix();
glTranslated(0f, aabb.getCenter().y, 0f);
glScalef(1.5f, 1.5f, 1.5f);
glCallList(displayListSolid);
glPopMatrix();
glDisable(GL_BLEND);
}
代码示例来源:origin: SquidDev-CC/plethora
public void restore() {
GlStateManager.matrixMode(GL11.GL_PROJECTION);
GL11.glLoadMatrix(projection);
GlStateManager.matrixMode(GL11.GL_MODELVIEW);
GL11.glLoadMatrix(modelView);
OpenGlHelper.glBindFramebuffer(OpenGlHelper.GL_FRAMEBUFFER, buffer);
GL11.glViewport(viewport.get(0), viewport.get(1), viewport.get(2), viewport.get(3));
available.add(this);
}
代码示例来源:origin: MovingBlocks/Terasology
@Override
public void postRender() {
Iterator<Map.Entry<TextCacheKey, Map<Material, Mesh>>> textIterator = cachedText.entrySet().iterator();
while (textIterator.hasNext()) {
Map.Entry<TextCacheKey, Map<Material, Mesh>> entry = textIterator.next();
if (!usedText.contains(entry.getKey())) {
entry.getValue().values().forEach(Mesh::dispose);
textIterator.remove();
}
}
usedText.clear();
Iterator<Map.Entry<TextureCacheKey, Mesh>> textureIterator = cachedTextures.entrySet().iterator();
while (textureIterator.hasNext()) {
Map.Entry<TextureCacheKey, Mesh> entry = textureIterator.next();
if (!usedTextures.contains(entry.getKey())) {
entry.getValue().dispose();
textureIterator.remove();
}
}
usedTextures.clear();
glMatrixMode(GL_MODELVIEW);
glPopMatrix();
glMatrixMode(GL_PROJECTION);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
glEnable(GL_DEPTH_TEST);
glDisable(GL_BLEND);
}
代码示例来源:origin: Vazkii/Botania
private static void renderPlayerLook(EntityPlayer player, ItemStack stack) {
List<BlockPos> coords = ItemAstrolabe.getBlocksToPlace(stack, player);
if (ItemAstrolabe.hasBlocks(stack, player, coords)) {
Block block = ItemAstrolabe.getBlock(stack);
int meta = ItemAstrolabe.getBlockMeta(stack);
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
ShaderHelper.useShader(ShaderHelper.alpha, shader -> {
int alpha = ARBShaderObjects.glGetUniformLocationARB(shader, "alpha");
ARBShaderObjects.glUniform1fARB(alpha, 0.4F);
});
for(BlockPos coord : coords)
renderBlockAt(block, meta, coord);
ShaderHelper.releaseShader();
GL11.glPopMatrix();
}
}
代码示例来源:origin: MovingBlocks/Terasology
private void renderBoneOrientation(EntityRef boneEntity) {
LocationComponent loc = boneEntity.getComponent(LocationComponent.class);
if (loc == null) {
return;
}
glPushMatrix();
Vector3f worldPosA = loc.getWorldPosition();
Quat4f worldRot = loc.getWorldRotation();
Vector3f offset = new Vector3f(0, 0, 0.1f);
worldRot.rotate(offset, offset);
offset.add(worldPosA);
glBegin(GL11.GL_LINES);
glVertex3f(worldPosA.x, worldPosA.y, worldPosA.z);
glVertex3f(offset.x, offset.y, offset.z);
glEnd();
loc.getChildren().forEach(this::renderBoneOrientation);
glPopMatrix();
}
代码示例来源:origin: MovingBlocks/Terasology
public void beginRenderOverlay() {
if (effectsTexture == null || !effectsTexture.isLoaded()) {
return;
}
defaultTextured.activateFeature(ShaderProgramFeature.FEATURE_ALPHA_REJECT);
defaultTextured.enable();
glBindTexture(GL11.GL_TEXTURE_2D, effectsTexture.getId());
glEnable(GL11.GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
代码示例来源:origin: MovingBlocks/Terasology
@Override
public void bindFrame() {
vp = BufferUtils.createIntBuffer(16);
GL11.glGetInteger(GL11.GL_VIEWPORT, vp);
GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, frame);
GL11.glViewport(0, 0, size.x(), size.y());
glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, size.x(), size.y(), 0, 0, 2048f);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
}
代码示例来源:origin: MovingBlocks/Terasology
public void renderLocally(float lineThickness) {
CoreRegistry.get(ShaderManager.class).enableDefault();
if (displayListWire == -1) {
generateDisplayListWire();
}
glPushMatrix();
glTranslated(0f, aabb.getCenter().y, 0f);
glLineWidth(lineThickness);
glCallList(displayListWire);
glPopMatrix();
}
内容来源于网络,如有侵权,请联系作者删除!