?
Solved

Binding a texture "*.bmp" to glutSolidCube?

Posted on 2004-03-23
5
Medium Priority
?
4,775 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 1

Accepted Solution

by:
sylwander earned 2000 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

Percona Live Europe 2017 | Sep 25 - 27, 2017

The Percona Live Open Source Database Conference Europe 2017 is the premier event for the diverse and active European open source database community, as well as businesses that develop and use open source database software.

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…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

741 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