• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java GL43类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: initializeWorld

import org.lwjgl.opengl.GL43; //导入依赖的package包/类
private void initializeWorld(int renderDistance, int centerX, int centerY, int centerZ, Shader shader) {
	
	playerChunkX = centerX;
	playerChunkZ = centerZ;
	
	//initialize the world
	worldChunks = new int[(renderDistance*2-1)*16*(renderDistance*2-1)];
	worldMetadata = new int[(renderDistance*2-1)*16*(renderDistance*2-1)];
	chunkIdList = new ArrayDeque<Integer>();
	metadataIdList = new ArrayDeque<Integer>();
	for (int i = worldChunks.length; i > 0; i--) {
		chunkIdList.push(i);
	}
	for (int i = worldMetadata.length; i > 0; i--) {
		metadataIdList.push(i);
	}
	
	//update the buffer size
	GL15.glBindBuffer(GL43.GL_SHADER_STORAGE_BUFFER, shader.getChunkSsbo());
	GL15.glBufferData(GL43.GL_SHADER_STORAGE_BUFFER, chunkSize*worldChunks.length*2*4, GL15.GL_DYNAMIC_DRAW);
	
	GL15.glBindBuffer(GL43.GL_SHADER_STORAGE_BUFFER, shader.getMetadataSsbo());
	GL15.glBufferData(GL43.GL_SHADER_STORAGE_BUFFER, chunkSize*worldMetadata.length*4, GL15.GL_DYNAMIC_DRAW);
	GL15.glBindBuffer(GL43.GL_SHADER_STORAGE_BUFFER, 0);
	
	//inform the shader of the new render distance
	int renderDistanceUniform = GL20.glGetUniformLocation(shader.getShaderProgram(), "renderDistance");
	GL20.glUniform1i(renderDistanceUniform, renderDistance-1);
}
 
开发者ID:18107,项目名称:MC-Ray-Tracer,代码行数:30,代码来源:WorldLoader.java


示例2: loadChunk

import org.lwjgl.opengl.GL43; //导入依赖的package包/类
private void loadChunk(int id, Shader shader, ExtendedBlockStorage storage) {
	ObjectIntIdentityMap<IBlockState> map = GameData.getBlockStateIDMap();
	int[] data = new int[chunkSize*2];
	for (int y = 0; y < 16; y++) {
		for (int z = 0; z < 16; z++) {
			for (int x = 0; x < 16; x++) {
				IBlockState state = storage.get(x, y, z);
				boolean fullBlock = state.isFullBlock();
				boolean cube = state.isFullCube();
				if (fullBlock != cube) {
					Log.info(state.getBlock().getUnlocalizedName() + ": " + fullBlock);
				}
				if (fullBlock) {
					stateSet.add(state);
				}
				int stateId = map.get(state); //TODO
				data[(y<<9) + (z<<5) + (x<<1)] = Block.getIdFromBlock(storage.get(x, y, z).getBlock());
			}
		}
	}
	
	for (int y = 0; y < 16; y++) {
		for (int z = 0; z < 16; z++) {
			for (int x = 0; x < 16; x++) {
				data[(y<<9) + (z<<5) + (x<<1) + 1] = storage.getBlocklightArray().get(x, y, z);
			}
		}
	}
	
	IntBuffer buffer = BufferUtils.createIntBuffer(chunkSize*2);
	buffer.put(data);
	buffer.flip();
	GL15.glBindBuffer(GL43.GL_SHADER_STORAGE_BUFFER, shader.getChunkSsbo());
	GL15.glBufferSubData(GL43.GL_SHADER_STORAGE_BUFFER, (id-1)*chunkSize*2*4, buffer);
	GL15.glBindBuffer(GL43.GL_SHADER_STORAGE_BUFFER, 0);
}
 
开发者ID:18107,项目名称:MC-Ray-Tracer,代码行数:37,代码来源:WorldLoader.java


示例3: loadMetadata

import org.lwjgl.opengl.GL43; //导入依赖的package包/类
/**
 * 
 * @param id
 * @param shader
 * @param storage
 * @return true if the id was used, false if there was nothing to upload
 */
