Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (408)
games submitted by our members
Games in WIP (293)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  gluSphere with texture, result is reversed texture.  (Read 1308 times)
0 Members and 1 Guest are viewing this topic.
Offline Addictman

Senior Member


Medals: 3
Projects: 1


Java games rock!


« Posted 2007-09-02 17:40:17 »

Hi.

I am creating some planets. I am using some images of our dear planet as textures, and using gluSphere to render the planet. However, the result is a "reversed" earth. Not vertically, so that the north pole is the south pole and vice versa. Rather, it's flipped horisontally, so that the earth appears "backwards" for lack of a better word. Now, my other textures (stars & background, - simple textured quads) work as they should. It is only a problem (at least so far), when using gluSphere.

I am not doing anything really special, so I am hoping someone has witnessed this before, and know what I am doing wrong?

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
gl.glPushMatrix();
         
         gl.glTranslatef(xpos, ypos, -1);
         
         
         // get a nice orbital angle.
        gl.glRotatef(45.0f, 0.0f, 1.0f, 0.0f);
         gl.glRotatef(20.0f, 1.0f, 0.0f, 0.0f);
         // set orbit radius
        gl.glTranslatef(orbitRadius, 0.0f, 0.0f);
         
         // textures don't map properly for planets.
        // Rotate a bit so the planets appear correct.
        gl.glRotatef(-90.0f, 1.0f, 0.0f, 0.0f);
         gl.glRotated(-rotationAngle, 0.0f, 0.0f, 1.0f);
         
         // bind the texture.
        planetTextures.get(textureRef).bind();
         
         glu.gluSphere(gluq, planetRadius, planetDetailLevel, planetDetailLevel);
         gl.glPopMatrix();
         
         rotationAngle += rotationSpeed;
Offline Addictman

Senior Member


Medals: 3
Projects: 1


Java games rock!


« Reply #1 - Posted 2007-09-06 22:41:11 »

Hi, I see noone answered to this. I guess I am lost Wink

In addition to the problem mentioned before, it seems that textures do not blend properly when rendered infront of these spheres. I have png images that are partially transparent (Parts of the image have alpha 0). The parts that are completely transparent appear as they are supposed to, transparent, when drawn in front of other quads, triangles, etc. But when they are drawn in front of these spheres, the transparent parts are black.

It is annoying. Hopefully this additional information will bring someone to write what they think could be the problem.

Thanks.
Offline lhkbob

JGO Knight


Medals: 32



« Reply #2 - Posted 2007-09-07 17:07:32 »

The simplest cause of your problem with the texturing could just be that that's how gluSphere defines the texture coordinates.  If you find you still need to rotate things 90 degrees, it would be better to do that step using the texture matrix stack, just to keep things organized and clear.  Transparency is somewhat complicated and even if something is transparent, the end result can be greatly affected by the order in which things are rendered and by the blend mode and function.  I would look into the redbook for more information about that.

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars and Titan!

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
cubemaster21 (101 views)
2013-05-17 21:29:12

alaslipknot (109 views)
2013-05-16 21:24:48

gouessej (139 views)
2013-05-16 00:53:38

gouessej (134 views)
2013-05-16 00:17:58

theagentd (146 views)
2013-05-15 15:01:13

theagentd (132 views)
2013-05-15 15:00:54

StreetDoggy (175 views)
2013-05-14 15:56:26

kutucuk (197 views)
2013-05-12 17:10:36

kutucuk (199 views)
2013-05-12 15:36:09

UnluckyDevil (205 views)
2013-05-12 05:09:57
Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38

Java Data structures
by Roquen
2013-03-29 13:21:12

Topic Request
by kutucuk
2013-03-22 21:42:01
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!
Page created in 0.24 seconds with 21 queries.