~ubuntu-branches/debian/sid/xscreensaver/sid

« back to all changes in this revision

Viewing changes to hacks/glx/pipes.c

  • Committer: Bazaar Package Importer
  • Author(s): Jose Luis Rivas, Tormod Volden, Jose Luis Rivas
  • Date: 2008-07-15 14:48:48 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20080715144848-c6c6mhyxij0dk2p7
Tags: 5.05-3
[ Tormod Volden ]
* debian/patches/10_jwz-xscreensaver-randr-patch-3.patch:
  from upstream, addresses issues with xrandr/xinerama
  (Closes: #482385, #428797, #471920, #453708, #473681, #479715, #480231)
* fixed typo "screen < real_nscreens" in driver/lock:1527 from above patch
* drop 61_DualHead-nVidia_bug471920.patch (obsolete)
* drop 67_XineRama-mode_bug473681.patch (obsolete)
* fix m6502.o typo in hacks/Makefile.in
* refresh 53_XScreenSaver.ad.in.patch
* refresh (disabled) 60_add-ant-hack.patch

[ Jose Luis Rivas ]
* add xscreensaver-demo desktop file, thanks to Daniel Dickinson
  (Closes: #480592)
* update package descriptions (thanks jwz)
* fix categories in xscreensaver.menu
* change build-deps from xlibmesa-gl-dev to libgl1-mesa-dev,
  xutils to xutils-dev, x-dev to x11proto-core-dev.
* bump Standards-Version to 3.8.0
* add Vcs fields and Homepage to debian/control
* Flurry is not installed until the bug get fixed (Closes: #484112)

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
 */
44
44
 
45
45
#ifdef STANDALONE
46
 
# define PROGCLASS                                      "Pipes"
47
 
# define HACK_INIT                                      init_pipes
48
 
# define HACK_DRAW                                      draw_pipes
49
 
# define HACK_RESHAPE                           reshape_pipes
50
 
# define pipes_opts                                     xlockmore_opts
51
46
# define DEFAULTS       "*delay:                10000   \n"                     \
52
47
                                        "*count:                2       \n"                     \
53
48
                                        "*cycles:               5       \n"                     \
54
49
                                        "*size:                 500     \n"                     \
55
50
                        "*showFPS:      False   \n"                 \
56
 
                        "*fpsSolid:     True    \n"                 \
57
 
 
 
51
                        "*fpsSolid:     True    \n"
 
52
# define refresh_pipes 0
 
53
# define pipes_handle_event 0
58
54
# include "xlockmore.h"                         /* from the xscreensaver distribution */
59
55
#else  /* !STANDALONE */
60
56
# include "xlock.h"                                     /* from the xlockmore distribution */
62
58
 
63
59
#ifdef USE_GL
64
60
 
65
 
#include <GL/glu.h>
66
61
#include "buildlwo.h"
67
62
 
68
63
#define DEF_FACTORY     "2"
105
100
        {"-/+db", "turn on/off double buffering"}
106
101
};
107
102
 
108
 
ModeSpecOpt pipes_opts =
 
103
ENTRYPOINT ModeSpecOpt pipes_opts =
109
104
{sizeof opts / sizeof opts[0], opts, sizeof vars / sizeof vars[0], vars, desc};
110
105
 
111
106
#ifdef USE_MODULES
155
150
        int         system_length;
156
151
        int         turncounter;
157
152
        Window      window;
158
 
        float      *system_color;
 
153
        const float *system_color;
159
154
        GLfloat     initial_rotation;
160
155
        GLuint      valve, bolts, betweenbolts, elbowbolts, elbowcoins;
161
156
        GLuint      guagehead, guageface, guagedial, guageconnector;
 
157
    int         reset;
162
158
        GLXContext *glx_context;
163
159
} pipesstruct;
164
160
 
166
162
extern struct lwo LWO_GuageHead, LWO_GuageFace, LWO_GuageDial, LWO_GuageConnector;
167
163
extern struct lwo LWO_ElbowBolts, LWO_ElbowCoins;
168
164
 
169
 
static float front_shininess[] =
170
 
{60.0};
171
 
static float front_specular[] =
172
 
{0.7, 0.7, 0.7, 1.0};
173
 
static float ambient0[] =
174
 
{0.4, 0.4, 0.4, 1.0};
175
 
static float diffuse0[] =
176
 
{1.0, 1.0, 1.0, 1.0};
177
 
static float ambient1[] =
178
 
{0.2, 0.2, 0.2, 1.0};
179
 
static float diffuse1[] =
180
 
{0.5, 0.5, 0.5, 1.0};
181
 
static float position0[] =
182
 
{1.0, 1.0, 1.0, 0.0};
183
 
static float position1[] =
184
 
{-1.0, -1.0, 1.0, 0.0};
185
 
static float lmodel_ambient[] =
186
 
{0.5, 0.5, 0.5, 1.0};
187
 
static float lmodel_twoside[] =
188
 
{GL_TRUE};
 
165
static const float front_shininess[] = {60.0};
 
166
static const float front_specular[] = {0.7, 0.7, 0.7, 1.0};
 
167
static const float ambient0[] = {0.4, 0.4, 0.4, 1.0};
 
168
static const float diffuse0[] = {1.0, 1.0, 1.0, 1.0};
 
169
static const float ambient1[] = {0.2, 0.2, 0.2, 1.0};
 
170
static const float diffuse1[] = {0.5, 0.5, 0.5, 1.0};
 
171
static const float position0[] = {1.0, 1.0, 1.0, 0.0};
 
172
static const float position1[] = {-1.0, -1.0, 1.0, 0.0};
 
173
static const float lmodel_ambient[] = {0.5, 0.5, 0.5, 1.0};
 
174
static const float lmodel_twoside[] = {GL_TRUE};
189
175
 
190
 
static float MaterialRed[] =
191
 
{0.7, 0.0, 0.0, 1.0};
192
 
static float MaterialGreen[] =
193
 
{0.1, 0.5, 0.2, 1.0};
194
 
static float MaterialBlue[] =
195
 
{0.0, 0.0, 0.7, 1.0};
196
 
static float MaterialCyan[] =
197
 
{0.2, 0.5, 0.7, 1.0};
198
 
static float MaterialYellow[] =
199
 
{0.7, 0.7, 0.0, 1.0};
200
 
static float MaterialMagenta[] =
201
 
{0.6, 0.2, 0.5, 1.0};
202
 
static float MaterialWhite[] =
203
 
{0.7, 0.7, 0.7, 1.0};
204
 
static float MaterialGray[] =
205
 
{0.2, 0.2, 0.2, 1.0};
 
176
static const float MaterialRed[] = {0.7, 0.0, 0.0, 1.0};
 
177
static const float MaterialGreen[] = {0.1, 0.5, 0.2, 1.0};
 
178
static const float MaterialBlue[] = {0.0, 0.0, 0.7, 1.0};
 
179
static const float MaterialCyan[] = {0.2, 0.5, 0.7, 1.0};
 
180
static const float MaterialYellow[] = {0.7, 0.7, 0.0, 1.0};
 
181
static const float MaterialMagenta[] = {0.6, 0.2, 0.5, 1.0};
 
182
static const float MaterialWhite[] = {0.7, 0.7, 0.7, 1.0};
 
183
static const float MaterialGray[] = {0.2, 0.2, 0.2, 1.0};
206
184
 
207
185
static pipesstruct *pipes = NULL;
208
186
 
497
475
        }
498
476
}
499
477
 
500
 
void
501
 
reshape_pipes(ModeInfo * mi, int width, int height)
502
 
{
503
 
        pipesstruct *pp = &pipes[MI_SCREEN(mi)];
504
 
 
505
 
        glViewport(0, 0, pp->WindW = (GLint) width, pp->WindH = (GLint) height);
506
 
        glMatrixMode(GL_PROJECTION);
507
 
        glLoadIdentity();
508
 
        /*glFrustum(-1.0, 1.0, -1.0, 1.0, 5.0, 15.0); */
509
 
        gluPerspective(65.0, (GLfloat) width / (GLfloat) height, 0.1, 20.0);
510
 
        glMatrixMode(GL_MODELVIEW);
511
 
 
512
 
  glClear(GL_COLOR_BUFFER_BIT);
513
 
}
514
 
 
515
478
static void
516
479
pinit(ModeInfo * mi, int zera)
517
480
{
631
594
        pp->nowdir = SelectNeighbor(mi);
632
595
}
633
596
 
634
 
void
635
 
init_pipes(ModeInfo * mi)
 
597
ENTRYPOINT void
 
598
reshape_pipes(ModeInfo * mi, int width, int height)
 
599
{
 
600
        pipesstruct *pp = &pipes[MI_SCREEN(mi)];
 
601
    pinit(mi, 1);
 
602
 
 
603
        glViewport(0, 0, pp->WindW = (GLint) width, pp->WindH = (GLint) height);
 
604
        glMatrixMode(GL_PROJECTION);
 
605
        glLoadIdentity();
 
606
        /*glFrustum(-1.0, 1.0, -1.0, 1.0, 5.0, 15.0); */
 
607
        gluPerspective(65.0, (GLfloat) width / (GLfloat) height, 0.1, 20.0);
 
608
        glMatrixMode(GL_MODELVIEW);
 
609
 
 
610
  glClear(GL_COLOR_BUFFER_BIT);
 
611
}
 
