Applying texture to sphere turns it blue

Thread Solved

Join Date: Jan 2008
Posts: 79
Reputation: orangejuice2005 is an unknown quantity at this point 
Solved Threads: 0
orangejuice2005 orangejuice2005 is offline Offline
Junior Poster in Training

Applying texture to sphere turns it blue

 
0
  #1
Jul 5th, 2009
Hello. I've been messing around with applying textures and i managed to apply one with no hiccups. By subsequent attempts , however, keeps turning my spheres blue! I don't know what to do.

I'm attaching what i've done so far because it's kind of long. If anyone can help me i would really appreciate it.
Attached Files
File Type: cpp Solar System.cpp (13.3 KB, 4 views)
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 830
Reputation: wildgoose is a name known to all wildgoose is a name known to all wildgoose is a name known to all wildgoose is a name known to all wildgoose is a name known to all wildgoose is a name known to all 
Solved Threads: 94
wildgoose's Avatar
wildgoose wildgoose is offline Offline
Practically a Posting Shark

Re: Applying texture to sphere turns it blue

 
0
  #2
Jul 6th, 2009
You may want to mention it is OpenGL.
I cut in my own textures and Kind of cool, but I only see one blue planet.

Adding your textures would be cool. If you're worried about copy cats, Put a big X or something on your textures so that they still look about right, though contaminated with debris!


In my code I typically have the following Render...

  1. cgGLSetTextureParameter( cg_BlinnTexture, iTex );
  2.  
  3. cgGLEnableTextureParameter( cg_BlinnTexture );
  4. glEnable( GL_TEXTURE_2D );
  5. glBindTexture(GL_TEXTURE_2D, iTex);
  6.  
  7. glEnableClientState( GL_TEXTURE_COORD_ARRAY );
  8. glTexCoordPointer( 2, GL_FLOAT, 0, pUVAry );
  9.  
  10. // other vertex information then draw
  11.  
  12. glDisableClientState( GL_TEXTURE_COORD_ARRAY );
  13.  
  14. glBindTexture(GL_TEXTURE_2D, 0); // not necessary but I include it anyway!
  15. gllDisable( GL_TEXTURE_2D );
  16.  
  17. cgGLDisableTextureParameter( cg_BlinnTexture );
Last edited by wildgoose; Jul 6th, 2009 at 3:13 am. Reason: addendum
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 79
Reputation: orangejuice2005 is an unknown quantity at this point 
Solved Threads: 0
orangejuice2005 orangejuice2005 is offline Offline
Junior Poster in Training

Re: Applying texture to sphere turns it blue

 
0
  #3
Jul 6th, 2009
Hey wildgoose! Thanks for replying. I did forget to say it was in opengl but you were smart enough to realize that it was =). I can upload the textures..its no big deal. They aren't personally made so i don't care. The only planet that should be remotely blue is the last one in the outer ring. The ones with the textures are orginallt colored white but when i apply the textures, they turn blue for some weird reason. Your render code looks similiar to mines minus a few different function calls.
Last edited by orangejuice2005; Jul 6th, 2009 at 3:54 am.
Attached Images
File Type: bmp mercury1.bmp (16.8 KB, 7 views)
File Type: bmp earth2.bmp (29.3 KB, 6 views)
File Type: bmp venus1.bmp (58.6 KB, 4 views)
File Type: bmp mars1.bmp (29.3 KB, 5 views)
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 830
Reputation: wildgoose is a name known to all wildgoose is a name known to all wildgoose is a name known to all wildgoose is a name known to all wildgoose is a name known to all wildgoose is a name known to all 
Solved Threads: 94
wildgoose's Avatar
wildgoose wildgoose is offline Offline
Practically a Posting Shark

Re: Applying texture to sphere turns it blue

 
0
  #4
Jul 6th, 2009
Big possible problem.\
Your textures are not 2^N, and not all square.
Some video cards require square, but most definitely 2^N, with few exceptions. Try stretching the bitmap to 128x128, etc.
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 79
Reputation: orangejuice2005 is an unknown quantity at this point 
Solved Threads: 0
orangejuice2005 orangejuice2005 is offline Offline
Junior Poster in Training

Re: Applying texture to sphere turns it blue

 
0
  #5
Jul 6th, 2009
Yes your right! Theres something definately wrong with the pictures here. I tried mapping the earth texture to another planet and it turned out ok. I' just tried changing the aspect ratio to what you recommended but that doesn't seem to be fixing the problem. I'll need to tinker with this in the morning or maybe get a different picture or resize it using a different program.
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 79
Reputation: orangejuice2005 is an unknown quantity at this point 
Solved Threads: 0
orangejuice2005 orangejuice2005 is offline Offline
Junior Poster in Training

Re: Applying texture to sphere turns it blue

 
0
  #6
Jul 6th, 2009
I'm using images that adhere to that 2^N rule but am still getting the same problem. I do not believe this to be a power-of-2 issue or problem loading a texture that is beyond what my opengl implementation can do. I've also tried converting the images to .raw format to see if that changed anything but i just ended up with image distortions and you literally can't make anything out.
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 830
Reputation: wildgoose is a name known to all wildgoose is a name known to all wildgoose is a name known to all wildgoose is a name known to all wildgoose is a name known to all wildgoose is a name known to all 
Solved Threads: 94
wildgoose's Avatar
wildgoose wildgoose is offline Offline
Practically a Posting Shark

Re: Applying texture to sphere turns it blue

 
0
  #7
Jul 6th, 2009
I can't examine your code right now, but have you tried increasing your radius to 4.0 or so, stopped the orbits, and rotated in place to see your planets better?
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 830
Reputation: wildgoose is a name known to all wildgoose is a name known to all wildgoose is a name known to all wildgoose is a name known to all wildgoose is a name known to all wildgoose is a name known to all 
Solved Threads: 94
wildgoose's Avatar
wildgoose wildgoose is offline Offline
Practically a Posting Shark

Re: Applying texture to sphere turns it blue

 
0
  #8
Jul 6th, 2009
I normally don't use the glQuad stuff. I use my own meshes, even for sphere's.
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 79
Reputation: orangejuice2005 is an unknown quantity at this point 
Solved Threads: 0
orangejuice2005 orangejuice2005 is offline Offline
Junior Poster in Training

Re: Applying texture to sphere turns it blue

 
0
  #9
Jul 7th, 2009
Originally Posted by wildgoose View Post
I can't examine your code right now, but have you tried increasing your radius to 4.0 or so, stopped the orbits, and rotated in place to see your planets better?
Have i tried inceasing what radius to 4.0?

Originally Posted by wildgoose
I normally don't use the glQuad stuff. I use my own meshes, even for sphere's.
I am not that good with opengl so i like to use and tinker with already built in functions
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 830
Reputation: wildgoose is a name known to all wildgoose is a name known to all wildgoose is a name known to all wildgoose is a name known to all wildgoose is a name known to all wildgoose is a name known to all 
Solved Threads: 94
wildgoose's Avatar
wildgoose wildgoose is offline Offline
Practically a Posting Shark

Re: Applying texture to sphere turns it blue

 
0
  #10
Jul 7th, 2009
The planets. They're pretty small to make out on screen and making them larger for testing purposes, and making them stationary infront of the viewport.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Game Development Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC