Results 1 to 3 of 3

Thread: How to make mouse controlled 2d box with opengl

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    PGD Staff / News Reporter phibermon's Avatar
    Join Date
    Sep 2009
    Location
    England
    Posts
    524
    Actually surprisingly enough - while you do have to map your mouse coordinates into device space (in the form of a ray) - OpenGL (legacy) does have picking functionality with the GL_SELECTION render mode (see https://www.opengl.org/archives/reso.../selection.htm) or with modern OpenGL 3+ you can use occlusion queries to produce equivalent functionality or you can create your own system by testing against a depth buffer etc

    If you require per-poly / per-pixel picking then in all but the most simple of scenes? it will be faster to optimize picking with the GPU.

    Bare in mind however that it's not a free operation and while it's often faster than a CPU bound solution - you may still want to do it on the CPU anyway. As always benchmarking weighed against the other things you're doing on the GPU is recommended.

    I guess it depends if your game is CPU bound or GPU bound.
    Last edited by phibermon; 09-05-2016 at 06:25 AM.
    When the moon hits your eye like a big pizza pie - that's an extinction level impact event.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •