Solved

Binding a texture "*.bmp" to glutSolidCube?

Posted on 2004-03-23
5
4,711 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
ID: 10687956
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
ID: 21407014
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
ID: 41900928
FALSE ITSN´T WORKS
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What is RenderMan: RenderMan is a not any particular piece of software. RenderMan is an industry standard, defining set of rules that any rendering software should use, to be RenderMan-compliant. Pixar's RenderMan is a flagship implementation of …
Artificial Intelligence comes in many forms, and for game developers, Path-Finding is an important ability for making an NPC (Non-Playable Character) maneuver through terrain.  A* is a particularly easy way to approach it.  I’ll start with the algor…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

679 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