Texture in Sphere with Open GL

8

I'm trying to put a texture in a quadric object of glut in c ++ but for some reason I'm putting the texture in the background, I'm new with glut, if someone could help me.

void drawScene(void){

    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
    glPushMatrix();
    GLUquadric *quad;
    quad = gluNewQuadric();
    gluLookAt(x0,y,z0,xref,yref,zref,Vx,Vy,Vz);
    //glColor3f(1, 0, 0);
    glTranslatef(Xvalue, Yvalue, 0);
    GLint texture = LoadTexture("txVenus.bmp");
    gluQuadricTexture(quad, GL_TRUE);
    glEnable(GL_TEXTURE_2D);
    glBindTexture(GL_TEXTURE_2D, texture);
    gluSphere(quad, 24, 30, 30);
    glDisable(GL_TEXTURE_2D);
    glPopMatrix();
    glutSwapBuffers();
}

    
asked by Quiqas 03.03.2017 в 01:09
source

0 answers