Example usage for org.lwjgl.opengl GL20 GL_SHADING_LANGUAGE_VERSION

List of usage examples for org.lwjgl.opengl GL20 GL_SHADING_LANGUAGE_VERSION

Introduction

In this page you can find the example usage for org.lwjgl.opengl GL20 GL_SHADING_LANGUAGE_VERSION.

Prototype

int GL_SHADING_LANGUAGE_VERSION

To view the source code for org.lwjgl.opengl GL20 GL_SHADING_LANGUAGE_VERSION.

Click Source Link

Document

Accepted by the name parameter of GetString.

Usage

From source file:com.ardor3d.renderer.lwjgl.LwjglContextCapabilities.java

License:Open Source License

public LwjglContextCapabilities(final org.lwjgl.opengl.ContextCapabilities caps) {
    final IntBuffer buf = BufferUtils.createIntBuffer(16);

    _supportsVBO = caps.GL_ARB_vertex_buffer_object;
    _supportsGL1_2 = caps.OpenGL12;//from w  w  w  . ja v  a  2s  . c  o m
    _supportsMultisample = caps.GL_ARB_multisample;
    _supportsDoubleCoefficientsInClipPlaneEquation = true;

    _supportsConstantColor = _supportsEq = caps.GL_ARB_imaging;
    _supportsSeparateFunc = caps.GL_EXT_blend_func_separate;
    _supportsSeparateEq = caps.GL_EXT_blend_equation_separate;
    _supportsMinMax = caps.GL_EXT_blend_minmax;
    _supportsSubtract = caps.GL_EXT_blend_subtract;

    _supportsFogCoords = caps.GL_EXT_fog_coord;
    _supportsFragmentProgram = caps.GL_ARB_fragment_program;
    _supportsVertexProgram = caps.GL_ARB_vertex_program;

    _supportsPointSprites = caps.GL_ARB_point_sprite;
    _supportsPointParameters = caps.GL_ARB_point_parameters;

    _supportsTextureLodBias = caps.GL_EXT_texture_lod_bias;
    if (_supportsTextureLodBias) {
        GL11.glGetInteger(EXTTextureLODBias.GL_MAX_TEXTURE_LOD_BIAS_EXT, buf);
        _maxTextureLodBias = buf.get(0);
    } else {
        _maxTextureLodBias = 0f;
    }

    GL11.glGetInteger(GL11.GL_MAX_CLIP_PLANES, buf);
    _maxUserClipPlanes = buf.get(0);

    _glslSupported = caps.GL_ARB_shader_objects && caps.GL_ARB_fragment_shader && caps.GL_ARB_vertex_shader
            && caps.GL_ARB_shading_language_100;

    _geometryShader4Supported = caps.GL_ARB_geometry_shader4 && _glslSupported;

    _geometryInstancingSupported = caps.GL_EXT_draw_instanced || caps.OpenGL31;

    if (_glslSupported) {
        GL11.glGetInteger(ARBVertexShader.GL_MAX_VERTEX_ATTRIBS_ARB, buf);
        _maxGLSLVertexAttribs = buf.get(0);
    }

    // Pbuffer
    _pbufferSupported = caps.GL_ARB_pixel_buffer_object;

    // FBO
    _fboSupported = caps.GL_EXT_framebuffer_object;
    if (_fboSupported) {

        _supportsFBOMultisample = caps.GL_EXT_framebuffer_multisample;
        _supportsFBOBlit = caps.GL_EXT_framebuffer_blit;

        if (caps.GL_ARB_draw_buffers) {
            GL11.glGetInteger(EXTFramebufferObject.GL_MAX_COLOR_ATTACHMENTS_EXT, buf);
            _maxFBOColorAttachments = buf.get(0);
        } else {
            _maxFBOColorAttachments = 1;
        }

        // Max multisample samples.
        if (caps.GL_EXT_framebuffer_multisample && caps.GL_EXT_framebuffer_blit) {
            GL11.glGetInteger(EXTFramebufferMultisample.GL_MAX_SAMPLES_EXT, buf);
            _maxFBOSamples = buf.get(0);
        } else {
            _maxFBOSamples = 0;
        }
    } else {
        _maxFBOColorAttachments = 0;
    }

    _twoSidedStencilSupport = caps.GL_EXT_stencil_two_side;
    _stencilWrapSupport = caps.GL_EXT_stencil_wrap;

    // number of available auxiliary draw buffers
    GL11.glGetInteger(GL11.GL_AUX_BUFFERS, buf);
    _numAuxDrawBuffers = buf.get(0);

    // max texture size.
    GL11.glGetInteger(GL11.GL_MAX_TEXTURE_SIZE, buf);
    _maxTextureSize = buf.get(0);

    // Check for support of multitextures.
    _supportsMultiTexture = caps.GL_ARB_multitexture;

    // Support for texture formats
    _supportsFloatTextures = caps.GL_ARB_texture_float;
    _supportsIntegerTextures = caps.GL_EXT_texture_integer;
    _supportsOneTwoComponentTextures = caps.GL_ARB_texture_rg;

    // Check for support of fixed function dot3 environment settings
    _supportsEnvDot3 = caps.GL_ARB_texture_env_dot3;

    // Check for support of fixed function dot3 environment settings
    _supportsEnvCombine = caps.GL_ARB_texture_env_combine;

    // Check for support of automatic mipmap generation
    _automaticMipMaps = caps.GL_SGIS_generate_mipmap;

    _supportsDepthTexture = caps.GL_ARB_depth_texture;
    _supportsShadow = caps.GL_ARB_shadow;

    // If we do support multitexturing, find out how many textures we
    // can handle.
    if (_supportsMultiTexture) {
        GL11.glGetInteger(ARBMultitexture.GL_MAX_TEXTURE_UNITS_ARB, buf);
        _numFixedTexUnits = buf.get(0);
    } else {
        _numFixedTexUnits = 1;
    }

    // Go on to check number of texture units supported for vertex and
    // fragment shaders
    if (caps.GL_ARB_shader_objects && caps.GL_ARB_vertex_shader && caps.GL_ARB_fragment_shader) {
        GL11.glGetInteger(ARBVertexShader.GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB, buf);
        _numVertexTexUnits = buf.get(0);
        GL11.glGetInteger(ARBFragmentShader.GL_MAX_TEXTURE_IMAGE_UNITS_ARB, buf);
        _numFragmentTexUnits = buf.get(0);
        GL11.glGetInteger(ARBFragmentShader.GL_MAX_TEXTURE_COORDS_ARB, buf);
        _numFragmentTexCoordUnits = buf.get(0);
    } else {
        // based on nvidia dev doc:
        // http://developer.nvidia.com/object/General_FAQ.html#t6
        // "For GPUs that do not support GL_ARB_fragment_program and
        // GL_NV_fragment_program, those two limits are set equal to
        // GL_MAX_TEXTURE_UNITS."
        _numFragmentTexCoordUnits = _numFixedTexUnits;
        _numFragmentTexUnits = _numFixedTexUnits;

        // We'll set this to 0 for now since we do not know:
        _numVertexTexUnits = 0;
    }
    // ARBShaderObjects.GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB
    // caps.GL_EXT_bindable_uniform
    // EXTBindableUniform.GL_MAX_BINDABLE_UNIFORM_SIZE_EXT;

    // Now determine the maximum number of supported texture units
    _numTotalTexUnits = Math.max(_numFragmentTexCoordUnits,
            Math.max(_numFixedTexUnits, Math.max(_numFragmentTexUnits, _numVertexTexUnits)));

    // Check for S3 texture compression capability.
    _supportsS3TCCompression = caps.GL_EXT_texture_compression_s3tc;

    // Check for LA texture compression capability.
    _supportsLATCCompression = caps.GL_EXT_texture_compression_latc;

    // Check for generic texture compression capability.
    _supportsGenericCompression = caps.GL_ARB_texture_compression;

    // Check for 3D texture capability.
    _supportsTexture3D = caps.OpenGL12;

    // Check for cubemap capability.
    _supportsTextureCubeMap = caps.GL_ARB_texture_cube_map;

    // See if we support anisotropic filtering
    _supportsAniso = caps.GL_EXT_texture_filter_anisotropic;

    if (_supportsAniso) {
        // Due to LWJGL buffer check, you can't use smaller sized
        // buffers (min_size = 16 for glGetFloat()).
        final FloatBuffer max_a = BufferUtils.createFloatBuffer(16);
        max_a.rewind();

        // Grab the maximum anisotropic filter.
        GL11.glGetFloat(EXTTextureFilterAnisotropic.GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, max_a);

        // set max.
        _maxAnisotropic = max_a.get(0);
    }

    // See if we support textures that are not power of 2 in size.
    _supportsNonPowerTwo = caps.GL_ARB_texture_non_power_of_two;

    // See if we support textures that do not have width == height.
    _supportsRectangular = caps.GL_ARB_texture_rectangle;

    _supportsMirroredRepeat = caps.GL_ARB_texture_mirrored_repeat;
    _supportsMirrorClamp = _supportsMirrorEdgeClamp = _supportsMirrorBorderClamp = caps.GL_EXT_texture_mirror_clamp;
    _supportsBorderClamp = caps.GL_ARB_texture_border_clamp;
    _supportsEdgeClamp = _supportsGL1_2;

    try {
        _displayVendor = GL11.glGetString(GL11.GL_VENDOR);
    } catch (final Exception e) {
        _displayVendor = "Unable to retrieve vendor.";
    }

    try {
        _displayRenderer = GL11.glGetString(GL11.GL_RENDERER);
    } catch (final Exception e) {
        _displayRenderer = "Unable to retrieve adapter details.";
    }

    try {
        _displayVersion = GL11.glGetString(GL11.GL_VERSION);
    } catch (final Exception e) {
        _displayVersion = "Unable to retrieve API version.";
    }

    try {
        _shadingLanguageVersion = GL11.glGetString(GL20.GL_SHADING_LANGUAGE_VERSION);
    } catch (final Exception e) {
        _shadingLanguageVersion = "Unable to retrieve shading language version.";
    }
}

