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 6729879
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:20:32+00:00 2026-05-26T10:20:32+00:00

I have two exact same codes OpenGL C++ , compiled using VS2008 in different

  • 0

I have two exact same codes OpenGL C++ , compiled using VS2008 in different project , but when i compile them, it behaves differently. One of them can recognize the condition if ( mod == GLUT_ACTIVE_CTRL && button == GLUT_WHEEL_UP ) and one of them is not.

Here is the complete function:

void mouse(int button, int state, int x, int y) {

int mod = glutGetModifiers();
mouseState = state;
mouseButton = button;
double modelview[16], projection[16];

int viewport[4];
float z = 0 ;

/*Read the projection, modelview and viewport matrices
using the glGet functions.*/
glGetIntegerv( GL_VIEWPORT, viewport );
glGetDoublev( GL_MODELVIEW_MATRIX, modelview );
//glGetDoublev( GL_PROJECTION_MATRIX, projection );

//Read the window z value from the z-buffer 
glReadPixels( x, viewport[3]-y, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &z );   

// Used for wheels, has to be up    
if (state == GLUT_UP )  {       
    if ( mod == GLUT_ACTIVE_CTRL && button == GLUT_WHEEL_UP ){                  
        printf("Wheel Up\n");
        zoom += 0.1;
    }
    else if (mod == GLUT_ACTIVE_CTRL &&  button == GLUT_WHEEL_DOWN ){
        printf("Wheel Down\n"); 
        zoom -= 0.1;
    }


    else if (mod == GLUT_ACTIVE_ALT && button == GLUT_WHEEL_UP) {
        //printf("Z++\n");
        translation_z = translation_z + 0.1;
        //printf("Z = %f", translation_z);
    }

    else if (mod == GLUT_ACTIVE_ALT && button == GLUT_WHEEL_DOWN) {
        //printf("Z--\n");
        translation_z = translation_z - 0.1;
    }

    else if (mod == GLUT_ACTIVE_SHIFT && button == GLUT_WHEEL_UP) {
        //printf("Shift Wheel Up. Z axis rotation goes here.\n");
        zrotation += (5*(z - oldZ)); // about x-axis
    }

    else if (mod == GLUT_ACTIVE_SHIFT && button == GLUT_WHEEL_DOWN) {
        //printf("Shift Wheel Down. Z Axis rotation goes here\n");
        zrotation -= (5*(z - oldZ)); // about x-axis
        //translation_z = translation_z - 0.1;
    }


}
else if (state == GLUT_DOWN) {
    //printf("Glut Down before z processing\n");

    if (button == GLUT_LEFT_BUTTON){
        cursorX = x;
        cursorY = y;
        mode = SELECT;
        //printf("Left is down\n");
    }

    oldX = x;
    oldY = y;
}
}

`

and I uploaded both of the project here.

  • 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-26T10:20:32+00:00Added an answer on May 26, 2026 at 10:20 am

    I found the problem, In the project that can not recognize wheel up/down condition (despite that it should), I included:

    freeglut.lib glut32.lib opengl32.lib user32.lib

    This can be solved by including only the following libs:

    opengl32.lib user32.lib

    Thank you @melak47 for suggesting to check the project settings.

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

Sidebar

Related Questions

I have two sites using the same exact code for @font-face. The font files
I'm guessing the following two functions compile to the exact same byte-code, but I
I have two enumerables with the exact same reference elements, and wondering why Equals
Alright, I have two files. They are the EXACT SAME. The first file is:
So I have two copies of exactly the same project. The configuration of the
So I have two stores that use the exact same model, they are exactly
I have two interrupt service routines (ISR) which basically do the exact same thing
I have two select controls that I want to populate with the exact same
I have two methods, one called straight after another, which both throw the exact
I have two applications written in Java that communicate with each other using XML

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.