private boolean loadMetadata(int id, Shader shader, ExtendedBlockStorage storage) {
	int[] data = new int[chunkSize];
	boolean containsValues = false;
	for (int y = 0; y < 16; y++) {
		for (int z = 0; z < 16; z++) {
			for (int x = 0; x < 16; x++) {
				int metadata = storage.get(x, y, z).getBlock().getMetaFromState(storage.get(x, y, z));
				data[(y<<8) + (z<<4) + x] = metadata;
				if (metadata != 0) {
					containsValues = true;
				}
			}
		}
	}
	
	if (containsValues) {
		IntBuffer buffer = BufferUtils.createIntBuffer(chunkSize);
		buffer.put(data);
		buffer.flip();
		GL15.glBindBuffer(GL43.GL_SHADER_STORAGE_BUFFER, shader.getMetadataSsbo());
		GL15.glBufferSubData(GL43.GL_SHADER_STORAGE_BUFFER, (id-1)*chunkSize*4, buffer);
		GL15.glBindBuffer(GL43.GL_SHADER_STORAGE_BUFFER, 0);
	}
	
	return containsValues;
}
 
开发者ID:18107,项目名称:MC-Ray-Tracer,代码行数:34,代码来源:WorldLoader.java


示例4: getDeviceProperties

import org.lwjgl.opengl.GL43; //导入依赖的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: copy

import org.lwjgl.opengl.GL43; //导入依赖的package包/类
public void copy(Texture2D src) {
    this.type = src.type;
    this.format = src.format;
    this.internalformat = src.internalformat;
    this.height = src.height;
    this.width = src.width;
    this.mipmap = src.mipmap;
    bind();
    glTexImage2D(this.type, 0, this.getInternalformat(), this.getWidth(), this.getHeight(), 0, this.getFormat(), GL11.GL_UNSIGNED_BYTE, (ByteBuffer) null);
    GL43.glCopyImageSubData(src.getTexture(), src.getType(), 0, 0, 0, 0, this.texture, this.type, 0, 0, 0, 0, src.getWidth(), src.getHeight(), 1);
    if (mipmap) genMipmap();
}
 
开发者ID:WarpOrganization,项目名称:warp,代码行数:13,代码来源:Texture2D.java


示例6: buildMapping

import org.lwjgl.opengl.GL43; //导入依赖的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


示例7: getDeviceProperties

import org.lwjgl.opengl.GL43; //导入依赖的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


示例8: createShaderProgram

