How to add crosshair cursor in 2D and 3D rendering? - xtk

In the 2D renders, such as in Lesson 13 (http://lessons.goxtk.com/13/), is it possible to add a crosshair cursor indicating the position of orthogonal slices, like this sample?
Furthermore, is it possible to show that crosshair in the 3D volume render, instead of showing three orthogonal slices?

Related

Drawing a 3d object on a 2D screen plane without angle of view

I have a problem, I need to draw a 3D object in such a way that I can move it along the screen plane and rotate so that the angle of view is as if I always looked at it fixedly from one point.
I use the GLM library for working with matrices. I tried to use glm::ortho, but I can not operate with the z coordinate, respectively, the model does not rotate. if i use glm::perspective, then the model looks like i need only in the center of the screen. I mean, for example, the character model is depicted in the window of a game. How would you not move the window at any point on the screen, you look at the model directly, and not as if looking out of the corner.
I apologize, I do not know how to explain it in normal language, I hope it is understandable.

opengl 3d object picking - raycast

I have a program displaying planes of cubes, like levels in a house, I have the planes displayed so that the display angle is consistent to the viewport projection plane. I would like to be able to allow the user to select them.
First I draw them relative to each other with the first square drawn at {0,0,0}
then I translate and rotate them, each plane has it's own rotate and translate.
Thanks to this this page I have code that can cast a ray using the user's last touch. If you notice in the picture above, there is a green square and blue square, this is debug graphic displaying the ray intersecting the near and far planes in the projection matrix after clicking in the centre (with z of zero in order to display them), so it appears to be working.
I can get a bounding box of the cube, but it's coordinates will think they are still up in the left corner.
My question is how do I use my ray to check intersections with the objects after they have been rotated and translated? I'm very confused as I once had this working when I was translating and rotating the whole grid as one, now each plane is being moved separately I can't work out how to do it.

Draw a cube in Opengl using mouse

I am trying to draw a simple cube in opengl using the mouse. Here's the basic step I followed:
1. Get mouse click coordinates. One,when the mouse is first clicked (say x1,y1) and the other, when the mouse is released i.e after the drag (say x2,y2).
2. Convert the 2d Coordinates to 3d using glUnproject.
3. Now that I have two points in 3d, I can easily render a Cube.
Everything went as planned, except I this was found while are drew the cube:
Link to the image: Here
The cube was half drawn,I dont know what's the problem here.
That looks like the whole scene is clipped at the backplane. Try moving the backplane further away from your camera. If you don't know what a backplane is take a look at this awesome article: http://www.lighthouse3d.com/tutorials/view-frustum-culling/

opengl selecting area on model

I need some help in surface area selection on a 3d model rendered in opengl by picking points through mouse. I know how to get a point in world coordinate but cant find a way to select an area. Later I need to remesh that selected area and map an image over it which I know.
Well, OpenGL by itself can't help you there. OpenGL is a drawing API. You draw things, but once the drawing commands have been executed all that's left are pixels in a framebuffer and OpenGL has no recollection about the geometry whatsoever.
You can use OpenGL to implement image based area selection algorithms, for example by drawing each face with a unique index color into an off screen framebuffer. Then by looking at what values can be found therein you know which faces are present in a given area.
Later I need to remesh
This is called topology modification and is completely outside the scope of OpenGL.
that selected area and map an image over it which I know
You can use a image based approach for this again, however you must know in which way you want to make images to faces first. If you want to unwrap the mesh, then OpenGL is of no help. However if you want the user to be able to "directly draw" onto the mesh, this can be done by drawing texture coordinates into another off screen framebuffer and by this reverse mapping screen coordinates to texture coordinates.

Display Crosshairs in XTK 2D View

Is there a way to display the colored x,y,z crosshairs that are visible in the 3D volume view in 2D slices (like in lesson 13)?
Thanks!
Nolan
the crosshairs are just borders around the slices. What do you have in mind to display them in 2D?