We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpOpenGL and 3D Libraries › loading textures from relative directory
Page Index Toggle Pages: 1
loading textures from relative directory? (Read 1334 times)
loading textures from relative directory?
Apr 21st, 2007, 9:37pm
 
So I'm using JOGL with Processing and right now the only way I can load textures is if I specify the entire directory path. Like:
/Users/name/Documents/Processing/MyOpenGLApp/data
in the code.

I would like to somehow make a relative reference to the /data directory, as when I compile everything into a .jar it can't load the textures because it doesn't look in the right place. If I tell my program to load textures from "/data/*" it doesn't work, nor does "data/*" nor does "../data/*" or "../../data/*"

So essentially, I have no idea as to how to reference textures that are bundled in the same JAR file. Any help would be appreciated.
Re: loading textures from relative directory?
Reply #1 - Apr 22nd, 2007, 1:35pm
 
try: passing dataPath("myile.jpg") to the load function.
dataPath automatically appends the location of the data directoryso it loads from the right place.
Page Index Toggle Pages: 1