当前位置: 首页>>代码示例>>Java>>正文


Java GL11.glBegin方法代码示例

本文整理汇总了Java中org.lwjgl.opengl.GL11.glBegin方法的典型用法代码示例。如果您正苦于以下问题:Java GL11.glBegin方法的具体用法?Java GL11.glBegin怎么用?Java GL11.glBegin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.lwjgl.opengl.GL11的用法示例。


在下文中一共展示了GL11.glBegin方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: renderChunk

import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
private static void renderChunk(Chunk chunk) {
    if (!chunk.isUpdate()) {
        if (chunks.containsKey(chunk.getId())) GL11.glDeleteLists(chunks.get(chunk.getId()), 1);
        else chunks.put(chunk.getId(), GL11.glGenLists(1));

        GL11.glNewList(chunks.get(chunk.getId()), GL11.GL_COMPILE);
        GL11.glBegin(GL11.GL_QUADS);
        Block[][][] blocks = chunk.getBlocks();
        for (int x = 0; x < 16; x++)
            for (int y = 0; y < 32; y++)
                for (int z = 0; z < 16; z++)
                    renderBlock(blocks[x][y][z], chunk.getLocation().clone().add(x, y, z));
        GL11.glEnd();
        GL11.glEndList();

        chunk.setUpdate(true);
    }

    // Draw the chunk.
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glCullFace(GL11.GL_BACK);
    GL11.glCallList(chunks.get(chunk.getId()));
    GL11.glDisable(GL11.GL_CULL_FACE);
}
 
开发者ID:Vinetos,项目名称:FreeWorld,代码行数:25,代码来源:Renderer.java

示例2: drawGradientBorderedRect

