Questions tagged [mouse-picking]

77 questions
0
votes
1 answer

Shader doesn't write anything for picking by id

I am trying to implement picking by an int id, but it looks like my shader doesn't write anything, althought I can read the clear color properly. vs, I skipped completely any matrix for debugging: #version 330 #include semantic.glsl layout…
elect
  • 6,765
  • 10
  • 53
  • 119
0
votes
3 answers

Determine what object a mouse is pointed over?

Can someone show me the simplest way you can think of to determine what object is being clicked so I can move that object independently using the glut functions?
PocketTNT
  • 21
  • 8
0
votes
1 answer

Trying to get mouse picking to work, but not sure where I'm lost

I'm drawing a 10x10 grid of squares at a depth of 0 and trying to highlight the one the mouse is over. I've tried following the tutorial here: http://antongerdelan.net/opengl/raycasting.html but I don't know if I did it right. I end up with a…
xaxxon
  • 19,189
  • 5
  • 50
  • 80
0
votes
1 answer

Software Usability: Selection by picking with mouse

I'm designing a canvas based software with pickable objects. User interaction is performed by a custom state machine based system. I need to specify the selection process, but I need some recommendations or best practices on how users should pick…
0
votes
1 answer

Picking in OpenGL using glRenderMode(GL_SELECT) and glReadPixels

I'm trying to do selection in opengl but it is not working. I draw objects I receive from a .obj file (v, vn, f, o and such indices). Each object consists from "groups" and each group is a group of GL_POLYGON. Here is the draw function: void…
Javi
  • 889
  • 1
  • 16
  • 41
0
votes
1 answer

Retrieve the texture coordinate under the mouse

I'm working with Qt 4.8 and its OpenGL module, with the fixed pipeline and I have a sphere that was cubemapped, with the tex coords for each cube face auto-generated by OpenGL via glTexGenf (R, S and T…
Adri C.S.
  • 2,909
  • 5
  • 36
  • 63
0
votes
1 answer

GLControl Picking Issue

I am, yet again, having a slight issue with picking in OpenGL/OpenTK. This time, unlike a thread I had started awhile back, it is actually working. The only issue is that the "tiles" are not correctly chosen. What I mean is that if I click a…
Krythic
  • 4,184
  • 5
  • 26
  • 67
0
votes
1 answer

How to use Three.js mouse picking

I would like to add object picking to this code: var Three = new function () { this.scene = new THREE.Scene() this.camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 1000) this.camera.position.set(20,…
Bartek Kosa
  • 842
  • 1
  • 14
  • 25
0
votes
1 answer

OpenTK "Picking" Not Working As Intended

I have attempted to implement picking in my game and I am certain that I am missing something because the picked color always returns either 255,255,255,255 or 255,0,0,0. These two colors seem to happen randomly, and even change when I click on the…
Krythic
  • 4,184
  • 5
  • 26
  • 67
0
votes
1 answer

Screen position unprojection without W

I understand the basic concept of how to unproject: let mut z = 0.0; gl::ReadPixels(x as i32, y as i32, 1, 1, gl::DEPTH_COMPONENT, gl::FLOAT, &z); // window position to screen position let screen_position = self.to_screen_position(x, y); // screen…
bfops
  • 5,348
  • 5
  • 36
  • 48
0
votes
1 answer

Away3d mesh not getting mouseClick events

I am just trying to get the coordinates of the mouse in a plane but the mouse event just doesnt fire. I also have an starling instance on top of away3d that i got with this tutorial and i believe there is a problem there. Here is my code: public…
0
votes
2 answers

ask about D3DXIntersect function:(

// get the current transform matrices D3DXMATRIX matProjection, matView, matWorld, matInverse; ENGINE.GetDevice()->GetDevice()->GetTransform(D3DTS_PROJECTION, &matProjection); …
user1658740
  • 75
  • 2
  • 5
0
votes
1 answer

In Three.js Picking Ray, How Objects moves only X,Z? not Y

now Objects move every direction. but I want to Objects move only X or Z, not Y. I try this. but result is not good. on MouseMove // OBJECT SELECTED if ( SELECTED ) { var intersects = ray.intersectObject( PICKING_PLANE…
user1658740
  • 75
  • 2
  • 5
0
votes
1 answer

C++/CLI: ColorMatrix for applying an Alpha Threshold

Would anyone know how to specify a ColorMatrix (Specifically a System::Drawing::Imaging::ColorMatrix in C++/CLI) to set an alpha threshold? For example if I were to use 10 (10/255) as my threshold then any pixel with an RGBA Alpha of 10 or less…
Stomy
  • 213
  • 1
  • 2
  • 7
0
votes
3 answers

3d line mouse picking

I have 3d scene with thousands lines. I want to be able to pick ALL 3d lines in the 10 pixels neighborhood of the mouse cursor (with perspective projection). I've tried to use unique-color based method. But this method is not suitable for me because…
Alex
  • 101
  • 1
  • 1
  • 8