I am looking for a way to add some images at the top of the AR Sandbox so that I will be able to move them in a 2D way with the keyboard arrows or whatever. I have experience with WebGL and C++ but not with OpenGL. So what I am thinking is that I have to build a basic plane and add the image as a texture to that specific plane. Has anybody tried that? I am guessing that I have to check out the Vrui tool and find the functions myself or there is an online documentation which explains the API that I haven’t found yet?
I’m pretty sure that I have seen somebody use the DEM feature to create a topography and then display an aerial map on top of it. I think it was static though.
I’ve never used WebGL (so I’m not sure about how much they are similar) and I’ve not tried adding images but that sounds like the way to do it. You will need a vertex and fragment shader and use a texture as input to the fragment shader. Create a flat polygon and draw it with the texture as input to the shader (you can use glBegin or glDrawElements for example).
As for documentation on OpenGL I’d look up a couple of tutorials instead (here are a couple that I go back to when I need them: https://learnopengl.com/ and http://www.opengl-tutorial.org). There is documentation online (https://www.khronos.org/registry/OpenGL-Refpages/gl4/) but at least to me it isn’t very clear to learn from. Also I’d recommend referring back to the code in the Sandbox. You can have a look at DepthImageRenderer::renderSurfaceTemplate() for how the final texture with all the color-mapping topography and water is drawn or at WaterTable2::runSimulationStep() for how the texture containing the water amount is calculated.
Finally, with regards to moving the image around I don’t know if you can use the inbuilt openGL functions or you will have to use the Vrui functions. You can find Vrui documentation here: http://idav.ucdavis.edu/~okreylos/ResDev/Vrui/Documentation/index.html
I don’t know if this would be a roundabout way of doing it but you can create a movement Vrui Tool with arrow keys etc. defined as input handlers and use the callback event function to handle the object behavior, then link the tool with the Sandbox (I’d look back at GlobalWaterTool class for how Vrui Tools are handled).
I hope some of it helps 🙂 I’m in no way an expert on any of it but that’s how I’ve been figuring out how to do various bits and pieces with the Sandbox.
Out of curiosity what is it that you are doing with the Sandbox? 🙂
Just caught myself with the last comment on openGl event handlers as they are handled by external libraries so I think you might have to go through Vrui Tools for that. Sorry for that mistake (i tried editing my post but can’t seem to be able to)
Thanks for the reply. I will definitely look into that! I am looking for a way to add some features to the sandbox to allow the user to handle it as a strategy terrain game… I am also interested in embedding a map on the top of the sandbox so that I will be able to build real topography on my at sandbox
That sounds cool! Good luck! Post some pictures when you’re done if you can
I came across a post earlier about somebody using the DEM feature of the Sandbox to shape topography and then overlaying it with an actual map of the place once the shaping of the sand is finished. You might have some luck looking out for that too.
You must be logged in to reply to this topic.