Solved

Binding a texture "*.bmp" to glutSolidCube?

Posted on 2004-03-23
5
4,595 Views
Last Modified: 2016-11-24
Please somebody help me!

Is it possible to use textures on glutSolidCube/glutWireCube and glutSolidSphere/glutWireSphere?

Cheers Tony!
0
Comment
Question by:TonyTigerHearty
5 Comments
 
LVL 1

Accepted Solution

by:
sylwander earned 500 total points
Comment Utility
Yes, it's quite easy. Just use the following commands in your code:


glBindTexture( GL_TEXTURE_2D, textureNr );
glutSolidSphere( params );


I think that should do it. If I'm not mistaken glutSolidSphere generates it's own texture coordinates, distributing the texture over the sphere surface. If that doesn't work you can try using the gluSphere command instead (you will need to define a quadric):


glBindTexture( GL_TEXTURE_2D, textureNr );
gluSphere( quadric, ballRadius, 20, 20 );

0
 

Expert Comment

by:kfarhang
Comment Utility
I had this same exact problem, none of the solutions i was finding online worked, but this chunk of code works like a charm:


glBindTexture(GL_TEXTURE_2D, texture2);

glTexGeni(GL_S, GL_TEXTURE_GEN_MODE,GL_SPHERE_MAP);

glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);

glEnable(GL_TEXTURE_GEN_S);

glEnable(GL_TEXTURE_GEN_T);

glutSolidSphere(1.0, 35.0, 35.0);

Open in new window

0
 

Expert Comment

by:rICHO LOU
Comment Utility
FALSE ITSN´T WORKS
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

As game developers, we quickly learn that Artificial Intelligence (AI) doesn’t need to be so tough.  To reference Space Ghost: “Moltar, I have a giant brain that is able to reduce any complex machine into a simple yes or no answer. (http://www.youtu…
Recently, in one of the tech-blogs I usually read, I saw a post about the best-selling video games through history. The first place in the list is for the classic, extremely addictive Tetris. Well, a long time ago, in a galaxy far far away, I was…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now