Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

orcblood

Adding points "on click"

This topic is 5253 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Im attempting to create some vertex points once the left mouse button has been pressed in my program. The program compiles nad runs fine, however, I never actually SEE the points... This is strange, however, prehaps someone could tell me why (I probably heven''t throught of something).

bool lmc; // left mouse click
bool lm_click; // left mouse press

case WM_LBUTTONDOWN:
        {

             lmc=TRUE;
             lm_click=!lm_click;

             if(!lm_click)
             {
                   glColor3f(1.0f, 1.0f, 1.0f);
                   glVertex3f(0.1f, 0.0f, 0.0f);
             }

        }

 
Im probably missing some major part of the code, prehaps I need to declair a variable for if the left mouse has been pressed that would go into the int DrawGLScene section of the program''s code?

Share this post


Link to post
Share on other sites
Advertisement
glVertex etc is used for drawing the point, and must be within glBegin/glEnd for a start.

Next, it draws the vertex ONCE. Thats all. So if you want to be able to see it in more than one frame, you''d better call glVertex for each point, each frame.

So yes, you''ll need a variable to store the vertex or list of vertices created with the mouse click and then go through this list and draw all the verts everyt frame.

Share this post


Link to post
Share on other sites
you have to call glVertex(...) between calls to glBegin() and glEnd. it would probably be better to add the points to an array (or std::vector) and then have a function that you call once per frame that goes through the list and draws all points.

edit: beat me to it..

[edited by - necromancer_df on April 3, 2004 9:41:11 AM]

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!