Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7427857
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T08:38:56+00:00 2026-05-29T08:38:56+00:00

I’m doing a program in Perl with the OpenGL bindings, i’ve got past the

  • 0

I’m doing a program in Perl with the OpenGL bindings, i’ve got past the first roadblock when the glutReshapeFunc(\&changeSize); is called by reading the GLUT_WINDOW_HEIGHT and GLUT_WINDOW_WIDTH variables, but i have no clue how to get the value of the key passed when glutSpecialFunc(\&processSpecialKeys); is called.
Reading the API i couldn’t find a GLUT_SPECIAL_KEY variable or anything like that.

sub changeSize
{
        my $w = glutGet(GLUT_WINDOW_WIDTH);
        my $h = glutGet(GLUT_WINDOW_HEIGHT);
        if($w eq 0){
        $w = 1;
}
        my $ratio = ($w / $h);
        # Use the Projection Matrix
        glMatrixMode(GL_PROJECTION);

            #// Reset Matrix
        glLoadIdentity();

        #// Set the viewport to be the entire window
        glViewport(0, 0, $w, $h);

        #// Set the correct perspective.
        gluPerspective(45,$ratio,1,1000);

        #// Get Back to the Modelview
        glMatrixMode(GL_MODELVIEW);
        gluLookAt( $x, 1.0, $z,
            $x+$lx,1.0,$z+$lz,
            0.0,1.0,0.0);
}

sub processSpecialKeys
{

    $fraction = 0.1;
    $key = $_[0]; #my first shot was that the key value was stored at $_[0]
                      #the mouse_x was at $_[1] and $_[2] had mouse_y
        if ($key eq GLUT_KEY_LEFT)
        {
            $angle -= 0.01;
            $lx = sin($angle);
            $lz = -cos($angle);
        }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T08:38:57+00:00Added an answer on May 29, 2026 at 8:38 am

    OpenGL itself doesn’t deal with user input. What you are using is GLUT, a 3rd party library.

    glutReshapeFunc(\&changeSize); is called by reading the GLUT_WINDOW_HEIGHT and GLUT_WINDOW_WIDTH variables,

    You normally don’t query GLUT_WINDOW_HEIGHT and GLUT_WINDOW_WIDTH from the reshape handler, since both of those values are passed as parameters to the function.

    of the key passed when glutSpecialFunc(\&processSpecialKeys); is called. Reading the API i couldn’t find a GLUT_SPECIAL_KEY variable or anything like that.

    Because there isn’t. The key and the position of the click are passed as parameters to the callback function.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I've got a string that has curly quotes in it. I'd like to replace
I am reading a book about Javascript and jQuery and using one of the
We're building an app, our first using Rails 3, and we're having to build
i got an object with contents of html markup in it, for example: string
I'm making a simple page using Google Maps API 3. My first. One marker
I am trying to understand how to use SyndicationItem to display feed which is
That's pretty much it. I'm using Nokogiri to scrape a web page what has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.