From source file:com.github.begla.blockmania.rendering.manager.ShaderManager.java

License:Apache License

private ShaderManager() {
    Blockmania.getInstance().getLogger().log(Level.INFO, "Loading Blockmania shader manager...");
    Blockmania.getInstance().getLogger().log(Level.INFO, "GL_VERSION: {0}", GL11.glGetString(GL11.GL_VERSION));
    Blockmania.getInstance().getLogger().log(Level.INFO, "SHADING_LANGUAGE VERSION: {0}",
            GL11.glGetString(GL20.GL_SHADING_LANGUAGE_VERSION));
    Blockmania.getInstance().getLogger().log(Level.INFO, "EXTENSIONS: {0}",
            GL11.glGetString(GL11.GL_EXTENSIONS));

    initShaders();/*from  ww  w . j  a v  a  2 s.  co m*/
}

From source file:com.github.begla.blockmania.rendering.ShaderManager.java

License:Apache License

private ShaderManager() {
    initShaders();/*from  w w w.j a v a2  s. co m*/

    Blockmania.getInstance().getLogger().log(Level.INFO, "Loading Blockmania shader manager...");
    Blockmania.getInstance().getLogger().log(Level.INFO, "GL_VERSION: {0}", GL11.glGetString(GL11.GL_VERSION));
    Blockmania.getInstance().getLogger().log(Level.INFO, "SHADING_LANGUAGE VERSION: {0}",
            GL11.glGetString(GL20.GL_SHADING_LANGUAGE_VERSION));
    Blockmania.getInstance().getLogger().log(Level.INFO, "EXTENSIONS: {0}",
            GL11.glGetString(GL11.GL_EXTENSIONS));
}

