glut keyboard function
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 10 of 10

Thread: glut keyboard function

  1. #1
    Join Date
    Oct 2011
    Posts
    15

    glut keyboard function

    i want to redispaly the house at runtime according to changing in my text file by pressing r or R BUT WHEN I build it it gives me error error C2065: 'Keyboard' : undeclared identifier
    Attached Files Attached Files

  2. #2
    Join Date
    Aug 2008
    Posts
    902

    Re: glut keyboard function

    Code:
    glutKeyboardFunc(Keyboard);
    You are trying to use the function Keyboard in main, but it is not declared until after main.

  3. #3
    Join Date
    Oct 2011
    Posts
    15

    Re: glut keyboard function

    please tell me what changes i do in my program in what places i am new in programing please solve my problem

  4. #4
    Join Date
    Jul 2008
    Location
    Croatia
    Posts
    52

    Re: glut keyboard function

    Write function declaration before function main

    Code:
    void Keyboard(unsigned char key, int x, int y);
    My suggestion is that you write it after
    Code:
    using namespace std;
    but before draw function body.
    Code:
    void draw(void)
    Do this for all your functions except main. This way your program will not depend on position of your function body and you will know what functions are in the file, without look to the whole file.

  5. #5
    Join Date
    Oct 2011
    Posts
    15

    Re: glut keyboard function

    thanks my program runs but i want to redraw it during run time when i press r or R ,but when i change my points in my text file during runtime it redraws it but without pressing r please solve my problem

  6. #6
    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    3,634

    Re: glut keyboard function

    Please do not cross-post see this http://www.codeguru.com/forum/announcement.php?f=7 under Posting
    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are, by
    definition, not smart enough to debug it.
    - Brian W. Kernighan

    To enhance your chance's of getting an answer be sure to read
    http://www.codeguru.com/forum/announ...nouncementid=6
    and http://www.codeguru.com/forum/showthread.php?t=366302 before posting

    Refresh your memory on formatting tags here
    http://www.codeguru.com/forum/misc.php?do=bbcode

    Get your free MS compiler here
    http://www.microsoft.com/visualstudio/eng/downloads

  7. #7
    Join Date
    Aug 2000
    Location
    West Virginia
    Posts
    7,565

    Re: glut keyboard function

    1) the draw() function is called whenever a glutPostResdisplay() is
    generated (either explicitly by your code or by the system).

    2) For example, placing a another window in front of the glut graphics
    window and moving it around will generate a redraw.

    3) you should not open the data file in your data file. You should read
    the data into some type of container (vector, list, etc.) When you
    hit the R key, you should re-read the data and post a glutPostRedisplay

  8. #8
    Join Date
    Oct 2011
    Posts
    15

    Re: glut keyboard function

    please tell me what changes i do in my program to get the required result please write a code for it.
    is it not possible to get the required result with this code?

  9. #9
    Join Date
    Aug 2000
    Location
    West Virginia
    Posts
    7,565

    Re: glut keyboard function

    Yes, you can get the required results. I gave you the steps
    in my previous post.

    Have you made those changes yet ?

  10. #10
    Join Date
    Oct 2011
    Posts
    15

    Re: glut keyboard function

    i have'nt understand the steps please change the code in my file to get required result

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center