0

i am using open gl with visual studio and visual c++.I want to find a point of cube that lie inside or outside.

genpfault
  • 51,148
  • 11
  • 85
  • 139
user519675
  • 33
  • 1
  • 2
  • 6
  • 3
    OpenGL is a rendering API. It is not used for collision tests or that sort of thing. You *can* make it do that stuff, but unless you have special needs, it's generally best to do it on the CPU. – Nicol Bolas Aug 05 '11 at 10:52
  • If you just need the algorithm look at this question: http://stackoverflow.com/questions/5254838/calculating-distance-between-a-point-and-a-rectangular-box-nearest-point – whoplisp Aug 05 '11 at 20:38

1 Answers1

2

@Nicol Bolas already commented it, but I'll give this as answer:

OpenGL is not meant to be used for this. OpenGL is a rendering API, i.e. it is meant for drawing stuff. And although OpenGL-1 and OpenGL-2 have rudimentary matrix manipulation functions it is neither a linear math library nor a computational geometry system. It may be (actually is) possible to abuse OpenGL for this kind of thing, but that doesn't mean you should do it.

Or simply put: OpenGL doesn't do this kind of stuff. You can't (well, should not) do that using OpenGL.

datenwolf
  • 159,371
  • 13
  • 185
  • 298