From source file:com.google.gapid.glviewer.GeometryScene.java

License:Apache License

@Override
public void init(Renderer renderer) {
    float[] background = new float[] { .2f, .2f, .2f, 1f };

    LOG.log(FINE, "GL Version:   " + GL11.glGetString(GL11.GL_VERSION));
    LOG.log(FINE, "GLSL Version: " + GL11.glGetString(GL20.GL_SHADING_LANGUAGE_VERSION));

    shaders = Shaders.init(renderer);// ww w  .j  av  a  2 s  .  c o  m
    if (renderable != null) {
        renderable.init(renderer);
    }

    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glClearColor(background[0], background[1], background[2], background[3]);
    GL11.glPointSize(4);
    GL30.glBindVertexArray(GL30.glGenVertexArrays());
}

From source file:com.google.gapid.glviewer.Viewer.java

License:Apache License

@Override
public void init() {
    float[] background = new float[] { .2f, .2f, .2f, 1f };

    LOG.log(FINE, "GL Version:   " + GL11.glGetString(GL11.GL_VERSION));
    LOG.log(FINE, "GLSL Version: " + GL11.glGetString(GL20.GL_SHADING_LANGUAGE_VERSION));

    shaders = Shaders.init();//from  w w w  . j a  va2  s .c o m
    if (renderable != null) {
        renderable.init();
    }

    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glClearColor(background[0], background[1], background[2], background[3]);
    GL11.glPointSize(4);
    GL30.glBindVertexArray(GL30.glGenVertexArrays());
}

From source file:com.opengrave.og.MainThread.java

License:Open Source License

