How to tell what was clicked on? (OpenGL)

This is a discussion on How to tell what was clicked on? (OpenGL) within the Game Programming forums, part of the General Programming Boards category; I'm trying to make a simple level editor for a game I'm making. Its probably going to be tile based, ...

  1. #1
    napKINfolk.com napkin111's Avatar
    Join Date
    Apr 2002
    Posts
    310

    Question How to tell what was clicked on? (OpenGL)

    I'm trying to make a simple level editor for a game I'm making. Its probably going to be tile based, and I want to be able to click on a tile to select it, then press 1-9 to change that tile to the corresponding number (1 for dirt, 2 for grass, etc). The problem is I don't know how to tell what was clicked on...

    Any suggestions would be appreciated!

    //napKIN

  2. #2
    Registered User Bieh's Avatar
    Join Date
    Sep 2002
    Posts
    83
    Try:
    NeHe's 'Picking, Alpha Blending, Alpha Testing, Sorting' tutorial (the 'picking' part is what you're after), or GameTutorials Object-Selection tutorial.

    Hope that helps
    "It always takes longer than you think, even when you take Hofstadter's Law into account."
    -Hofstadter's Law

    Bored? Try my game SpaceWars , made in Allegro and VC++
    or see my new game Redoubt , made in OpenGL and VC++

  3. #3
    I lurk
    Join Date
    Aug 2002
    Posts
    1,361
    Here's an example program from OpenGL Superbible. You'll need GLUT installed to compile.
    Attached Files Attached Files

  4. #4
    napKINfolk.com napkin111's Avatar
    Join Date
    Apr 2002
    Posts
    310
    Awesome, thanks guys!

    //napKIN

  5. #5
    Banned frenchfry164's Avatar
    Join Date
    Oct 2001
    Posts
    1,552
    is that ogl superbible available as a e-book anywhere?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Linking OpenGL in Dev-C++
    By linkofazeroth in forum Game Programming
    Replies: 4
    Last Post: 09-13-2005, 11:17 AM
  2. OpenGL Window
    By Morgul in forum Game Programming
    Replies: 1
    Last Post: 05-15-2005, 01:34 PM
  3. OpenGL .dll vs video card dll
    By Silvercord in forum Game Programming
    Replies: 14
    Last Post: 02-12-2003, 07:57 PM
  4. OpenGL and Windows
    By sean345 in forum Game Programming
    Replies: 5
    Last Post: 06-24-2002, 11:14 PM
  5. opengl code not working
    By Unregistered in forum Windows Programming
    Replies: 4
    Last Post: 02-14-2002, 10:01 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21