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


Java GL11.glDrawArrays方法代码示例

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


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

示例1: doOcclusionTest

import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
private void doOcclusionTest(Vector2f sunScreenCoords) {
	if(query.isResultReady()){
		int visibleSamples = query.getResult();
		this.coverage = Math.min(visibleSamples / TOTAL_SAMPLES, 1f);
	}
	if (!query.isInUse()) {
		GL11.glColorMask(false, false, false, false);
		GL11.glDepthMask(false);
		query.start();
		OpenGlUtils.enableDepthTesting(true);
		shader.transform.loadVec4(sunScreenCoords.x, sunScreenCoords.y, TEST_QUAD_WIDTH, TEST_QUAD_HEIGHT);
		GL11.glDrawArrays(GL11.GL_TRIANGLE_STRIP, 0, 4);
		query.end();
		GL11.glColorMask(true, true, true, true);
		GL11.glDepthMask(true);
	}
}
 
开发者ID:TheThinMatrix,项目名称:OcclusionQueries,代码行数:18,代码来源:FlareRenderer.java

示例2: render

import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public static final void render(final Vec3 position, final float scale) {

		shader.start();

		GL30.glBindVertexArray(model.id);
		GL20.glEnableVertexAttribArray(0);
		GL20.glEnableVertexAttribArray(1);
		GL20.glEnableVertexAttribArray(2);

		shader.loadTransformationMatrix(MatrixCreation.createTransformationMatrix(position, new Vec3(), new Vec3(scale, 1, scale)));
		GL11.glDrawArrays(GL11.GL_TRIANGLES, 0, model.vertexCount);

		GL20.glDisableVertexAttribArray(0);
		GL20.glDisableVertexAttribArray(1);
		GL20.glDisableVertexAttribArray(2);
		GL30.glBindVertexArray(0);

		shader.stop();

	}
 
开发者ID:ASasseCreations,项目名称:Voxel_Game,代码行数:21,代码来源:CloudRenderer.java

示例3: flushBuffer

import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
/**
 * Flush the currently cached data down to the card 
 */
