PDA

View Full Version : Adding bmp image to gluSphere as texture



MrFuzzums
06-30-2009, 01:31 PM
Can someone please explain how to add one simple texture to gluSphere in c++. I googled everywhere and i couldnt find it anywhere. Since I am a newbie explain step by step please...

dletozeun
06-30-2009, 02:08 PM
I am not sure that glu library generates valid texture coordinates with the sphere mesh. You might have to create your own sphere with texture coordinates, it is not that hard.

For texture mapping, check this out:
http://www.opengl.org/wiki/Texture_Mapping

MaxH
06-30-2009, 03:15 PM
Can someone please explain how to add one simple texture to gluSphere in c++. I googled everywhere and i couldnt find it anywhere. Since I am a newbie explain step by step please...
I posted some code that does exactly what you are asking a while ago. It even includes the routines that load the .bmp file. A call to gluQuadricTexture is necessary to assign texture coordinates to the sphere. I think you'll find that the code, some experimentation, and the 'OpenGL Reference Manual' are all you need in the way of 'explanation'.

The source code and associated image files are at:

OpenGL Texture & Image Loading (.bmp format) (http://www.mfwweb.com/OpenGL/Loading_Textures/)

Good luck.

MrFuzzums
06-30-2009, 05:13 PM
Thank you very much I will try everything you suggested and post back a reply

Cheers

MrFuzzums
07-01-2009, 10:30 AM
I am abviously dumb becouse nothing worked dam!
@dletozeun:
can you explain how to draw my own sphere with texture coordinates?
Some source code would realy help

Thanks in advance

MaxH
07-01-2009, 10:47 AM
Basic question - Do you know how to compile, link, and execute a c or cpp program on your system? If you not, you are in over your head trying to do OpenGL. If so, all the files necessary to render a textured gluSphere (including the source) are included in the directory referenced in my previous post. All you have to do is copy these files onto a folder on your system, then compile, link (to Glut and Glu), and execute.

MrFuzzums
07-01-2009, 12:03 PM
It works it works jeeeeeee! The bloody problem was that stupid picture wouldnt load becouse of some realy strange reason, after 34h I rememberd that I can debug :) Thank you for your help very much! Btw I solved the problem in a totaly different way, I can post source if you like :)

Ravikishore
11-29-2009, 11:14 PM
Hi,

i am phasing the same problem, i am new to openGL.
is it possible to display the code..

please guide me..waiting for your reply..