612
 
 
613
ENTRYPOINT void
 
614
init_pipes (ModeInfo * mi)
636
615
{
637
616
        int         screen = MI_SCREEN(mi);
638
617
        pipesstruct *pp;
693
672
        }
694
673
}
695
674
 
696
 
void
697
 
draw_pipes(ModeInfo * mi)
 
675
ENTRYPOINT void
 
676
draw_pipes (ModeInfo * mi)
698
677
{
699
678
        pipesstruct *pp = &pipes[MI_SCREEN(mi)];
700
679
 
707
686
        if (!pp->glx_context)
708
687
                return;
709
688
 
 
689
        glXMakeCurrent(MI_DISPLAY(mi), MI_WINDOW(mi), *(pp->glx_context));
 
690
 
 
691
    if (pp->reset) {
 
692
      if (--pp->reset) {
 
693
        /* Would be nice to fade to black here, by drawing successive quads
 
694
           over the whole scene with gamma. */
 
695
        return;
 
696
      }
 
697
      pinit(mi, 1);
 
698
    }
 
699
 
710
700
        glPushMatrix();
711
701
 
712
702
        glTranslatef(0.0, 0.0, fisheye ? -3.8 : -4.8);
743
733
                /* If the maximum number of system was drawn, restart (clearing the screen), */
744
734
                /* else start a new system. */
745
735
                if (++pp->system_number > pp->number_of_systems) {
746
 
          if (!mi->fps_p)
747
 
            sleep(1);
748
 
                        pinit(mi, 1);
 
736
          /* pause doing nothing for N seconds before clearing the screen. */
 
737
          int secs = 3;
 
738
          pp->reset = secs * 1000000 / MI_PAUSE(mi);
749
739
                } else {
750
740
                        pinit(mi, 0);
751
741
                }
980
970
    if (mi->fps_p) do_fps (mi);
981
971
}
982
972
 
983
 
void
984
 
change_pipes(ModeInfo * mi)
 
973
#ifndef STANDALONE
 
974
ENTRYPOINT void
 
975
change_pipes (ModeInfo * mi)
985
976
{
986
977
        pipesstruct *pp = &pipes[MI_SCREEN(mi)];
987
978
 
991
982
        glXMakeCurrent(MI_DISPLAY(mi), MI_WINDOW(mi), *(pp->glx_context));
992
983
        pinit(mi, 1);
993
984
}
994
 
 
995
 
void
996
 
release_pipes(ModeInfo * mi)
 
985
#endif /* !STANDALONE */
 
986
 
 
987
 
 
988
ENTRYPOINT void
 
989
release_pipes (ModeInfo * mi)
997
990
{
998
991
        if (pipes != NULL) {
999
992
                int         screen;
1035
1028
        FreeAllGL(mi);
1036
1029
}
1037
1030
 
 
1031
XSCREENSAVER_MODULE ("Pipes", pipes)
 
1032
 
1038
1033
#endif