GLSL Shader Loader

Hi

I don’t know how helpful this code is to other users, but here is a small utility class that helps in loading and running shader programs. I don’t do much with shaders, so its largely untested, but as the code is mostly pinched from reliable sources, here :slight_smile:

Github: https://github.com/CopyableCougar4/GLSL-Loader/blob/master/src/me/CopyableCougar4/shaders/GLSL.java

CopyableCougar4

Why do you use the ARB extension when you are having it since 2.x version of OpenGL itself? Does it offer any advantages than the integrated ones?

SHC is right, you should be using OpenGL 2.0 instead of the ARB extension.
Also, it is highly recommended to delete your shaders after you linked your shaderprogram. :slight_smile:

Hi

I took PandaMoniumHUN and SHC’s advice, and I updated the github file :slight_smile:

CopyableCougar4

Thanks for sharing this with us.

However, am I missing something or won’t sending anything but four floats to the “sendFloats” function cause an ArrayIndexOutOfBoundsException?

Hi

I added a few [icode]break;[/icode] statements to the switch statements so that the ArrayIndexOutOfBoundsException isn’t thrown.

CopyableCougar4