private void flushBuffer() {	
	if (vertIndex == 0) {
		return;
	}
	if (currentType == NONE) {
		return;
	}
	
	if (vertIndex < TOLERANCE) {
		GL11.glBegin(currentType);
		for (int i=0;i<vertIndex;i++) {
			GL11.glColor4f(cols[(i*4)+0], cols[(i*4)+1], cols[(i*4)+2], cols[(i*4)+3]);
			GL11.glTexCoord2f(texs[(i*2)+0], texs[(i*2)+1]);
			GL11.glVertex3f(verts[(i*3)+0], verts[(i*3)+1], verts[(i*3)+2]);
		}
		GL11.glEnd();
		currentType = NONE;
		return;
	}
	vertices.clear();
	colors.clear();
	textures.clear();
	
	vertices.put(verts,0,vertIndex*3);
	colors.put(cols,0,vertIndex*4);
	textures.put(texs,0,vertIndex*2);
	
	vertices.flip(); 
	colors.flip(); 
	textures.flip(); 
	
	GL11.glVertexPointer(3,0,vertices);     
	GL11.glColorPointer(4,0,colors);     
	GL11.glTexCoordPointer(2,0,textures);     
	
	GL11.glDrawArrays(currentType, 0, vertIndex);
	currentType = NONE;
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:42,代码来源:VAOGLRenderer.java

示例4: drawArrays

import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public static void drawArrays(int drawMode, int first, int count, VertexBuffer wrr)
{
    if (count != 0)
    {
        VertexFormat vertexformat = wrr.getVertexFormat();
        int i = vertexformat.getNextOffset();

        if (i == 56)
        {
            ByteBuffer bytebuffer = wrr.getByteBuffer();
            bytebuffer.position(32);
            GL20.glVertexAttribPointer(Shaders.midTexCoordAttrib, 2, GL11.GL_FLOAT, false, i, bytebuffer);
            bytebuffer.position(40);
            GL20.glVertexAttribPointer(Shaders.tangentAttrib, 4, GL11.GL_SHORT, false, i, bytebuffer);
            bytebuffer.position(48);
            GL20.glVertexAttribPointer(Shaders.entityAttrib, 3, GL11.GL_SHORT, false, i, bytebuffer);
            bytebuffer.position(0);
            GL20.glEnableVertexAttribArray(Shaders.midTexCoordAttrib);
            GL20.glEnableVertexAttribArray(Shaders.tangentAttrib);
            GL20.glEnableVertexAttribArray(Shaders.entityAttrib);
            GL11.glDrawArrays(drawMode, first, count);
            GL20.glDisableVertexAttribArray(Shaders.midTexCoordAttrib);
            GL20.glDisableVertexAttribArray(Shaders.tangentAttrib);
            GL20.glDisableVertexAttribArray(Shaders.entityAttrib);
        }
        else
        {
            GL11.glDrawArrays(drawMode, first, count);
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:32,代码来源:SVertexBuilder.java

示例5: render

import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
/**
    * Renders this VAO as triangles
    */
   public void render() {
bind();

// Enable all the attributes
enableAttributes();

// Render the entire VAO as triangles
GL11.glDrawArrays(GL11.GL_TRIANGLES, 0, vertexCount);

// Disable all the attributes
disableAttributes();

unbind();
   }
 
开发者ID:camilne,项目名称:open-world,代码行数:18,代码来源:VAO.java

示例6: render

import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public void render(Terrain terrain, ICamera camera, Light light) {
    prepare(terrain, camera, light);
    if (hasIndices) {
        GL11.glDrawElements(GL11.GL_TRIANGLES, terrain.getVertexCount(), GL11.GL_UNSIGNED_INT, 0);
    } else {
        GL11.glDrawArrays(GL11.GL_TRIANGLES, 0, terrain.getVertexCount());
    }
    stop(terrain);
}
 
开发者ID:GryPLOfficial,项目名称:EcoSystem-Official,代码行数:10,代码来源:TerrainRenderer.java

示例7: drawArrays

import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public static void drawArrays(int drawMode, int first, int count, WorldRenderer wrr)
{
    if (count != 0)
    {
        VertexFormat vertexformat = wrr.getVertexFormat();
        int i = vertexformat.getNextOffset();

        if (i == 56)
        {
            ByteBuffer bytebuffer = wrr.getByteBuffer();
            bytebuffer.position(32);
            GL20.glVertexAttribPointer(Shaders.midTexCoordAttrib, 2, GL11.GL_FLOAT, false, i, bytebuffer);
            bytebuffer.position(40);
            GL20.glVertexAttribPointer(Shaders.tangentAttrib, 4, GL11.GL_SHORT, false, i, bytebuffer);
            bytebuffer.position(48);
            GL20.glVertexAttribPointer(Shaders.entityAttrib, 3, GL11.GL_SHORT, false, i, bytebuffer);
            bytebuffer.position(0);
            GL20.glEnableVertexAttribArray(Shaders.midTexCoordAttrib);
            GL20.glEnableVertexAttribArray(Shaders.tangentAttrib);
            GL20.glEnableVertexAttribArray(Shaders.entityAttrib);
            GL11.glDrawArrays(drawMode, first, count);
            GL20.glDisableVertexAttribArray(Shaders.midTexCoordAttrib);
            GL20.glDisableVertexAttribArray(Shaders.tangentAttrib);
            GL20.glDisableVertexAttribArray(Shaders.entityAttrib);
        }
        else
        {
            GL11.glDrawArrays(drawMode, first, count);
        }
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:32,代码来源:SVertexBuilder.java

示例8: draw

import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
private void draw(int p_draw_1_, int p_draw_2_)
{
    int i = p_draw_2_ - p_draw_1_;

    if (i > 0)
    {
        int j = p_draw_1_ * 4;
        int k = i * 4;
        GL11.glDrawArrays(this.drawMode, j, k);
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:12,代码来源:WorldRenderer.java

示例9: runShader

import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public static void runShader() {
	Minecraft mc = Minecraft.getMinecraft();
	
	//TODO remove
	if (Keyboard.isKeyDown(Keyboard.KEY_NUMPAD5)) {
		destroyShader();
		createShader();
	}
	
	//Use shader program
	GL20.glUseProgram(shader.getShaderProgram());
	
	//TODO third person view
	Entity entity = mc.getRenderViewEntity();
	float partialTicks = mc.getRenderPartialTicks();
	double entityPosX = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * (double)partialTicks;
       double entityPosY = entity.lastTickPosY + entity.getEyeHeight() + (entity.posY - entity.lastTickPosY) * (double)partialTicks;
       double entityPosZ = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * (double)partialTicks;
       float fov = (float) Math.toRadians(mc.entityRenderer.getFOVModifier(partialTicks, true));
	
	//Set uniform values
	int texUniform = GL20.glGetUniformLocation(shader.getShaderProgram(), "tex");
	GL20.glUniform1i(texUniform, 0);
	int cameraPosUniform = GL20.glGetUniformLocation(shader.getShaderProgram(), "cameraPos");
	GL20.glUniform3f(cameraPosUniform, (float)entityPosX%16, (float)entityPosY%16, (float)entityPosZ%16);
	int cameraDirUniform = GL20.glGetUniformLocation(shader.getShaderProgram(), "cameraDir");
	GL20.glUniform3f(cameraDirUniform, -(float)Math.toRadians(entity.rotationPitch), (float)Math.toRadians(180+entity.rotationYaw), 0);
	int fovyUniform = GL20.glGetUniformLocation(shader.getShaderProgram(), "fovy");
	GL20.glUniform1f(fovyUniform, fov);
	int fovxUniform = GL20.glGetUniformLocation(shader.getShaderProgram(), "fovx");
	GL20.glUniform1f(fovxUniform, fov*Display.getWidth()/(float)Display.getHeight());
	int sphericalUniform = GL20.glGetUniformLocation(shader.getShaderProgram(), "spherical");
	GL20.glUniform1i(sphericalUniform, RayTracerSettings.spherical ? 1 : 0);
	int stereoscopicUniform = GL20.glGetUniformLocation(shader.getShaderProgram(), "stereoscopic3d");
	GL20.glUniform1i(stereoscopicUniform, RayTracerSettings.stereoscopic ? 1 : 0);
	int eyeWidthUniform = GL20.glGetUniformLocation(shader.getShaderProgram(), "eyeWidth");
	GL20.glUniform1f(eyeWidthUniform, 0.063f); //TODO input eyeWidth option
	
	if (!pauseRendering) {
		if (worldLoader == null) {
			worldLoader = new WorldLoader();
		}
		if (worldLoader.dimension != mc.world.provider.getDimension()) {
			worldLoader.dimension = mc.world.provider.getDimension();
		}
		worldLoader.updateWorld(entityPosX, entityPosY, entityPosZ, shader);

		//Setup view
		GL11.glMatrixMode(GL11.GL_PROJECTION);
		GL11.glPushMatrix();
		GL11.glLoadIdentity();
		GL11.glOrtho(-1, 1, -1, 1, -1, 1);
		GL11.glMatrixMode(GL11.GL_MODELVIEW);
		GL11.glPushMatrix();
		GL11.glLoadIdentity();

		//Bind vbo and texture
		GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, shader.getVbo());
		GL20.glEnableVertexAttribArray(0);
		GL20.glVertexAttribPointer(0, 2, GL11.GL_BYTE, false, 0, 0L);
		GL11.glBindTexture(GL11.GL_TEXTURE_2D, 8);

		//Render
		GL11.glDrawArrays(GL11.GL_TRIANGLES, 0, 6);

		//Reset vbo and texture
		GL11.glBindTexture(GL11.GL_TEXTURE_2D, 0);
		GL20.glDisableVertexAttribArray(0);
		GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);

		//Reset view
		GL11.glMatrixMode(GL11.GL_PROJECTION);
		GL11.glPopMatrix();
		GL11.glMatrixMode(GL11.GL_MODELVIEW);
		GL11.glPopMatrix();
	}
	
	//Stop using shader program
	GL20.glUseProgram(0);
}
 
开发者ID:18107,项目名称:MC-Ray-Tracer,代码行数:81,代码来源:RenderUtil.java

示例10: func_181679_a

import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
@SuppressWarnings("incomplete-switch")
public void func_181679_a(WorldRenderer p_181679_1_)
{
    if (p_181679_1_.getVertexCount() > 0)
    {
        VertexFormat vertexformat = p_181679_1_.getVertexFormat();
        int i = vertexformat.getNextOffset();
        ByteBuffer bytebuffer = p_181679_1_.getByteBuffer();
        List<VertexFormatElement> list = vertexformat.getElements();

        for (int j = 0; j < list.size(); ++j)
        {
            VertexFormatElement vertexformatelement = (VertexFormatElement)list.get(j);
            VertexFormatElement.EnumUsage vertexformatelement$enumusage = vertexformatelement.getUsage();
            int k = vertexformatelement.getType().getGlConstant();
            int l = vertexformatelement.getIndex();
            bytebuffer.position(vertexformat.func_181720_d(j));

            switch (vertexformatelement$enumusage)
            {
                case POSITION:
                    GL11.glVertexPointer(vertexformatelement.getElementCount(), k, i, bytebuffer);
                    GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY);
                    break;

                case UV:
                    OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit + l);
                    GL11.glTexCoordPointer(vertexformatelement.getElementCount(), k, i, bytebuffer);
                    GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY);
                    OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit);
                    break;

                case COLOR:
                    GL11.glColorPointer(vertexformatelement.getElementCount(), k, i, bytebuffer);
                    GL11.glEnableClientState(GL11.GL_COLOR_ARRAY);
                    break;

                case NORMAL:
                    GL11.glNormalPointer(k, i, bytebuffer);
                    GL11.glEnableClientState(GL11.GL_NORMAL_ARRAY);
            }
        }

        GL11.glDrawArrays(p_181679_1_.getDrawMode(), 0, p_181679_1_.getVertexCount());
        int i1 = 0;

        for (int j1 = list.size(); i1 < j1; ++i1)
        {
            VertexFormatElement vertexformatelement1 = (VertexFormatElement)list.get(i1);
            VertexFormatElement.EnumUsage vertexformatelement$enumusage1 = vertexformatelement1.getUsage();
            int k1 = vertexformatelement1.getIndex();

            switch (vertexformatelement$enumusage1)
            {
                case POSITION:
                    GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY);
                    break;

                case UV:
                    OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit + k1);
                    GL11.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY);
                    OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit);
                    break;

                case COLOR:
                    GL11.glDisableClientState(GL11.GL_COLOR_ARRAY);
                    GlStateManager.resetColor();
                    break;

                case NORMAL:
                    GL11.glDisableClientState(GL11.GL_NORMAL_ARRAY);
            }
        }
    }

    p_181679_1_.reset();
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:78,代码来源:WorldVertexBufferUploader.java