public void createConfig() {
    boolean isSet = config.getBoolean("set", false);
    System.out.println("Running OpenGL : " + GL11.glGetString(GL11.GL_VERSION));

    String glsl = GL11.glGetString(GL20.GL_SHADING_LANGUAGE_VERSION).split(" ")[0];
    System.out.println(glsl + " " + Float.parseFloat(glsl));
    if (Float.parseFloat(glsl) < 1.299f) { // Stupid float accuracy. < 1.30
        System.out.println("This program requires GLSL 1.30 as an absolute minimum");
        System.exit(130);//from   w  w  w .  j a  v a  2  s.  c  om
    }
    if (!isSet) {
        int textures = GL11.glGetInteger(GL20.GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS) - 3;
        System.out.println("Maximum spare textures (minus reserved) : " + textures);
        config.setBoolean("shadows", true);
        if (textures < 4) {
            System.out.println("Setting no point-light shadows");
            config.setInteger("lightCount", 0);
        } else if (textures < 8) {
            System.out.println("Setting 4 point-lights with shadows");
            config.setInteger("lightCount", 4);
        } else if (textures < 16) {
            System.out.println("Setting 8 point-lights with shadows");
            config.setInteger("lightCount", 8);
        } else {
            System.out.println("Setting 16 point-lights with shadows");
            // config.setInteger("lightCount", 16);
            // TODO Create lighting-more
            config.setInteger("lightCount", 8);
        }

        // TODO Check for GL 3.0 and turn off shadows/lightCount if below
        // if (!GLContext.getCapabilities().OpenGL30) {
        // System.out.println("This program does not support OpenGL versions before 3.0. Setting absolute minimum detail");
        // if (!isSet) {
        // // We'll assume the worst.
        // config.setInteger("lightCount", 0);
        // config.setBoolean("shadows", false);
        // }
        // }
        Resources.removeShadersWithLighting();
        config.setBoolean("set", true);
    }
}

From source file:com.pesegato.mermaid.MermaidAppState.java

@Override
protected void initialize(Application app) {
    GuiGlobals.initialize(app);/*from ww  w. j a  v a  2s  .c  o m*/
    Styles styles = GuiGlobals.getInstance().getStyles();
    Attributes attrs = styles.getSelector(Label.ELEMENT_ID, "prism");
    font1 = app.getAssetManager().loadFont("Interface/Fonts/" + GM.getString("FontA"));
    font1.getPage(0).setFloat("AlphaDiscardThreshold", 0.1f);
    attrs.set("font", font1);
    attrs.set("fontSize", GM.getIntXML("FontA"));

    a = GM.getColorRGBA("ColorA");
    b = GM.getColorRGBA("ColorB");
    c = GM.getColorRGBA("ColorC");

    ((SimpleApplication) app).getRootNode().attachChild(properties);

    matMermaid = new Material(app.getAssetManager(), "Common/MatDefs/Light/Lighting.j3md");
    matMermaid.setBoolean("UseMaterialColors", true);
    matMermaid.setColor("Diffuse", ColorRGBA.White.clone());
    matMermaid.setColor("Ambient", ColorRGBA.White.clone());
    matDebug = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
    matDebug.setColor("Color", new ColorRGBA(1, 0, 0, 0.17f));
    matDebug.getAdditionalRenderState().setBlendMode(RenderState.BlendMode.Alpha);

    String oglVersion = GL11.glGetString(GL11.GL_VERSION);

    int split = oglVersion.indexOf(' ');
    if (split >= 0) {
        oglVersion = oglVersion.substring(0, split);
    }
    String glslVersion = GL11.glGetString(GL20.GL_SHADING_LANGUAGE_VERSION);

    split = glslVersion.indexOf(' ');
    if (split >= 0) {
        glslVersion = glslVersion.substring(0, split);
    }
    miscSettings = new PPropertyPanel(LEMURSTYLE);
    miscSettings.attachChild(new PLabel(GL11.glGetString(GL11.GL_RENDERER), 0, -.5f));
    miscSettings.attachChild(new PLabel("Ver. " + Display.getVersion(), 0, -1));
    miscSettings.attachChild(new PLabel("OpenGL " + oglVersion + " GLSL " + glslVersion, 0, -1.5f));
    miscSettings.attachChild(
            new PLabel(System.getProperty("os.name") + " ver." + System.getProperty("os.version"), 0, -2));
    miscSettings.attachChild(new PLabel(
            "Java " + System.getProperty("java.version") + " " + System.getProperty("os.arch"), 0, -2.5f));
    miscSettings.attachChild(new PLabel("Jme " + JmeVersion.FULL_NAME.substring(14), 0, -3));
    miscSettings.attachChild(
            new PLabel("hash " + JmeVersion.GIT_SHORT_HASH + " " + JmeVersion.BUILD_DATE, 0, -3.5f));

}

