In fact, I don’t think it finds the texture concrete.jpg on line 91. It just 
doesn’t crash because of it.

To access vehicle data as it’s done in this demo, you should also make a call 
like:
vehicle::SetDataPath(CHRONO_DATA_PATH + “/vehicle”);

Alternatively, you can access vehicle-related files like this:
patch2->SetTexture(GetChronoDataFile("vehicle/terrain/textures/concrete.png"), 
20, 20);
auto patch3 = terrain.AddPatch(patch3_mat, ChCoordsys<>(0, -42, 0), 
QUNIT),GetChronoDataFile("vehicle/terrain/meshes/bump.obj"));
and so on.

--Radu

From: [email protected] <[email protected]> On Behalf 
Of yaoyiyao
Sent: Saturday, 26 November 2022 08:48
To: ProjectChrono <[email protected]>
Subject: Re: [chrono] Error loading OBJ file

Hi,I  add  SetChronoDataPath(CHRONO_DATA_DIR);   to my  relocated 
demo_VEH_RigidTerrain code,I think my data files location is  right.
I debug my codes,I  found  it read jpg file  normally,but it read obj file 
abnormally.
[cid:[email protected]]
Many thanks in anvance.
On Friday, November 25, 2022 at 3:10:38 PM UTC+8 Radu Serban wrote:
As the message indicates, files in the Chrono data/ directory cannot be found 
(you can verify that there is no directory data/ at that location relative to 
where your executable is).
This is because you moved the demo away from its place in the Chrono file 
hierarchy.

To address this issue, you must specify a new location of where the code should 
be looking for data files.  If you look at the source of my_example.cpp in the 
template_project, you will see that this is done on the very first line in the 
main() function:
    // Set path to Chrono data directory
    SetChronoDataPath(CHRONO_DATA_DIR);
Simply add this to your relocated demo_VEH_RigidTerrain code.

The manner in which the problem of locating Chrono data files is addressed in 
the sample template_project is one possibility (study carefully how the 
CMakeLists file is set up there to understand what is being done).  There are 
other ways in which you could address the problem, but at the end of the day, 
you must make a call to SetChronoDataPath() to properly locate any Chrono data 
files your program uses.

--Radu

From: [email protected] <[email protected]> On Behalf Of 
yaoyiyao
Sent: Friday, 25 November 2022 03:22
To: ProjectChrono <[email protected]>
Subject: [chrono] Error loading OBJ file

Hi,I  run template_project successfully.Then I copy demo_VEH_RigidTerrain's 
code in  template_project and  modify cmakelist file ,but run failed.

[Image removed by sender.]
what's wrong with it?
Many thanks in advance.
--
You received this message because you are subscribed to the Google Groups 
"ProjectChrono" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/projectchrono/91958766-b73d-4974-83bf-7e2e906c50b2n%40googlegroups.com<https://groups.google.com/d/msgid/projectchrono/91958766-b73d-4974-83bf-7e2e906c50b2n%40googlegroups.com?utm_medium=email&utm_source=footer>.
--
You received this message because you are subscribed to the Google Groups 
"ProjectChrono" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
[email protected]<mailto:[email protected]>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/projectchrono/5d6bbcab-e4af-4524-b6bc-3a3ea12c32a1n%40googlegroups.com<https://groups.google.com/d/msgid/projectchrono/5d6bbcab-e4af-4524-b6bc-3a3ea12c32a1n%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
You received this message because you are subscribed to the Google Groups 
"ProjectChrono" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/projectchrono/PH0PR06MB8237C4235EF3314447421133A7119%40PH0PR06MB8237.namprd06.prod.outlook.com.

Reply via email to