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


Java GL31类代码示例

本文整理汇总了Java中org.lwjgl.opengl.GL31的典型用法代码示例。如果您正苦于以下问题:Java GL31类的具体用法?Java GL31怎么用?Java GL31使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: load

import org.lwjgl.opengl.GL31; //导入依赖的package包/类
public void load(BiConsumer<Integer, FloatBuffer> consumer) {
	int stride = stride();

	if (ubo == null)
		ubo = new GLObject(Type.BUFFER);
	
	if (buffer == null)
		buffer = BufferUtils.createFloatBuffer(size(stride));

	buffer.rewind();
	for (int i = 0; i < blockCount; ++i) {
		buffer.position(i * stride);
		consumer.accept(i, buffer);
	}
	buffer.rewind();
	GL15.glBindBuffer(GL31.GL_UNIFORM_BUFFER, ubo.getId());
	GL15.glBufferData(GL31.GL_UNIFORM_BUFFER, buffer, GL15.GL_STREAM_DRAW);
	GL15.glBindBuffer(GL31.GL_UNIFORM_BUFFER, 0);
}
 
开发者ID:arisona,项目名称:ether,代码行数:20,代码来源:FloatUniformBuffer.java

示例2: render

import org.lwjgl.opengl.GL31; //导入依赖的package包/类
protected void render(Map<ParticleTexture, List<Particle>> particles, Camera camera) {
	Matrix4f viewMatrix = Maths.createViewMatrix(camera);
	prepare();
	for (ParticleTexture texture : particles.keySet()) {
		bindTexture(texture);
		List<Particle> particleList = particles.get(texture);
		pointer = 0;
		float[] vboData = new float[particleList.size() * INSTANCE_DATA_LENGHT];
		for (Particle particle : particleList) {
			updateModelViewMatrix(particle.getPosition(), particle.getRotation(), particle.getScale(), viewMatrix,
					vboData);
			updateTexCoordInfo(particle, vboData);
		}
		loader.updateVbo(vbo, vboData, buffer);
		GL31.glDrawArraysInstanced(GL11.GL_TRIANGLE_STRIP, 0, quad.getVertexCount(), particleList.size());
	}
	finishRendering();
}
 
开发者ID:Radseq,项目名称:Mystic-Bastion,代码行数:19,代码来源:ParticleRenderer.java

示例3: fillColor

import org.lwjgl.opengl.GL31; //导入依赖的package包/类
public void fillColor(int color){
	int r= (color&0xFF000000)>>>24;
	int g= (color&0x00FF0000)>>>16;
	int b= (color&0x0000FF00)>>>8;
	int a= (color&0x000000FF)>>>0;
	buf.clear();
	for(int i=0; i!=maxcubes; i++){
		buf.put((byte)r);
		buf.put((byte)g);
		buf.put((byte)b);
		buf.put((byte)a);
	}
	buf.flip();
	GL15.glBindBuffer(GL31.GL_TEXTURE_BUFFER, colorbuf);
	GL15.glBufferSubData(GL31.GL_TEXTURE_BUFFER, 0, buf);
}
 
开发者ID:Robowars,项目名称:RoboWarsInvasion,代码行数:17,代码来源:CubeRenderer.java

示例4: getDeviceProperties

import org.lwjgl.opengl.GL31; //导入依赖的package包/类
private void getDeviceProperties(){
	System.out.println("OpenGL version: " + GL11.glGetString(GL11.GL_VERSION) + " bytes");
	System.out.println("Max Geometry Uniform Blocks: " + GL31.GL_MAX_GEOMETRY_UNIFORM_BLOCKS+ " bytes");
	System.out.println("Max Geometry Shader Invocations: " + GL40.GL_MAX_GEOMETRY_SHADER_INVOCATIONS + " bytes");
	System.out.println("Max Uniform Buffer Bindings: " + GL31.GL_MAX_UNIFORM_BUFFER_BINDINGS + " bytes");
	System.out.println("Max Uniform Block Size: " + GL31.GL_MAX_UNIFORM_BLOCK_SIZE + " bytes");
	System.out.println("Max SSBO Block Size: " + GL43.GL_MAX_SHADER_STORAGE_BLOCK_SIZE + " bytes");		
}
 
开发者ID:oreonengine,项目名称:Lwjgl3-Game-Engine-Programming-Series,代码行数:9,代码来源:CoreEngine.java

示例5: buildMapping

import org.lwjgl.opengl.GL31; //导入依赖的package包/类
private static void buildMapping() {
	if (mapping != null) return;
	Multimap<Integer, String> map = HashMultimap.create();
	List<Class<?>> classes = ImmutableList.of(
			GL11.class, GL12.class, GL13.class, GL14.class, GL15.class,
			GL20.class, GL21.class, GL30.class, GL31.class, GL32.class,
			GL33.class, GL40.class, GL41.class, GL42.class, GL43.class,
			GL44.class, GL45.class, GLFW.class
			);
	for (Class<?> clazz : classes) {
		for (Field f : clazz.getDeclaredFields()) {
			if (f.getName().toUpperCase(Locale.ROOT).equals(f.getName()) &&
					f.getType() == int.class && Modifier.isPublic(f.getModifiers()) && Modifier.isStatic(f.getModifiers())) {
				List<String> li = Splitter.on('_').splitToList(f.getName());
				li = li.subList(1, li.size());
				String clean =
					Joiner.on(' ').join(
						li.stream()
							.map(Errors::toTitleCase)
							.iterator());
				try {
					map.put(f.getInt(null), clean);
				} catch (Throwable t) {
					t.printStackTrace();
				}
			}
		}
	}
	mapping = map;
}
 
