So I have been trying to understand the concept of 3D picking but as I can't find any video guides nor any concrete guides that actually speak English, it is proving to be very difficult. If anyone is well experienced with 3D picking in LWJGL, could you give me an example with line by line explanation of what everything means. I should mention that all I am trying to do it shoot the ray out of the center of the screen (not where the mouse is) and have it detect just a normal cube (rendered in 6 QUADS).
1
There are 1 best solutions below
Related Questions in OPENGL
- How to fix "Access violation executing location" when using GLFW and GLAD
- getting Access violation writing location when calling glDrawElements caused by shader
- Experimenting with GLFW library: window boundary problem and normalized coordinates
- OpenGL Framebuffer/FBO RTT subpixel movement discrepancy
- Why isn't my glfw window showing anything?
- How can glPushMatrix affect the rotation of an object around a rotating object?
- g++ / vscode apparently cannot see my src folder? "cc1plus.exe: fatal error: src/glad.c No such file or directory"
- Does addition-assignment cause dependency chain in GLSL?
- Compiling C++ program with Opengl and Glut in windows
- Using Silk.NET in WinForms
- What happens when rendering an OpenGL buffer that has been padded with NULL (or another value)?
- How can I make a sphere follow an eight-like path in Python using OpenGL?
- OpenGL only rendering second triangle, first triangle not visible
- OpenGL shows black texture on quad
- My Visual Studio 2022 consistently gives me errors saying that the GLchar variable type is undefined
Related Questions in LWJGL
- Triangle in OpenGL doesn't render
- Java Program progressive becomes slower after each launch
- How to render image in SpaiR / imgui-java with Vulkan?
- GLFW minimize window into systemtray/notifation area
- OpenGL rendering to framebuffer with two different programs does not work correctly with NVidia GeForce RTX 2080
- LWJGL opengl no context in function, after defining context error
- Getting error with GLSL with very little context to why
- lwjgl.dll not found in java.library.path
- How to do face culling in a voxel game using Java and LWJGL
- OpenGL Texture rendering over another with 3D Batch Renderer
- LWJGL not working with Gradle - Linux ARM64 - Java 17
- Java (LWJGL) Window
- How to find out which graphcs card my libgdx/lwjgl game is running on?
- How do I upload a collection of position vectors and rotation quaternions to the GPU in OpenGL?
- Detecting 3D Collisions
Related Questions in PICKING
- Preventing internal transfer merge
- How to optimize this set-picking algorithm?
- WebGL picking points
- Simulate click event in Matplotlib that triggers a pick event
- saving data points when picking from a plot
- In 3d, how to pick the most suitable point?
- Terrain picking in mapbox-gl-js
- AnyLogic: Move two agents simultaneously into a pallet rack
- How to get position of clicked icon on cesium map
- In OpenGL, how to pick an object by name stack when I use the VAO to draw objects?
- OpenGL/GLSL 4.5 - using MRT in the default FBO
- Unity - How to react to scene picking? How to force select a parent by picking its child in the sceneview
- Issues with picking in c# XNA
- How to create orders for picking process at warehouse operations using Anylogic
- How to create specific warehouse order picking strategy in anylogic
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Though I am not an expert with 3D picking, I have done it before, so I will try to explain.
You mentioned that you want to shoot a ray, rather than go by mouse position; as long as this ray is parallel to the screen, this method will still work, just the same as it will for a random screen coordinate. If not, and you actually wish to shoot a ray out, angled in some direction, things get a little more complicated, but I will not go in to it (yet).
Now how about some code?
Code Notes:
The idea behind this method is that each object will be rendered exactly how the user sees it, except that all of a model is a solid colour. Then, you check the colour of the pixel for the screen coordinate requested, and which ever model the colour is indexed to: that's your object!
I do recommend, however, adding a check for the background color (or your glClearColor), just in case you don't actually hit any objects.
Please ask for further explanation if necessary.