Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (757)
Games in Android Showcase (229)
games submitted by our members
Games in WIP (844)
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 2403 times)
0 Members and 1 Guest are viewing this topic.
Offline Addictman

Senior Devvie

Medals: 3
Projects: 1

Java games rock!

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


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?

         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.
         glu.gluSphere(gluq, planetRadius, planetDetailLevel, planetDetailLevel);
         rotationAngle += rotationSpeed;
Offline Addictman

Senior Devvie

Medals: 3
Projects: 1

Java games rock!

« Reply #1 - Posted 2007-09-06 20: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.

Offline lhkbob

JGO Knight

Medals: 32

« Reply #2 - Posted 2007-09-07 15: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  

EgonOlsen (58 views)
2018-06-10 19:43:48

EgonOlsen (40 views)
2018-06-10 19:43:44

EgonOlsen (60 views)
2018-06-10 19:43:20

DesertCoockie (225 views)
2018-05-13 18:23:11

nelsongames (141 views)
2018-04-24 18:15:36

nelsongames (140 views)
2018-04-24 18:14:32

ivj94 (882 views)
2018-03-24 14:47:39

ivj94 (143 views)
2018-03-24 14:46:31

ivj94 (794 views)
2018-03-24 14:43:53

Solater (158 views)
2018-03-17 05:04:08
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05 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‑
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!