Results 1 to 9 of 9
- 07-24-2010, 05:43 AM #1
Giving a text file containing GLSL to client
I'm working with an Applet which is in the making of becoming a 3D game. Basically what I'm doing is writing in OpenGL SL (Open Graphics Library Shader Language) which is contained in a text file then read by Java as a ByteBuffer.
Basically here's my questions:
How can I download the text file to the client?
What path would the filename be? (i.e., when calling GLShaders.class.getClassLoader().getResourceAsStre am(...), what would the ... be?)
Thank you in advance!
PS: I don't know why it put a space in "getResourceAsStream".
- 07-24-2010, 12:55 PM #2How can I download the text file to the client?
or write the file to the client's local drive?
Applets require permission to write to a client's disk.
What path would the filename be?
- 07-24-2010, 07:15 PM #3
The Applet just needs to read the file; I assumed it would be downloaded to the client's harddrive from a signed applet. It could perhaps be read from a server though--however, if there's a lot of shaders written in GLSL then this could increase bandwidth significantly.
Well, I could have it in another *.jar file... this could be beneficial if I wanted to download shaders to the client separately from textures and models. Honestly I think that would be better; I assume that jar file would go in the same folder as the applet jar file.
- 07-24-2010, 07:56 PM #4
If your files are in a jar file, would the browser's JVM get them via the applet's use of the getResource() method? The jar file would be listed in the <APPLET's archive= attribute
- 07-24-2010, 10:10 PM #5
Except that you can only specify one *.jar file using the archive attribute. If there are potentially several *.jar files, then a problem arises.
- 07-24-2010, 10:24 PM #6
I think you can have more than one jar file in the archive= attribute.
- 07-24-2010, 10:31 PM #7
- 07-24-2010, 10:34 PM #8
The jar files don't do the referencing. The classes in the jar files request resources from the ClassLoader which looks on the classpath to find them. See Post#4
The classes don't know where the resources are located. The JVM finds them.
- 07-24-2010, 10:36 PM #9
Ahhhhhh. I think that little bit of info will get this all working together then. Thanks Norm!
- By nigamsir in forum NetworkingReplies: 1Last Post: 03-08-2010, 04:45 PM
- By al_Marshy_1981 in forum NetworkingReplies: 8Last Post: 02-18-2010, 01:54 PM
- By nicedad in forum JDBCReplies: 8Last Post: 11-06-2009, 07:52 AM
- By KoolCancer in forum New To JavaReplies: 3Last Post: 07-29-2009, 05:52 AM
- By Singing Boyo in forum New To JavaReplies: 5Last Post: 06-02-2009, 11:33 AM