1

I'm making a program for Android using opengl es and I'd like to organize my project by keeping my glsl shader code as separate source files along with the java source code.

I realized, however, that for Android I need to store these as string resources, which are usually stored and managed in the strings.xml resource file, but I would very much like to keep them separate.

Any pointers on how to do this without directly embedding various glsl shader codes into ...\main\res\values\strings.xml?

2 Answers 2

1

If you are working with Android Studio, there is even .glsl support for editing shaders. Just create a file and add .glsl as the extension, Android Studio will offer you to download a plugin for editing shaders. You can only place your shaders in your res/raw folder.

1
  • "You can only place your shaders in your res/raw folder." Perfect, thanks.
    – user27886
    Commented Jan 14, 2017 at 22:35
1

You can create a java constants file and put all strings in that but it is not recommended.

2
  • Do you mean something like a a StringConstants.java file with a bunch of? I could certainly do that, but then it gets back to the problem of not keeping the glsl shader codes separate.
    – user27886
    Commented Jan 14, 2017 at 13:26
  • there are only two ways of doing it. No other tech feasibility. Commented Jan 14, 2017 at 13:28

Not the answer you're looking for? Browse other questions tagged or ask your own question.