PDA

View Full Version : How to render a earth or teapot with texture?



houdy
10-22-2004, 03:58 PM
This is my code, but it doesn't work.
void DrawEarth()
{
glEnable(GL_TEXTURE_2D);
glTexParameteri(GL_TEXTURE_CUBE_MAP_EXT,GL_TEXTURE _MIN_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_CUBE_MAP_EXT,GL_TEXTURE _MAG_FILTER,GL_LINEAR);
glEnable(GL_TEXTURE_GEN_S);
glEnable(GL_TEXTURE_GEN_T);
glTexGeni(GL_S,GL_TEXTURE_GEN_MODE,GL_SPHERE_MAP);
glTexGeni(GL_T,GL_TEXTURE_GEN_MODE,GL_SPHERE_MAP); glTexParameteri(GL_TEXTURE_CUBE_MAP_EXT,GL_TEXTURE _WRAP_S,GL_CLAMP);
glTexParameteri(GL_TEXTURE_CUBE_MAP_EXT,GL_TEXTURE _WRAP_T,GL_CLAMP);
LoadBMPff("earth.bmp");
glutSolidSphere(1,50,50);
}
what's wrong with my code?
Who can give me some example?

rgpc
10-23-2004, 03:42 AM
Recently I have noticed that the number of off topic posts has been increasing. It seems we get at least a couple a day now (posts completely unrelated to Opengl or posts that aren't advanced). What is it that is soooo hard to understand about the heading "OpenGL coding: advanced"? Is the word "coding" causing some sort of confusion?

And of course we get posts like "How to render a(n) earth or teaport with (a) texture?". A post so profound that the creators of 3d graphics are scrambling to find an answer to this question. John Carmack is probably cancelling all future development to find out how this can be done. People are pouring over the design of GPU's to see if they can somehow be made to perform this highly advanced function.

But the problem is they are given insufficient information. One of the things I hate the most about my line of work is that you almost always get a bug report that goes something like this:


It doesn't workSo no doubt, houdy, the answer to the question:


what's wrong with my code?Should be phrased as:


It doesn't workYour problem could be something dumb like the function "LoadBMPff("earth.bmp");" doesn't bind your texture (or even create it - HTF would we know this). But irrespective of what the problem is, people have been texturing objects for years now, using multiple techniques (including sphere mapping - go figure), so this is in no way an advanced question.

If you can't find any examples yourself using something google (http://www.goog.com) , nVidia (http://developer.nVidia.com) or ATI (http://www.ati.com) , then why would we bother finding them for you?

SirKnight
10-23-2004, 06:21 PM
Originally posted by rgpc:
Recently I have noticed that the number of off topic posts has been increasing. It seems we get at least a couple a day now (posts completely unrelated to Opengl or posts that aren't advanced). What is it that is soooo hard to understand about the heading "OpenGL coding: advanced"? Is the word "coding" causing some sort of confusion?
My thoughts exactly.


Originally posted by rgpc:

And of course we get posts like "How to render a(n) earth or teaport with (a) texture?". A post so profound that the creators of 3d graphics are scrambling to find an answer to this question. John Carmack is probably cancelling all future development to find out how this can be done. People are pouring over the design of GPU's to see if they can somehow be made to perform this highly advanced function.

LOL! :D

-SirKnight

SirKnight
10-23-2004, 06:23 PM
Oh and houdy, if you can't texture map an object how do you expect to do bump mapping as you requested in another post?

That's a thinker...

-SirKnight

gmeed
10-23-2004, 06:38 PM
Is there a way to flag stuff like this to request a moderator move it? Seems to be a lot of this stuff cluttering the place lately.

Alonso Schaich
10-23-2004, 10:46 PM
Originally posted by houdy:
This is my code, but it doesn't work.
void DrawEarth()
{
glEnable(GL_TEXTURE_2D);
glTexParameteri(GL_TEXTURE_CUBE_MAP_EXT,GL_TEXTURE _MIN_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_CUBE_MAP_EXT,GL_TEXTURE _MAG_FILTER,GL_LINEAR);
glEnable(GL_TEXTURE_GEN_S);
glEnable(GL_TEXTURE_GEN_T);
glTexGeni(GL_S,GL_TEXTURE_GEN_MODE,GL_SPHERE_MAP);
glTexGeni(GL_T,GL_TEXTURE_GEN_MODE,GL_SPHERE_MAP); glTexParameteri(GL_TEXTURE_CUBE_MAP_EXT,GL_TEXTURE _WRAP_S,GL_CLAMP);
glTexParameteri(GL_TEXTURE_CUBE_MAP_EXT,GL_TEXTURE _WRAP_T,GL_CLAMP);
LoadBMPff("earth.bmp");
glutSolidSphere(1,50,50);
}
what's wrong with my code?
Who can give me some example?Probably it's just wrong to `use` cube mapping to map a `normal` texture on a surface... for more if cubemapping wasn't even enabled...

knackered
10-25-2004, 12:50 AM
The problem is, and always has been, exagerated and accelerated by people complaining about posts being off-topic but then proceeding to answer the question because they just can't resist it. If you answer the question then more irrelevant questions will eventually descend on this forum, by word of mouth.

mpan3
10-25-2004, 12:14 PM
Holy Cow! Texture map? What's that?

...Must be some uber advanced technique to make "stuffs" look more real.