08-30-2022 10:49 PM
How can I change the color of the cubes in hello_xr from Android Studio?
I have very little experience with Android Studio, but I can run hello_xr on on my Quest 2 and I understand OpenGL C++. I tried looking at some of the .c and .cpp files, but Android Studio tells me "This file does not belong to any project target; code insight features might not work properly."
Solved! Go to Solution.
09-26-2022 05:56 AM - edited 09-26-2022 05:57 AM
Yes, in the hello_xr demo app, there only one OpenGL resource (vertices and colors) for all the cubes (defines in InitializeResources), so you must refines the source code to create diffrerents resources and manage differents cubes.
The hands cubes are created on the fly in the "openxp_program.cpp" file at the "RenderLayer" function; search for the line with "for (auto hand : {Side::LEFT, Side::RIGHT})".
Cheers
09-25-2022 01:34 PM
Hi,
The cube vertices array contains also the face colors, and is defined in the file geometry.h in the c_cubeVertices array.
Je cube's color is send to the OpenGLES shader in the "graphicsplugin_opengles.cpp" file at the end of the "InitializeResources" function.
Regards
09-25-2022 06:30 PM
Great thanks!
This works, but it ends up changing the color of every cube in the scene. It looks like c_cubeVertices is used several times to create several instances of the cube. Do you happen to know which file has the OpenGL code for creating the cube on the right controller?
09-26-2022 05:56 AM - edited 09-26-2022 05:57 AM
Yes, in the hello_xr demo app, there only one OpenGL resource (vertices and colors) for all the cubes (defines in InitializeResources), so you must refines the source code to create diffrerents resources and manage differents cubes.
The hands cubes are created on the fly in the "openxp_program.cpp" file at the "RenderLayer" function; search for the line with "for (auto hand : {Side::LEFT, Side::RIGHT})".
Cheers