org.lwjgl.opengl.GL40 Java Examples

The following examples show how to use org.lwjgl.opengl.GL40. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CoreEngine.java    From Lwjgl3-Game-Engine-Programming-Series with MIT License 5 votes vote down vote up
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");		
}
 
Example #2
Source File: ShaderUniformCache.java    From CodeChickenLib with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void apply() {
    if (dirty) {
        switch (type.getCarrier()) {
            //@formatter:off
            case DOUBLE:
                switch (type.getSize()) {
                    case 1: GL40.glUniform1d(getLocation(), cache[0]); break;
                    case 2: GL40.glUniform2d(getLocation(), cache[0], cache[1]); break;
                    case 3: GL40.glUniform3d(getLocation(), cache[0], cache[1], cache[2]); break;
                    case 4: GL40.glUniform4d(getLocation(), cache[0], cache[1], cache[2], cache[3]); break;
                    default: throw new IllegalStateException("Invalid size for Double type." + type.getSize());
                }
                break;
            case MATRIX:
                switch (type) {
                    case D_MAT2:   GL40.glUniformMatrix2dv  (getLocation(), transpose, cache); break;
                    case D_MAT3:   GL40.glUniformMatrix3dv  (getLocation(), transpose, cache); break;
                    case D_MAT4:   GL40.glUniformMatrix4dv  (getLocation(), transpose, cache); break;
                    case D_MAT2x3: GL40.glUniformMatrix2x3dv(getLocation(), transpose, cache); break;
                    case D_MAT2x4: GL40.glUniformMatrix2x4dv(getLocation(), transpose, cache); break;
                    case D_MAT3x2: GL40.glUniformMatrix3x2dv(getLocation(), transpose, cache); break;
                    case D_MAT3x4: GL40.glUniformMatrix3x4dv(getLocation(), transpose, cache); break;
                    case D_MAT4x2: GL40.glUniformMatrix4x2dv(getLocation(), transpose, cache); break;
                    case D_MAT4x3: GL40.glUniformMatrix4x3dv(getLocation(), transpose, cache); break;
                    default: throw new IllegalStateException("Invalid Matrix type: " + type);
                }
                break;
            default: throw new IllegalStateException("Invalid type for DoubleUniformEntry: " + type.getCarrier());
            //@formatter:on
        }
        dirty = false;
    }
}
 
Example #3
Source File: Errors.java    From Visage with MIT License 5 votes vote down vote up
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;
}