开发者ID:surgeplay,项目名称:Visage,代码行数:31,代码来源:Errors.java

示例6: getDeviceProperties

import org.lwjgl.opengl.GL31; //导入依赖的package包/类
private void getDeviceProperties(){
	System.out.println("OpenGL version: " + GL11.glGetString(GL11.GL_VERSION) + " bytes");
	System.out.println("Max Geometry Uniform Blocks: " + GL11.glGetInteger(GL31.GL_MAX_GEOMETRY_UNIFORM_BLOCKS));
	System.out.println("Max Geometry Shader Invocations: " + GL11.glGetInteger(GL40.GL_MAX_GEOMETRY_SHADER_INVOCATIONS));
	System.out.println("Max Uniform Buffer Bindings: " + GL11.glGetInteger(GL31.GL_MAX_UNIFORM_BUFFER_BINDINGS));
	System.out.println("Max Uniform Block Size: " + GL11.glGetInteger(GL31.GL_MAX_UNIFORM_BLOCK_SIZE) + " bytes");
	System.out.println("Max SSBO Block Size: " + GL11.glGetInteger(GL43.GL_MAX_SHADER_STORAGE_BLOCK_SIZE) + " bytes");	
	System.out.println("Max Image Bindings: " + GL11.glGetInteger(GL42.GL_MAX_IMAGE_UNITS));
}
 
开发者ID:oreonengine,项目名称:oreon-engine,代码行数:10,代码来源:GLRenderEngine.java

示例7: glDrawArraysInstanced

import org.lwjgl.opengl.GL31; //导入依赖的package包/类
public static void glDrawArraysInstanced(int mode, int first, int count, int primcount) {
	if(GL_VERSION >= 31) {
		GL31.glDrawArraysInstanced(mode, first, count, primcount);
	}
	else if(GLContext.getCapabilities().GL_ARB_draw_instanced) {
		ARBDrawInstanced.glDrawArraysInstancedARB(mode, first, count, primcount);
	}
	else {
		throw new UnsupportedOperationException("GL_ARB_draw_instanced not supported on this system.");
	}
}
 
开发者ID:ra4king,项目名称:LWJGL-OpenGL-Utils,代码行数:12,代码来源:RenderUtils.java

示例8: glDrawElementsInstanced

import org.lwjgl.opengl.GL31; //导入依赖的package包/类
public static void glDrawElementsInstanced(int mode, int indices_count, int type, long indices_buffer_offset, int primcount) {
	if(GL_VERSION >= 31) {
		GL31.glDrawElementsInstanced(mode, indices_count, type, indices_buffer_offset, primcount);
	}
	else if(GLContext.getCapabilities().GL_ARB_draw_instanced) {
		ARBDrawInstanced.glDrawElementsInstancedARB(mode, indices_count, type, indices_buffer_offset, primcount);
	}
	else {
		throw new UnsupportedOperationException("GL_ARB_draw_instanced not supported on this system.");
	}
}
 
开发者ID:ra4king,项目名称:LWJGL-OpenGL-Utils,代码行数:12,代码来源:RenderUtils.java

示例9: CubeRenderer

import org.lwjgl.opengl.GL31; //导入依赖的package包/类
/**Must only be constructed from render thread*/
public CubeRenderer(int maxcubes){
	this.maxcubes= maxcubes;
	if(buf.capacity()<maxcubes*POS_SIZE){
		buf= BufferUtils.createByteBuffer(maxcubes*POS_SIZE);
	}

	//buffer texture buffer allocation
	posbuf= GL15.glGenBuffers();
	GL15.glBindBuffer(GL31.GL_TEXTURE_BUFFER, posbuf);
	GL15.glBufferData(GL31.GL_TEXTURE_BUFFER, maxcubes*POS_SIZE, GL15.GL_DYNAMIC_DRAW);
	
	colorbuf= GL15.glGenBuffers();
	GL15.glBindBuffer(GL31.GL_TEXTURE_BUFFER, colorbuf);
	GL15.glBufferData(GL31.GL_TEXTURE_BUFFER, maxcubes*4, GL15.GL_DYNAMIC_DRAW);

	GL15.glBindBuffer(GL31.GL_TEXTURE_BUFFER, 0);
	
	//buffer texture setup
	GL11.glPushAttrib(GL11.GL_TEXTURE_BIT);

	postex= GL11.glGenTextures();
	GL11.glBindTexture(GL31.GL_TEXTURE_BUFFER, postex);
	GL31.glTexBuffer(GL31.GL_TEXTURE_BUFFER, GL30.GL_R32F, posbuf);
	
	colortex= GL11.glGenTextures();
	GL11.glBindTexture(GL31.GL_TEXTURE_BUFFER, colortex);
	GL31.glTexBuffer(GL31.GL_TEXTURE_BUFFER, GL11.GL_RGBA8, colorbuf);
	
	GL11.glBindTexture(GL31.GL_TEXTURE_BUFFER, 0);
	
	
	
	
	GL11.glPopAttrib();
}
 
