3 #include <GL/freeglut.h>
7 static unsigned int sdr_curve_top;
8 static unsigned int tex_xcircle;
10 static const unsigned char tex_xcircle_pixels[] = {
11 0, 64, 255, 255, 255, 255, 64, 0,
12 0, 64, 255, 255, 255, 255, 64, 0,
13 0, 64, 255, 255, 255, 255, 64, 0,
14 0, 64, 255, 255, 255, 255, 64, 0,
15 0, 64, 255, 255, 255, 255, 64, 0,
16 0, 64, 255, 255, 255, 255, 64, 0,
17 0, 64, 255, 255, 255, 255, 64, 0,
18 0, 64, 255, 255, 255, 255, 64, 0,
20 0, 64, 255, 255, 255, 255, 64, 0,
21 0, 0, 255, 255, 255, 255, 0, 0,
22 0, 0, 128, 255, 255, 128, 0, 0,
23 0, 0, 0, 64, 64, 0, 0, 0,
24 0, 0, 0, 0, 0, 0, 0, 0,
25 0, 0, 0, 0, 0, 0, 0, 0,
26 0, 0, 0, 0, 0, 0, 0, 0,
27 0, 0, 0, 0, 0, 0, 0, 0
33 if(!(sdr_curve_top = create_program_load("sdr/curve_top.v.glsl", "sdr/curve_top.f.glsl"))) {
37 glGenTextures(1, &tex_xcircle);
38 glBindTexture(GL_TEXTURE_2D, tex_xcircle);
39 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
40 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
41 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
42 glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, 8, 16, 0,
43 GL_LUMINANCE, GL_UNSIGNED_BYTE, tex_xcircle_pixels);
49 glDeleteTextures(1, &tex_xcircle);
50 free_program(sdr_curve_top);
57 glScalef(1.1, 3, 1.1);
58 glTranslatef(0, 0.5, 0);
62 glShadeModel(GL_FLAT);
66 glRotatef(90, 1, 0, 0);
67 glTranslatef(0, -0.15, 0);
68 glutSolidCylinder(2, 0.3, 16, 1);
73 glTranslatef(0, 3, 0);
74 glRotatef(22.5, 0, 1, 0);
75 glRotatef(-90, 1, 0, 0);
76 glutSolidCylinder(0.5, 1.0, 8, 1);
79 // trim middle cylinder (mporntoura)
81 glTranslatef(0, 3.9, 0);
82 glRotatef(22.5, 0, 1, 0);
83 glRotatef(-90, 1, 0, 0);
84 glutSolidCylinder(0.55, 0.02, 8, 1);
87 // top smaller cylinder
89 glTranslatef(0, 4, 0);
90 glRotatef(22.5, 0, 1, 0);
91 glRotatef(-90, 1, 0, 0);
92 glutSolidCylinder(0.28, 0.5, 8, 1);
95 // top wire even smaller cylinder
97 glTranslatef(0, 4.5, 0);
98 glRotatef(22.5, 0, 1, 0);
99 glRotatef(-90, 1, 0, 0);
100 glutWireCylinder(0.18, 0.3, 9, 3);
103 glShadeModel(GL_SMOOTH);
107 glTranslatef(0, 4.8, 0);
108 glRotatef(22.5, 0, 1, 0);
109 glRotatef(-90, 1, 0, 0);
110 glutSolidCone(0.18, 0.2, 9, 1);
115 glTranslatef(-0.28, 4, 0);
117 glutSolidSphere(0.1, 16, 16);
120 //pyramid on top of kormos
121 bind_program(sdr_curve_top);
124 glTranslatef(0, 3, 0);
125 glRotatef(45, 0, 1, 0);
126 glRotatef(-90, 1, 0, 0);
127 glScalef(1, 1, 0.45);
128 glutSolidCylinder(1, 1, 4, 16);
139 glTranslatef(0, -1.25, 0);
142 glutSolidSphere(10, 32, 32);
147 void xlogo(float sz, float alpha, float xcircle)
149 static const float xlogo_varr[] = {
150 -0.500, 0.407, -0.113, -0.109, 0.059, -0.006, -0.251, 0.407,
151 -0.113, -0.109, -0.499, -0.593, -0.410, -0.593, 0.059, -0.006,
152 -0.058, -0.182, 0.251, -0.593, 0.500, -0.593, 0.114, -0.079,
153 -0.058, -0.182, 0.114, -0.079, 0.500, 0.407, 0.411, 0.407
158 glGetFloatv(GL_MODELVIEW_MATRIX, mv);
159 mv[0] = mv[5] = mv[10] = sz;
160 mv[1] = mv[2] = mv[4] = mv[6] = mv[8] = mv[9] = 0.0f;
164 glTranslatef(0, 0.15, 0);
166 glPushAttrib(GL_ENABLE_BIT);
168 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
171 glColor4f(0, 0, 0, alpha);
172 const float *vptr = xlogo_varr;
173 for(int i=0; i<(int)(sizeof xlogo_varr / sizeof *xlogo_varr) / 2; i++) {
178 glTranslatef(0, -0.15, 0);
181 glEnable(GL_TEXTURE_2D);
182 glBindTexture(GL_TEXTURE_2D, tex_xcircle);
184 glDisable(GL_CULL_FACE);
185 glEnable(GL_ALPHA_TEST);
186 float aref = 1.0f - xcircle;
187 glAlphaFunc(GL_GREATER, aref > 0.0f ? aref : 0.0f);
191 #define XLOGO_CIRCLE_SEG 64
193 glBegin(GL_QUAD_STRIP);
194 for(int i=0; i<XLOGO_CIRCLE_SEG; i++) {
195 float t = (float)i / (float)(XLOGO_CIRCLE_SEG - 1);
196 float tcol = fmod(t + 0.075f, 1.0f);
198 float theta = t * M_PI * 2.0f;
200 float width = 0.05f * tcol;
201 float z = -cos(theta) * 0.1;
203 glColor4f(0.9, 0.9, 0.9, tcol);
204 glTexCoord2f(0, 1.0f - tcol);
205 glVertex3f(sin(theta) * (rad + width), cos(theta) * (rad + width), z);
206 glTexCoord2f(1, 1.0f - tcol);
207 glVertex3f(sin(theta) * (rad - width), cos(theta) * (rad - width), z);