cancel
Showing results for 
Search instead for 
Did you mean: 

Editing Cubes in hello_xr Android Studio

AugmaDev
Explorer

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." 

1 ACCEPTED SOLUTION

Accepted Solutions

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

View solution in original post

3 REPLIES 3

antoine.emerit
Explorer

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

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?

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