[gameprogrammer] Re: Sky in OpenGL

  • From: Sami NÃÃtÃnen <sn.ml@xxxxxxxxxxxx>
  • To: gameprogrammer@xxxxxxxxxxxxx
  • Date: Thu, 17 Nov 2005 09:34:36 +0200

On Wednesday 16 November 2005 10:30, Alan Wolfe wrote:
> make the sphere smaller then, the result should be the same :P
>
> have you tried that?

One way would be to make the sphere so small that it fits in the clip 
region, but this has disavantage. You have to render the sky first 
without Z-buffer writes, which means multiple drawing of pixels. But 
one can draw the sky and then do some calculations etc before rendering 
the rest of the scene, so this might be in fact good solution.

Other one is to use larger cliparea for the sky sphere.

The best solution of course depends from the goals of the game.

> On 11/16/05, Stephen <gp@xxxxxxxxxxxxxxxxxxxxxxxx> wrote:
> > Sorry, I spoke too soon - it doesn't work for me, but probably cos
> > I'm doing something wrong.
> >
> > I'm setting up the openGL with this:
> > glu.gluPerspective(45f, height_ratio, 0.1, 30f);
> >
> > Then I loop through all the objects, which all draw okay, and then
> > the sky:-
> > gl.glDisable(GL.GL_DEPTH_TEST);
> > glu.gluSphere(Canvas3D.quadratic, DIAMETER, 24, 24);
> > gl.glEnable(GL.GL_DEPTH_TEST);
> >
> > If I increase the 30f in the perspective command, it draws the sky.
> > But at the moment it doesn't, even with the disabling of the depth
> > test. BTW, I'm using Java and JOGL. Any help much appreciated!
> >
> > Thanks in advance,
> >
> > Steve.
> >
> > Stephane Marchesin wrote:
> > > Stephen wrote:
> > >> I'm having trouble working out what to do about how I implement
> > >> a sky in my OpenGL game. I originally surrounded the game world
> > >> with a massive sphere, and drew the image onto the inside, and
> > >> it worked well (especially when I rotated it). However, I've now
> > >> set the maximum view distance to be something more sensible, so
> > >> OpenGL doesn't try to draw everything in the distance. However,
> > >> this obviously means that the sky sphere now doesn't get drawn.
> > >> How do other games get round this? I can't think of another way
> > >> that would still produce a realistic looking sky.
> > >
> > > glDisable(GL_DEPTH_TEST);
> > > render_sky();
> > > glEnable(GL_DEPTH_TEST);
> > >
> > > Stephane
> > >
> > >
> > >
> > >
> > > ---------------------
> > > To unsubscribe go to http://gameprogrammer.com/mailinglist.html
> >
> > ---------------------
> > To unsubscribe go to http://gameprogrammer.com/mailinglist.html


---------------------
To unsubscribe go to http://gameprogrammer.com/mailinglist.html


Other related posts: