Tutorial 4 problems :(

Hey guys,



Just got myself a Bsc in computer science and did java at uni and is fantastic doing 3D stuff now  :smiley:

I better say im new to 3D programming so am not familliar with some of the concepts.



Im having problems with "Starter Tutorial 4 - Hello States"

specifically this doesnt seem to be working for me:



monkeyLoc = HelloStates.class.getClassLoader().getResource(

                                          "jmetest/data/images/Monkey.jpg");



I tried this but still no joy:



monkeyLoc = HelloStates.class.getClassLoader().getResource(

                                "d:/pics/index.jpg");

                       

                       

and i get the text "Missing texture" instead of a picture on the cube.



Please help , what am i doing wrong ?

for the second attempt try using;



File myFile = new File("d:/pics/index.jpg");
modelLoc = myFile.toURI().toURL();  // this needs to be wrapped in a try catch block



for the first attempt the problem could be that jmetest is not in your classpath...
what IDE are you using...
it could also be that instead of using HelloStates.class.getClassLoader() you may need to use Thread.currentThread().getContextClassLoader()

Cheers for the help mate,



Im using NetBeans as my IDE, I tried both sugestions but unfornatly its still not working,



Im surprised the:



URL monkeyLoc = null;

File myFile = new File("d:/pics/index.jpg");



                try

                {

                      monkeyLoc = myFile.toURI().toURL();  // this needs to be wrapped in a try catch block

                }

                catch(MalformedURLException a)

                {

                 

                }



doesnt work though as it doesnt use the classPath.



Ive just started doing java again after not doing any for about 8 months so please feel free to correct me if im talking rubish lol  :smiley:

Hey, I'm new too and going through the tutorials so I thought I'd throw in a possibility.

Since you didn't post any code involving you actually:

making the TextureState

or assigning a texture to it

or applying the RenderState to the cube node



-might I suggest your problem might be in one of those lines?

as HeroHero said please post some code…

it might be another issue entirely…

I was looking at the documentation for the getResource method and didnt really understand where it was looking for the pic at first. Basically the pic was never there and the method below wasnt looking in the right place eighther.



I moved the pic and changed the code and yay a smiling monkey on the cube.



monkeyLoc = HelloStates.class.getClassLoader().getResource(

                        "Monkey.jpg");



Ty very much for all your help guys, am v impressed by people's willingness to help newbies cheers  :smiley: