Java-Gaming.org    
Featured games (78)
games approved by the League of Dukes
Games in Showcase (426)
Games in Android Showcase (89)
games submitted by our members
Games in WIP (466)
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 1513 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.

 

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

The first screenshot will be displayed as a thumbnail.

xsi3rr4x (75 views)
2014-04-15 18:08:23

BurntPizza (68 views)
2014-04-15 03:46:01

UprightPath (80 views)
2014-04-14 17:39:50

UprightPath (65 views)
2014-04-14 17:35:47

Porlus (81 views)
2014-04-14 15:48:38

tom_mai78101 (105 views)
2014-04-10 04:04:31

BurntPizza (165 views)
2014-04-08 23:06:04

tom_mai78101 (261 views)
2014-04-05 13:34:39

trollwarrior1 (210 views)
2014-04-04 12:06:45

CJLetsGame (220 views)
2014-04-01 02:16:10
List of Learning Resources
by SHC
2014-04-18 03:17:39

List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
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!