import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public static void drawGradientBorderedRect(double x, double y, double x2, double y2, float l1, int col1, int col2, int col3) {
	GlStateManager.enableBlend();
    GlStateManager.disableTexture2D();
    GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
    GL11.glPushMatrix();
    RenderUtils.glColor(col1);
    GL11.glLineWidth((float)1.0f);
    GL11.glBegin((int)1);
    GL11.glVertex2d((double)x, (double)y);
    GL11.glVertex2d((double)x, (double)y2);
    GL11.glVertex2d((double)x2, (double)y2);
    GL11.glVertex2d((double)x2, (double)y);
    GL11.glVertex2d((double)x, (double)y);
    GL11.glVertex2d((double)x2, (double)y);
    GL11.glVertex2d((double)x, (double)y2);
    GL11.glVertex2d((double)x2, (double)y2);
    GL11.glEnd();
    GL11.glPopMatrix();
    RenderUtils.drawGradientRect(x, y, x2, y2, col2, col3);
    GlStateManager.enableTexture2D();
    GlStateManager.disableBlend();
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:23,代码来源:RenderUtils.java

示例3: drawFullCircle

import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public static void drawFullCircle(int cx, int cy, double r, int c) {
    r *= 2.0;
    cx *= 2;
    cy *= 2;
    float f = (float)(c >> 24 & 255) / 255.0f;
    float f1 = (float)(c >> 16 & 255) / 255.0f;
    float f2 = (float)(c >> 8 & 255) / 255.0f;
    float f3 = (float)(c & 255) / 255.0f;
    RenderUtils.enableGL2D();
    GL11.glScalef((float)0.5f, (float)0.5f, (float)0.5f);
    GL11.glColor4f((float)f1, (float)f2, (float)f3, (float)f);
    GL11.glBegin((int)6);
    int i = 0;
    while (i <= 360) {
        double x = Math.sin((double)i * 3.141592653589793 / 180.0) * r;
        double y = Math.cos((double)i * 3.141592653589793 / 180.0) * r;
        GL11.glVertex2d((double)((double)cx + x), (double)((double)cy + y));
        ++i;
    }
    GL11.glEnd();
    GL11.glScalef((float)2.0f, (float)2.0f, (float)2.0f);
    RenderUtils.disableGL2D();
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:24,代码来源:RenderUtils.java

示例4: render

import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
/**
 * Game loop render
 */
public void render() {
	Color.white.bind();
	texture.bind(); // or GL11.glBind(texture.getTextureID());
	
	GL11.glBegin(GL11.GL_QUADS);
		GL11.glTexCoord2f(0,0);
		GL11.glVertex2f(100,100);
		GL11.glTexCoord2f(1,0);
		GL11.glVertex2f(100+texture.getTextureWidth(),100);
		GL11.glTexCoord2f(1,1);
		GL11.glVertex2f(100+texture.getTextureWidth(),100+texture.getTextureHeight());
		GL11.glTexCoord2f(0,1);
		GL11.glVertex2f(100,100+texture.getTextureHeight());
	GL11.glEnd();
	
	font.drawString(150, 300, "HELLO LWJGL WORLD", Color.yellow);
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:21,代码来源:TestUtils.java

示例5: drawFullCircle

import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public static void drawFullCircle(float cx, float cy, float r, int c) {
    r *= 2.0;
    cx *= 2;
    cy *= 2;
    float f = (float)(c >> 24 & 255) / 255.0f;
    float f1 = (float)(c >> 16 & 255) / 255.0f;
    float f2 = (float)(c >> 8 & 255) / 255.0f;
    float f3 = (float)(c & 255) / 255.0f;
    GlStateManager.enableBlend();
    GlStateManager.disableTexture2D();
    GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
    GL11.glScalef((float)0.5f, (float)0.5f, (float)0.5f);
    GL11.glColor4f((float)f1, (float)f2, (float)f3, (float)f);
    GL11.glBegin((int)6);
    int i = 0;
    while (i <= 360) {
        double x = Math.sin((double)i * 3.141592653589793 / 180.0) * r;
        double y = Math.cos((double)i * 3.141592653589793 / 180.0) * r;
        GL11.glVertex2d((double)((double)cx + x), (double)((double)cy + y));
        ++i;
    }
    GL11.glEnd();
    GL11.glScalef((float)2.0f, (float)2.0f, (float)2.0f);
    GlStateManager.enableTexture2D();
    GlStateManager.disableBlend();
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:27,代码来源:RenderUtils.java

示例6: drawGradientRect

import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public static void drawGradientRect(float x, float y, float x1, float y1, int topColor, int bottomColor) {
	GlStateManager.enableBlend();
    GlStateManager.disableTexture2D();
    GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
    GL11.glShadeModel((int)7425);
    GL11.glBegin((int)7);
    RenderUtils.glColor(topColor);
    GL11.glVertex2f((float)x, (float)y1);
    GL11.glVertex2f((float)x1, (float)y1);
    RenderUtils.glColor(bottomColor);
    GL11.glVertex2f((float)x1, (float)y);
    GL11.glVertex2f((float)x, (float)y);
    GL11.glEnd();
    GL11.glShadeModel((int)7424);
    GlStateManager.enableTexture2D();
    GlStateManager.disableBlend();
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:18,代码来源:RenderUtils.java

示例7: drawOutlinedBox

import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public static void drawOutlinedBox(AxisAlignedBB boundingBox) {
    if (boundingBox == null) {
        return;
    }
    GL11.glBegin((int)3);
    GL11.glVertex3d((double)boundingBox.minX, (double)boundingBox.maxZ, (double)boundingBox.maxZ);
    GL11.glVertex3d((double)boundingBox.maxZ, (double)boundingBox.maxZ, (double)boundingBox.maxZ);
    GL11.glVertex3d((double)boundingBox.maxZ, (double)boundingBox.maxZ, (double)boundingBox.maxZ);
    GL11.glVertex3d((double)boundingBox.minX, (double)boundingBox.maxZ, (double)boundingBox.maxZ);
    GL11.glVertex3d((double)boundingBox.minX, (double)boundingBox.maxZ, (double)boundingBox.maxZ);
    GL11.glEnd();
    GL11.glBegin((int)3);
    GL11.glVertex3d((double)boundingBox.minX, (double)boundingBox.maxZ, (double)boundingBox.maxZ);
    GL11.glVertex3d((double)boundingBox.maxZ, (double)boundingBox.maxZ, (double)boundingBox.maxZ);
    GL11.glVertex3d((double)boundingBox.maxZ, (double)boundingBox.maxZ, (double)boundingBox.maxZ);
    GL11.glVertex3d((double)boundingBox.minX, (double)boundingBox.maxZ, (double)boundingBox.maxZ);
    GL11.glVertex3d((double)boundingBox.minX, (double)boundingBox.maxZ, (double)boundingBox.maxZ);
    GL11.glEnd();
    GL11.glBegin((int)1);
    GL11.glVertex3d((double)boundingBox.minX, (double)boundingBox.maxZ, (double)boundingBox.maxZ);
    GL11.glVertex3d((double)boundingBox.minX, (double)boundingBox.maxZ, (double)boundingBox.maxZ);
    GL11.glVertex3d((double)boundingBox.maxZ, (double)boundingBox.maxZ, (double)boundingBox.maxZ);
    GL11.glVertex3d((double)boundingBox.maxZ, (double)boundingBox.maxZ, (double)boundingBox.maxZ);
    GL11.glVertex3d((double)boundingBox.maxZ, (double)boundingBox.maxZ, (double)boundingBox.maxZ);
    GL11.glVertex3d((double)boundingBox.maxZ, (double)boundingBox.maxZ, (double)boundingBox.maxZ);
    GL11.glVertex3d((double)boundingBox.minX, (double)boundingBox.maxZ, (double)boundingBox.maxZ);
    GL11.glVertex3d((double)boundingBox.minX, (double)boundingBox.maxZ, (double)boundingBox.maxZ);
    GL11.glEnd();
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:30,代码来源:RenderUtils.java

示例8: drawLogoutSpotTracer

import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public static void drawLogoutSpotTracer(LogoutSpot l)
{
	try
	{
		GL11.glPushMatrix();
		GL11.glEnable(GL11.GL_LINE_SMOOTH);
		GL11.glDisable(GL11.GL_LIGHTING);
		GL11.glDisable(GL11.GL_DEPTH_TEST);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glDepthMask(false);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glLineWidth(1.5F);

		GL11.glColor3d(l.red, l.green, l.blue);
		GL11.glBegin(GL11.GL_LINE_LOOP);
		GL11.glVertex3d(0, 0, 0);
		GL11.glVertex3d(l.dX + 0.5, l.dY + 0.5, l.dZ + 0.5);
		GL11.glEnd();
		
		GL11.glDisable(GL11.GL_BLEND);
		GL11.glDepthMask(true);
		GL11.glEnable(GL11.GL_TEXTURE_2D);
		GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
		GL11.glEnable(GL11.GL_DEPTH_TEST);
		GL11.glEnable(GL11.GL_LIGHTING);
		GL11.glDisable(GL11.GL_LINE_SMOOTH);
		GL11.glPopMatrix();
	}catch(Exception e) {}
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:32,代码来源:RenderUtils.java

示例9: drawComposite

import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public static void drawComposite()
{
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glBegin(GL11.GL_QUADS);
    GL11.glTexCoord2f(0.0F, 0.0F);
    GL11.glVertex3f(0.0F, 0.0F, 0.0F);
    GL11.glTexCoord2f(1.0F, 0.0F);
    GL11.glVertex3f(1.0F, 0.0F, 0.0F);
    GL11.glTexCoord2f(1.0F, 1.0F);
    GL11.glVertex3f(1.0F, 1.0F, 0.0F);
    GL11.glTexCoord2f(0.0F, 1.0F);
    GL11.glVertex3f(0.0F, 1.0F, 0.0F);
    GL11.glEnd();
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:15,代码来源:Shaders.java

示例10: onRender

import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
@Override
public void onRender() {
	if(this.isEnabled()) {	
		GL11.glPushMatrix();
		GL11.glLineWidth(2F);
		GL11.glBlendFunc(770, 771);
		GL11.glEnable(GL_BLEND);
		GL11.glLineWidth(1.0F);
		GL11.glDisable(GL11.GL_TEXTURE_2D);
		GL11.glDisable(GL_DEPTH_TEST);
		GL11.glDepthMask(false);

		GL11.glBegin(GL11.GL_LINE_STRIP);
		for(double[] pos : positionsList) {
			double distance = posit(Math.hypot(pos[0] - RenderManager.renderPosX, pos[1] - RenderManager.renderPosY));
			if(distance > 100) continue;
			GL11.glColor4f(0.0F, 1.0F, 0.0F, 1.0F - (float)(distance / 100D));
			GL11.glVertex3d(pos[0] - RenderManager.renderPosX, pos[1]  - RenderManager.renderPosY, pos[2] - RenderManager.renderPosZ);
		}
		GL11.glEnd();

		GL11.glEnable(GL11.GL_TEXTURE_2D);
		GL11.glEnable(GL_DEPTH_TEST);
		GL11.glDepthMask(true);
		GL11.glDisable(GL_BLEND);
		GL11.glPopMatrix();
	}
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:29,代码来源:Breadcrumb.java

示例11: renderSymbol

import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
@Override
public void renderSymbol()
{
    GL11.glBegin(GL11.GL_LINES);
    GL11.glVertex2f(0.0f, -radius*0.5f);
    GL11.glVertex2f(0.0f, radius*0.5f);
    GL11.glEnd();
}
 
开发者ID:SmashMaster,项目名称:KraftigAudio,代码行数:9,代码来源:AudioInputJack.java

示例12: drawGradientRect

import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public static void drawGradientRect(double x, double y, double x2, double y2, int col1, int col2) 
{
	float f = (float)(col1 >> 24 & 0xFF) / 255F;
	float f1 = (float)(col1 >> 16 & 0xFF) / 255F;
	float f2 = (float)(col1 >> 8 & 0xFF) / 255F;
	float f3 = (float)(col1 & 0xFF) / 255F;

	float f4 = (float)(col2 >> 24 & 0xFF) / 255F;
	float f5 = (float)(col2 >> 16 & 0xFF) / 255F;
	float f6 = (float)(col2 >> 8 & 0xFF) / 255F;
	float f7 = (float)(col2 & 0xFF) / 255F;

	GL11.glEnable(GL11.GL_BLEND);
	GL11.glDisable(GL11.GL_TEXTURE_2D);
	GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
	GL11.glEnable(GL11.GL_LINE_SMOOTH);
	GL11.glShadeModel(GL11.GL_SMOOTH);

	GL11.glPushMatrix();
	GL11.glBegin(GL11.GL_QUADS);
	GL11.glColor4f(f1, f2, f3, f);
	GL11.glVertex2d(x2, y);
	GL11.glVertex2d(x, y);

	GL11.glColor4f(f5, f6, f7, f4);
	GL11.glVertex2d(x, y2);
	GL11.glVertex2d(x2, y2);
	GL11.glEnd();
	GL11.glPopMatrix();

	GL11.glEnable(GL11.GL_TEXTURE_2D);
	GL11.glDisable(GL11.GL_BLEND);
	GL11.glDisable(GL11.GL_LINE_SMOOTH);
	GL11.glShadeModel(GL11.GL_FLAT);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:36,代码来源:RenderUtils.java

示例13: render

import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
@Override
public void render()
{
    //Line
    GL11.glLineWidth(1.0f);
    GL11.glColor3f(0.0f, 0.0f, 0.0f);
    GL11.glBegin(GL11.GL_LINES);
    GraphicsUtil.glVertex(a.pos);
    GraphicsUtil.glVertex(b.pos);
    GL11.glEnd();
    
    //Arrow
    if (type == Type.END && abLen > ARROW_LENGTH)
    {
        Vec3 n = Vec3.sub(Main.instance().getCamera().pos, b.pos).cross(ab).normalize();

        GL11.glBegin(GL11.GL_TRIANGLES);
        GraphicsUtil.glVertex(Vec3.madd(b.pos, n, ARROW_WIDTH).madd(ab, -ARROW_LENGTH));
        GraphicsUtil.glVertex(b.pos);
        GraphicsUtil.glVertex(Vec3.madd(b.pos, n, -ARROW_WIDTH).madd(ab, -ARROW_LENGTH));
        GL11.glEnd();
    }
    
    //Point
    GL11.glPointSize(4.0f);
    GL11.glBegin(GL11.GL_POINTS);
    if (Main.instance().getFocus() == a) GL11.glColor3f(0.75f, 0.75f, 1.0f);
    else GL11.glColor3f(0.0f, 0.0f, 0.0f);
    GraphicsUtil.glVertex(a.pos);
    
    if (type == Type.END)
    {
        if (Main.instance().getFocus() == b) GL11.glColor3f(0.75f, 0.75f, 1.0f);
        else GL11.glColor3f(0.0f, 0.0f, 0.0f);
        GraphicsUtil.glVertex(b.pos);
    }
    GL11.glEnd();
}
 
开发者ID:SmashMaster,项目名称:KraftigAudio,代码行数:39,代码来源:Wire.java

示例14: drawGradientHRect

import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public static void drawGradientHRect(float x, float y, float x1, float y1, int topColor, int bottomColor) {
    RenderUtils.enableGL2D();
    GL11.glShadeModel((int)7425);
    GL11.glBegin((int)7);
    RenderUtils.glColor(topColor);
    GL11.glVertex2f((float)x, (float)y);
    GL11.glVertex2f((float)x, (float)y1);
    RenderUtils.glColor(bottomColor);
    GL11.glVertex2f((float)x1, (float)y1);
    GL11.glVertex2f((float)x1, (float)y);
    GL11.glEnd();
    GL11.glShadeModel((int)7424);
    RenderUtils.disableGL2D();
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:15,代码来源:RenderUtils.java

示例15: render

import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public void render(String text, Vec2 pos, float size, Alignment align)
{
    LineMetrics metrics = font.getLineMetrics(text, frc);
    GlyphVector vector = font.createGlyphVector(frc, text);
    Rectangle2D bounds = vector.getLogicalBounds();
    
    Vec2 rad = new Vec2((float)bounds.getWidth(), (float)bounds.getHeight()).mult(0.5f);
    
    GL11.glPushMatrix();
    GL11.glTranslatef(pos.x, pos.y, 0.0f);
    GL11.glScalef(size, -size, 0.0f);
    GL11.glTranslatef((align.x - 1.0f)*rad.x, (-align.y + 1.0f)*rad.y - metrics.getDescent(), 0.0f);
    
    float[] coords = new float[6];
    float loopX = 0.0f, loopY = 0.0f;
    float px = 0.0f, py = 0.0f;
    
    GL11.glBegin(GL11.GL_LINES);
    for (PathIterator path = vector.getOutline().getPathIterator(identity); !path.isDone(); path.next())
    {
        int code = path.currentSegment(coords);
        float x = coords[0], y = coords[1];
        
        switch (code)
        {
            case PathIterator.SEG_MOVETO: //End segment and move to a new position.
                px = x;
                py = y;
                loopX = x;
                loopY = y;
                break;
            default: //Draw line from previous to current.
                GL11.glVertex2f(px, py);
                GL11.glVertex2f(x, y);
                px = x;
                py = y;
                break;
            case PathIterator.SEG_CLOSE: //Draw line to close loop.
                GL11.glVertex2f(x, y);
                GL11.glVertex2f(loopX, loopY);
                px = 0.0f;
                py = 0.0f;
                loopX = 0.0f;
                loopY = 0.0f;
                break;
        }
    }
    GL11.glEnd();
    
    GL11.glPopMatrix();
}
 
开发者ID:SmashMaster,项目名称:KraftigAudio,代码行数:52,代码来源:VectorFont.java


注:本文中的org.lwjgl.opengl.GL11.glBegin方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。