import org.lwjgl.opengl.GL43; //导入依赖的package包/类
public void createShaderProgram() {
	shaderProgram = GL20.glCreateProgram();
	vShader = createShader(vertexShader, GL20.GL_VERTEX_SHADER);
	fShader = createShader(fragmentShader, GL20.GL_FRAGMENT_SHADER);
	
	GL20.glAttachShader(shaderProgram, vShader);
	GL20.glAttachShader(shaderProgram, fShader);
	GL20.glBindAttribLocation(shaderProgram, 0, "vertex");
	GL30.glBindFragDataLocation(shaderProgram, 0, "color");
	GL20.glLinkProgram(shaderProgram);
	
	GL20.glDetachShader(shaderProgram, vShader);
	GL20.glDetachShader(shaderProgram, fShader);
	GL20.glDeleteShader(vShader);
	vShader = 0;
	GL20.glDeleteShader(fShader);
	fShader = 0;
	
	int linked = GL20.glGetProgrami(shaderProgram, GL20.GL_LINK_STATUS);
	String programLog = GL20.glGetProgramInfoLog(shaderProgram, GL20.glGetProgrami(shaderProgram, GL20.GL_INFO_LOG_LENGTH));
	if (programLog.trim().length() > 0) {
		System.err.println(programLog);
	}
	if (linked == 0) {
		throw new AssertionError("Could not link program");
	}
	
	//init vbo
	vbo = GL15.glGenBuffers();
	GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, vbo);
	ByteBuffer bb = BufferUtils.createByteBuffer(2 * 6);
	bb.put((byte) -1).put((byte) -1);
	bb.put((byte) 1).put((byte) -1);
	bb.put((byte) 1).put((byte) 1);
	bb.put((byte) 1).put((byte) 1);
	bb.put((byte) -1).put((byte) 1);
	bb.put((byte) -1).put((byte) -1);
	bb.flip();
	GL15.glBufferData(GL15.GL_ARRAY_BUFFER, bb, GL15.GL_STATIC_DRAW);
	GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);
	
	worldChunkSsbo = GL15.glGenBuffers();
	chunkSsbo = GL15.glGenBuffers();
	worldMetadataSsbo = GL15.glGenBuffers();
	metadataSsbo = GL15.glGenBuffers();
	
	GL15.glBindBuffer(GL43.GL_SHADER_STORAGE_BUFFER, worldChunkSsbo);
	GL15.glBufferData(GL43.GL_SHADER_STORAGE_BUFFER, 0, GL15.GL_DYNAMIC_DRAW);
	GL30.glBindBufferBase(GL43.GL_SHADER_STORAGE_BUFFER, 2, worldChunkSsbo);
	
	GL15.glBindBuffer(GL43.GL_SHADER_STORAGE_BUFFER, chunkSsbo);
	GL15.glBufferData(GL43.GL_SHADER_STORAGE_BUFFER, 0, GL15.GL_DYNAMIC_DRAW);
	GL30.glBindBufferBase(GL43.GL_SHADER_STORAGE_BUFFER, 3, chunkSsbo);
	
	GL15.glBindBuffer(GL43.GL_SHADER_STORAGE_BUFFER, worldMetadataSsbo);
	GL15.glBufferData(GL43.GL_SHADER_STORAGE_BUFFER, 0, GL15.GL_DYNAMIC_DRAW);
	GL30.glBindBufferBase(GL43.GL_SHADER_STORAGE_BUFFER, 4, worldMetadataSsbo);
	
	GL15.glBindBuffer(GL43.GL_SHADER_STORAGE_BUFFER, metadataSsbo);
	GL15.glBufferData(GL43.GL_SHADER_STORAGE_BUFFER, 0, GL15.GL_DYNAMIC_DRAW);
	GL30.glBindBufferBase(GL43.GL_SHADER_STORAGE_BUFFER, 5, metadataSsbo);
	GL15.glBindBuffer(GL43.GL_SHADER_STORAGE_BUFFER, 0);
}
 
开发者ID:18107,项目名称:MC-Ray-Tracer,代码行数:64,代码来源:Shader.java


示例9: glInvalidateFramebuffer

import org.lwjgl.opengl.GL43; //导入依赖的package包/类
@Override
public void glInvalidateFramebuffer (int target, int numAttachments, IntBuffer attachments) {
	GL43.glInvalidateFramebuffer(target, attachments);
}
 
开发者ID:Arcnor,项目名称:gdx-backend-jglfw,代码行数:5,代码来源:JglfwGL30.java


示例10: glInvalidateSubFramebuffer

import org.lwjgl.opengl.GL43; //导入依赖的package包/类
@Override
public void glInvalidateSubFramebuffer (int target, int numAttachments, IntBuffer attachments, int x, int y, int width,
                                        int height) {
	GL43.glInvalidateSubFramebuffer(target, attachments, x, y, width, height);
}
 
开发者ID:Arcnor,项目名称:gdx-backend-jglfw,代码行数:6,代码来源:JglfwGL30.java


示例11: glInvalidateSubFramebuffer

import org.lwjgl.opengl.GL43; //导入依赖的package包/类
@Override
public void glInvalidateSubFramebuffer (int target, int numAttachments, IntBuffer attachments, int x, int y, int width,
	int height) {
	GL43.glInvalidateSubFramebuffer(target, attachments, x, y, width, height);
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:6,代码来源:LwjglGL30.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Pointer类代码示例发布时间:2022-05-22
下一篇:
Java ServiceInstanceExistsException类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap