• Advertisement

thekid

Member
  • Content count

    236
  • Joined

  • Last visited

Community Reputation

122 Neutral

About thekid

  • Rank
    Member
  1. thanks for all the info. I still have a problem however. I am redering 2*2 quads to represent the cells on the board. I do a for loop to render them like this: for(int i=0; i<game->getBoard()->getWidth(); i++) { for(int j=0; j<game->getBoard()->getHeight(); j++) { glLoadIdentity(); glTranslatef(((float)(i*2)) - adjustment, ((float)(j*2)) - adjustment, -40.0f); //--draw cell glBegin(GL_QUADS); glVertex3f(-1.0f, 1.0f, 0.0f); glVertex3f( 1.0f, 1.0f, 0.0f); glVertex3f( 1.0f, -1.0f, 0.0f); glVertex3f(-1.0f, -1.0f, 0.0f); //--end drawing glEnd(); } } so how do i know what cell i am clicking because I translate each one of them indiviually i dont know their final world coordinates. also i output the coordinates i get from gluUnproject and they are really strange. i have to adjust the board so that it is in the center of the screen perhaps i just dont understand the coordinate system in opengl. should i draw it at the world origin and just move the camera?
  2. thanks to nts, i am trying the gluUnproject, i am getting segmentation faults however when trying to get the mode, projection matrices and the viewport using glGetdoublev and glGetIntegerv. any ideas? yes CosmoKramer i realize that the problem is trivial if the board is always facing the user directly but i want to be able to rotate around the gameboard thus the problem of picking.
  3. hi all, im working on a project that requires me to know what poly on in 3d space was clicked when the user clicks on the screen. In this case it is just a simple grid of cells (minesweeper clone for uni project) i know this is possible but I have had little luck finding good sources of info on the topic. I am using OpenGL for the graphics API and glut for the windowing. thanks in advance.
  • Advertisement