示例11: drawArrays

import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public void drawArrays(int mode)
{
    GL11.glDrawArrays(mode, 0, this.count);
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:5,代码来源:VertexBuffer.java

示例12: render

import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public static final void render(final Light sun) {

		if (HandModel.MODEL == null) return;

		final float time = Mathf.cos(Timings.globalTime_f);
		final float yBobbing = time / 12f;

		shader.start();

		shader.loadLight(sun);
		shader.loadViewMatrix(GameCamera.view);

		final Mat4 matrix = MatrixCreation.createTransformationMatrix(new Vec3(UserSettings.WALK_OFFSET_HORIZONTAL, UserSettings.WALK_OFFSET_VERTICLE + yBobbing, UserSettings.WALK_OFFSET_DEPTH),
				new Vec3(10f + time * 5f, -5f, 5f + time * 5f), new Vec3(0.3f, 0.3f, 0.3f));

		shader.loadTransformationMatrix(matrix);

		GL11.glDrawArrays(GL11.GL_TRIANGLES, 0, HandModel.MODEL.vertexCount);

		shader.stop();

	}
 
开发者ID:ASasseCreations,项目名称:Voxel_Game,代码行数:23,代码来源:HandRenderer.java

示例13: glDrawArrays

import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public static void glDrawArrays(int p_187439_0_, int p_187439_1_, int p_187439_2_)
{
    GL11.glDrawArrays(p_187439_0_, p_187439_1_, p_187439_2_);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:5,代码来源:GlStateManager.java

示例14: render

import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
/**
 * Renders a terrain to the screen. If the terrain has an index buffer the
 * glDrawElements is used. Otherwise glDrawArrays is used.
 * 
 * @param terrain
 *            - The terrain to be rendered.
 * @param camera
 *            - The camera being used for rendering the terrain.
 * @param light
 *            - The light being used to iluminate the terrain.
 */
public void render(Terrain terrain, ICamera camera, Light light) {
	prepare(terrain, camera, light);
	if (hasIndices) {
		GL11.glDrawElements(GL11.GL_TRIANGLES, terrain.getVertexCount(), GL11.GL_UNSIGNED_INT, 0);
	} else {
		GL11.glDrawArrays(GL11.GL_TRIANGLES, 0, terrain.getVertexCount());
	}
	finish(terrain);
}
 
开发者ID:TheThinMatrix,项目名称:LowPolyTerrain,代码行数:21,代码来源:TerrainRenderer.java

示例15: render

import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
/**
 * Renders the water. The render call here is "glDrawArrays" instead of
 * "glDrawElements" because no vertices are shared, so indices would be
 * pointless.
 *
 * @param water             - The water being rendered.
 * @param camera            - The camera being used to render the water.
 * @param light             - The light in the scene.
 * @param reflectionTexture - The reflection texture - an image of the scene taken with an
 *                          inverted camera. This will be applied to the water's surface
 *                          to simulate reflection.
 * @param refractionTexture - The refraction texture - and image of the scene from the
 *                          camera's current position that will be applied to the water
 *                          mesh to simulate refraction. A texture is used here so that it
 *                          can be distorted, but if no distortion is required then the
 *                          same effect could be achieved using alpha blending.
 * @param depthTexture      - An image of the depth buffer for the scene. This is used to
 *                          apply depth effects to the water.
 */
public void render(WaterTile water, ICamera camera, Light light, int reflectionTexture, int refractionTexture, int depthTexture) {
    prepare(water, camera, light);
    bindTextures(reflectionTexture, refractionTexture, depthTexture);
    GL11.glDrawArrays(GL11.GL_TRIANGLES, 0, water.getVertexCount());
    finish(water);
}
 
开发者ID:GryPLOfficial,项目名称:EcoSystem-Official,代码行数:26,代码来源:WaterRenderer.java


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