Solved

Binding a texture "*.bmp" to glutSolidCube?

Posted on 2004-03-23
5
4,672 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

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 …
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…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

809 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