From source file:edu.pitt.atl23.LWJGLWindow.java

private void printInfo() {
    System.out.println();/*  w w w  .j a  va  2s .c  o  m*/
    System.out.println("-----------------------------------------------------------");

    System.out.format("%-18s%s\n", "Running:", getClass().getName());
    System.out.println("GL_VENDOR: " + glGetString(GL11.GL_VENDOR));
    System.out.println("GL_RENDERER: " + glGetString(GL11.GL_RENDERER));
    System.out.println("GL_VERSION: " + glGetString(GL11.GL_VERSION));
    System.out.println("GL_SHADING_LANGUAGE: " + GL11.glGetString(GL20.GL_SHADING_LANGUAGE_VERSION));
}

From source file:ivorius.ivtoolkit.rendering.IvShaderInstance.java

License:Apache License

public static void outputShaderInfo(Logger logger) {
    String renderer = GL11.glGetString(GL11.GL_RENDERER);
    String vendor = GL11.glGetString(GL11.GL_VENDOR);
    String version = GL11.glGetString(GL11.GL_VERSION);
    boolean fboSupported = OpenGlHelper.framebufferSupported;

    String majorVersion;/* w w w.  jav a  2 s. c o m*/
    String minorVersion;

    String glslVersion;

    try {
        glslVersion = GL11.glGetString(GL20.GL_SHADING_LANGUAGE_VERSION);
    } catch (Exception ex) {
        glslVersion = "? (No GL20)";
    }

    try {
        minorVersion = "" + GL11.glGetInteger(GL30.GL_MINOR_VERSION);
        majorVersion = "" + GL11.glGetInteger(GL30.GL_MAJOR_VERSION);
    } catch (Exception ex) {
        minorVersion = "?";
        majorVersion = "? (No GL 30)";
    }

    printAlignedInfo("Vendor", vendor, logger);
    printAlignedInfo("Renderer", renderer, logger);
    printAlignedInfo("Version", version, logger);
    printAlignedInfo("Versions", getGLVersions(GLContext.getCapabilities()), logger);
    printAlignedInfo("Version Range", String.format("%s - %s", minorVersion, majorVersion), logger);
    printAlignedInfo("GLSL Version", glslVersion, logger);
    printAlignedInfo("Frame buffer object", fboSupported ? "Supported" : "Unsupported", logger);
}

From source file:jpcsp.graphics.RE.RenderingEngineLwjgl.java

License:Open Source License

protected void init() {
    String openGLVersion = GL11.glGetString(GL11.GL_VERSION);
    String openGLVendor = GL11.glGetString(GL11.GL_VENDOR);
    String openGLRenderer = GL11.glGetString(GL11.GL_RENDERER);
    log.info(String.format("OpenGL version: %s, vender: %s, renderer: %s", openGLVersion, openGLVendor,
            openGLRenderer));//w  ww . jav  a2s  . c  om

    vendorIntel = "Intel".equalsIgnoreCase(openGLVendor);
    hasOpenGL30 = GLContext.getCapabilities().OpenGL30;

    if (GLContext.getCapabilities().OpenGL20) {
        String shadingLanguageVersion = GL11.glGetString(GL20.GL_SHADING_LANGUAGE_VERSION);
        log.info("Shading Language version: " + shadingLanguageVersion);
    }

    if (GLContext.getCapabilities().OpenGL30) {
        int contextFlags = GL11.glGetInteger(GL30.GL_CONTEXT_FLAGS);
        String s = String.format("GL_CONTEXT_FLAGS: 0x%X", contextFlags);
        if ((contextFlags & GL30.GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT) != 0) {
            s += " (GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT)";
        }
        log.info(s);
    }

    if (GLContext.getCapabilities().OpenGL32) {
        int contextProfileMask = GL11.glGetInteger(GL32.GL_CONTEXT_PROFILE_MASK);
        String s = String.format("GL_CONTEXT_PROFILE_MASK: 0x%X", contextProfileMask);
        if ((contextProfileMask & GL32.GL_CONTEXT_CORE_PROFILE_BIT) != 0) {
            s += " (GL_CONTEXT_CORE_PROFILE_BIT)";
        }
        if ((contextProfileMask & GL32.GL_CONTEXT_COMPATIBILITY_PROFILE_BIT) != 0) {
            s += " (GL_CONTEXT_COMPATIBILITY_PROFILE_BIT)";
        }
        log.info(s);
    }
}