小编Ase*_*l84的帖子

OpenGL 新功能:glutMouseFunc

我试图在单击鼠标后更改球体位置,但是在使用 glutMouseFunc 中的 x 和 y 时它不起作用,这是代码:

//

   #include "stdafx.h"
    #include <stdlib.h>
    #include <GL/glut.h>


    bool Cone=false , ConeSelected=false,
    Cube=false, CubeSelected=false,
    Sphere=false, SphereSelected=false,
    Teapot=false, TeapotSelected =false,
    Torus=false, TorusSelected=false;
    static float XSphere=0, YSphere=-1.5 ,ZSphere=0;

    void init(void) 
    {
    GLfloat blankMaterial[] = {1.0, 0.0, 0.0};
    GLfloat whiteDiffuseLight[] = {30}; 
    glClearColor (0.0, 0.1, 0.2, 0.0);
    glClearDepth(1.0);
    glShadeModel (GL_FLAT);
    glEnable(GL_LIGHTING);
    glEnable(GL_LIGHT0);
    glEnable(GL_DEPTH_TEST);
    glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, blankMaterial);
    glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, blankMaterial);
    glMaterialfv(GL_FRONT_AND_BACK, GL_SHININESS,  whiteDiffuseLight);
     }


    void display(void)
    {
      glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 
      glEnable(GL_DEPTH_TEST);

      //Drawing Cube
       if(Cube)
        {
        glPushMatrix();
        glColor3f(0, …
Run Code Online (Sandbox Code Playgroud)

c opengl glut

2
推荐指数
1
解决办法
1万
查看次数

标签 统计

c ×1

glut ×1

opengl ×1