Results 1 to 5 of 5

Thread: SDL/OpenGL selection example

  1. #1

    SDL/OpenGL selection example

    I have written some example code that illustrates one simple method of selecting and highlighting 3D objects in OpenGL. It uses gluUnProject + ray-sphere intersection for the selecting and stencil testing + wireframing for the highlighting. Not very original, but in case you wanted to see in action:

    selection.tar.gz (336 KB, there's some textures in it)

    Oh, and I've only tested it with FreePascal on Linux (use fpc -Mobjfpc -dSOUND selection.pp to compile it). I suspect that some minor changes might be needed to get it to work on other platforms or with the Delphi compiler. And you need JEDI-SDL, too.
    [size=10px]"In science one tries to tell people, in such a way as to be understood by everyone, something that no one ever knew before. But in poetry, it's the exact opposite." -- Paul Dirac[/size]

  2. #2
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25

    SDL/OpenGL selection example

    If you write up a 'cover sheet' or brief description for your example -Doesn't have to be formal! I can host it on PGD for you. Under your name... It's really help others to have something that they can read the basic idea, look at your code, try it, play with it.

    I'll even do up the HTML formatting for you.
    Jason McMillen
    Pascal Game Development
    Co-Founder





  3. #3

    SDL/OpenGL selection example

    I'll think about it, but I can't promise anything.
    [size=10px]"In science one tries to tell people, in such a way as to be understood by everyone, something that no one ever knew before. But in poetry, it's the exact opposite." -- Paul Dirac[/size]

  4. #4

    SDL/OpenGL selection example

    Can you explain how does it work a bit, it seems to give some other coordinates than it's suppose to.
    How exactly do i identify wich poly i'm clicking on, in selection mode i "name" them do i get original coords here ?
    Too bad selection is so slooow and limited/complicated.
    Thanks.
    The future must be... Fast and OpenSource so...
    <br />Think Open and Lightning Fast!

  5. #5

    SDL/OpenGL selection example

    Quote Originally Posted by Lightning
    Can you explain how does it work a bit, it seems to give some other coordinates than it's suppose to.
    Not for me. Perhaps you have a problem with your OpenGL header? Or maybe your driver?

    How exactly do i identify wich poly i'm clicking on, in selection mode i "name" them do i get original coords here ?
    I don't know what you're talking about. I don't use OpenGL selection mode in this example. I am not doing selection of polygons, I am doing selection of spheres. Look up "sphere-ray intersection" in any basic book on graphics, or Google it.

    Too bad selection is so slooow and limited/complicated.
    Again, this is probably your problem. Selection for me is fast, does what it is designed to do, and is very simple. Remember, you have the source, and good luck!
    [size=10px]&quot;In science one tries to tell people, in such a way as to be understood by everyone, something that no one ever knew before. But in poetry, it&#39;s the exact opposite.&quot; -- Paul Dirac[/size]

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
  •