开发者ID:Robowars,项目名称:RoboWarsInvasion,代码行数:37,代码来源:CubeRenderer.java

示例10: render

import org.lwjgl.opengl.GL31; //导入依赖的package包/类
public void render(float[] particles, byte[] colors){		
	if(particles.length/POS_SIZE>maxcubes){
		return;
	}

	GL11.glPushAttrib(GL11.GL_BLEND);
	GL11.glEnable(GL11.GL_BLEND);
	GL11.glPushAttrib(GL11.GL_ALPHA_TEST);
	GL11.glDisable(GL11.GL_ALPHA_TEST);
	GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

	GL20.glUseProgram(program);

	ShaderUtil.useLegacyMVP(ulocmvp);
	GL20.glUniform1f(ulocscale, scale/2);

	pushPositions(particles);
	if(colors!=null)
		pushColors(colors);

	GL11.glPushAttrib(GL11.GL_TEXTURE);
	GL13.glActiveTexture(GL13.GL_TEXTURE1);
	GL11.glBindTexture(GL31.GL_TEXTURE_BUFFER, colortex);
	GL13.glActiveTexture(GL13.GL_TEXTURE0);
	GL11.glBindTexture(GL31.GL_TEXTURE_BUFFER, postex);

	GL30.glBindVertexArray(VAO);
	GL31.glDrawElementsInstanced(GL11.GL_TRIANGLES, INDICIES.length, GL11.GL_UNSIGNED_BYTE, 0, particles.length/3);
	GL30.glBindVertexArray(0);

	GL20.glUseProgram(0);

	GL11.glPopAttrib();
	GL11.glPopAttrib();
	GL11.glPopAttrib();
}
 
开发者ID:Robowars,项目名称:RoboWarsInvasion,代码行数:37,代码来源:CubeRenderer.java

示例11: pushPositions

import org.lwjgl.opengl.GL31; //导入依赖的package包/类
public void pushPositions(float[] positions){
	buf.clear();
	FloatBuffer fbuf= buf.asFloatBuffer();
	fbuf.put(positions);
	fbuf.flip();
	GL15.glBindBuffer(GL31.GL_TEXTURE_BUFFER, posbuf);
	GL15.glBufferSubData(GL31.GL_TEXTURE_BUFFER, 0, fbuf);
}
 
开发者ID:Robowars,项目名称:RoboWarsInvasion,代码行数:9,代码来源:CubeRenderer.java

示例12: pushColors

import org.lwjgl.opengl.GL31; //导入依赖的package包/类
public void pushColors(byte[] colors){
	buf.clear();
	buf.put(colors);
	buf.flip();
	GL15.glBindBuffer(GL31.GL_TEXTURE_BUFFER, colorbuf);
	GL15.glBufferSubData(GL31.GL_TEXTURE_BUFFER, 0, buf);	
}
 
开发者ID:Robowars,项目名称:RoboWarsInvasion,代码行数:8,代码来源:CubeRenderer.java

示例13: glGetActiveUniformBlockName

import org.lwjgl.opengl.GL31; //导入依赖的package包/类
public static String glGetActiveUniformBlockName(int program, int uniformBlockIndex, int bufSize) throws GLException
{
	String ret = GL31.glGetActiveUniformBlockName(program, uniformBlockIndex, bufSize);
	
	RenderHelper.checkForGLError();
	
	return ret;
}
 
开发者ID:Elusivehawk,项目名称:JCaelum,代码行数:9,代码来源:GL3.java

示例14: glGetActiveUniformName

import org.lwjgl.opengl.GL31; //导入依赖的package包/类
public static String glGetActiveUniformName(int program, int uniformIndex, int bufSize) throws GLException
{
	String ret = GL31.glGetActiveUniformName(program, uniformIndex, bufSize);
	
	RenderHelper.checkForGLError();
	
	return ret;
}
 
开发者ID:Elusivehawk,项目名称:JCaelum,代码行数:9,代码来源:GL3.java

示例15: glGetActiveUniformsi

import org.lwjgl.opengl.GL31; //导入依赖的package包/类
public static int glGetActiveUniformsi(int program, int uniformIndex, int pname) throws GLException
{
	int ret = GL31.glGetActiveUniformsi(program, uniformIndex, pname);
	
	RenderHelper.checkForGLError();
	
	return ret;
}
 
开发者ID:Elusivehawk,项目名称:JCaelum,代码行数:9,代码来源:GL3.java


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