Reading a texture from a plugin

This topic has been viewed 5862 times and has 0 replies
Thread status: Active
Questions about extending features and developing plug-ins [img]http://www.sweethome3d.com/images/flags/en_small.gif[/img]
Post Reply New Topic
db4tech
Posts: 223
Joined: Mon May 03, 2010 5:10 pm
Country: UK

Reading a texture from a plugin

Post by db4tech »

Hi,

Been trying an idea, for something I want to implement, and it works well, it requires loading an image to be used as a texture.

This is where I run in to the problem.

Can read the texture without problems from my desktop, which is okay for me.
The trouble I'm having is, reading the texture from a "resources" folder located with the class files in the plugin.

Tried looking through many the Sweet Home scr files, where images are loaded for texture and icons, to try and learn how to do this, also read many articles on the the Internet. Still failing to read the texture from within the plugin though! [:(]


At first I was trying:

this.sunflow.parameter("texture", "/resources/my_texture.png");

Plus

this.sunflow.parameter("texture", "/com/eteks/sweethome3d/plugin/advancedrendering/resources/my_texture.png");

Am I on the right lines with?

java.net.URL imageURL = AdvancedPhotoRenderer.class.getResource("resources/my_texture.png");


Thought it might help explaining what I've tried. Used the second method (replaced with the path to my desktop) to successfully read the texture.

Thank you in advance for any help offered!
It's really frustrating having lots of ideas, getting stuck and feeling bad asking for help, when should be able to work it out. [:(]


db4tech
Post Reply New Topic

Who is online

Users browsing this forum: No registered users and 1 guest