Download document (10.35 MB) - Escuela Superior de Informática ...
Download document (10.35 MB) - Escuela Superior de Informática ... Download document (10.35 MB) - Escuela Superior de Informática ...
152 Capítulo D. Código fuente233 int i;234 int frameactual;235236 if (ficheroMARCAS!=NULL) {237238 /* Localizamos los widgets que vamos a usar... */239 hscale_frame = glade_xml_get_widget (gxml, "hscale_frame");240 frameactual = (int) gtk_range_get_value (GTK_RANGE (hscale_frame));241242 glClearColor( .0f, .0f, .0f, 1.0f );243244 glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );245246 /* Ajustamos la matriz del mundo */247 calculaVistaModelo();248249 // Pintamos la caja250 dibujaCaja();251252253 if(posicion3D == VISTA_BRAZOS)254 {255 // Pintamos las marcas256 glEnable(GL_LIGHTING);257 for (i=0; i
D.2. Código fuente de los módulos más relevantes. 153293 }294 }295296 /*******************************************************************297 * Funcion: iniciar_gl298 * Descripcion: Inicializa los parametros relacionados con el widget299 * de OpenGL300 * Entradas: widget --> Puntero al widget GtkGlExt301 * data --> Puntero con los datos de los como parametros302 * Salidas: Ninguna.303 ********************************************************************/304 void iniciar_gl (GtkWidget *widget, gpointer data) {305306 caracter = 0;307 GdkGLContext *glcontext = gtk_widget_get_gl_context (widget);308 GdkGLDrawable *gldrawable = gtk_widget_get_gl_drawable (widget);309310 static GLfloat light0_ambient[] = {0.2f, 0.2f, 0.2f, 1.0f};311 static GLfloat light0_diffuse[] = {.8f, .8f, 0.8f, 1.0f};312 static GLfloat light0_position[] = {1.0f, 1.0f, 1.0f, 0.0f};313314 /* Comienza la parte de OpenGL... */315 if (!gdk_gl_drawable_gl_begin (gldrawable, glcontext)){316 g_print ("*** ERROR: Problem with init GL\n");317 return;318 }319320 glEnable(GL_LIGHTING);321 glEnable(GL_LIGHT0);322323 glLightfv(GL_LIGHT0, GL_AMBIENT, light0_ambient);324 glLightfv(GL_LIGHT0, GL_DIFFUSE, light0_diffuse);325 glLightfv(GL_LIGHT0, GL_POSITION, light0_position);326327 /* Activamos el zbuffer */328 glEnable(GL_DEPTH_TEST);329 glDepthFunc(GL_LEQUAL); /* Tipo de test de profundidad */330 glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);331332 glEnable(GL_COLOR_MATERIAL);333 glColorMaterial (GL_FRONT, GL_AMBIENT_AND_DIFFUSE);334335 gdk_gl_drawable_gl_end (gldrawable);336 }337338 /*******************************************************************339 * Funcion: reescalar_gl340 * Descripcion: Manejador del evento de reescalado del Widget341 * Entradas: widget --> Puntero al widget GtkGlExt342 * event --> Puntero con caracteristicas del evento343 * data --> Puntero con los datos de los parametros344 * Salidas: Devuelve TRUE si no se produjo error.345 *******************************************************************/346 gboolean reescalar_gl (GtkWidget *widget, GdkEventConfigure *event,347 gpointer data)348 {349 GdkGLContext *glcontext = gtk_widget_get_gl_context (widget);350 GdkGLDrawable *gldrawable = gtk_widget_get_gl_drawable (widget);351352 gdk_gl_drawable_gl_begin (gldrawable, glcontext);
- Page 126 and 127: 102 Capítulo 4. Metodología de Tr
- Page 128 and 129: 104 Capítulo 4. Metodología de Tr
- Page 130 and 131: 106 Capítulo 4. Metodología de Tr
- Page 132 and 133: 108 Capítulo 4. Metodología de Tr
- Page 134 and 135: 110 Capítulo 4. Metodología de Tr
- Page 136 and 137: 112 Capítulo 4. Metodología de Tr
- Page 138 and 139: 114 Capítulo 5. ResultadosTodas la
- Page 140 and 141: 116 Capítulo 5. ResultadosVídeos
- Page 142 and 143: 118 Capítulo 5. Resultados5.2. Res
- Page 144 and 145: 120 Capítulo 5. Resultados• Boca
- Page 146 and 147: 122 Capítulo 5. ResultadosVídeos
- Page 148 and 149: 124 Capítulo 6. Conclusiones y Pro
- Page 150 and 151: 126 Capítulo 6. Conclusiones y Pro
- Page 152 and 153: 128 Capítulo 6. Conclusiones y Pro
- Page 154 and 155: 130 Capítulo 6. Conclusiones y Pro
- Page 156 and 157: 132 Capítulo 6. Conclusiones y Pro
- Page 158 and 159: 134 Capítulo A. DiagramasUSERcallb
- Page 160 and 161: 136 Capítulo B. Manual de usuarioF
- Page 162 and 163: 138 Capítulo B. Manual de usuarioM
- Page 164 and 165: 140 Capítulo B. Manual de usuarioL
- Page 166 and 167: 142 Capítulo B. Manual de usuarioP
- Page 168 and 169: 144 Capítulo C. Manual de Instalac
- Page 170 and 171: 146 Capítulo D. Código fuente/src
- Page 172 and 173: 148 Capítulo D. Código fuente77 i
- Page 174 and 175: 150 Capítulo D. Código fuente113
- Page 178 and 179: 154 Capítulo D. Código fuente3533
- Page 180 and 181: 156 Capítulo D. Código fuente473
- Page 182 and 183: 158 Capítulo D. Código fuente593
- Page 184 and 185: 160 Capítulo D. Código fuente713
- Page 186 and 187: 162 Capítulo D. Código fuente833
- Page 188 and 189: 164 Capítulo D. Código fuente43 /
- Page 190 and 191: 166 Capítulo D. Código fuente163
- Page 192 and 193: 168 Capítulo D. Código fuente7 *
- Page 194 and 195: 170 Capítulo D. Código fuente124
- Page 196 and 197: 172 BIBLIOGRAFÍA[17] OpenGL Archit
D.2. Código fuente <strong>de</strong> los módulos más relevantes. 153293 }294 }295296 /*******************************************************************297 * Funcion: iniciar_gl298 * Descripcion: Inicializa los parametros relacionados con el widget299 * <strong>de</strong> OpenGL300 * Entradas: widget --> Puntero al widget GtkGlExt301 * data --> Puntero con los datos <strong>de</strong> los como parametros302 * Salidas: Ninguna.303 ********************************************************************/304 void iniciar_gl (GtkWidget *widget, gpointer data) {305306 caracter = 0;307 GdkGLContext *glcontext = gtk_widget_get_gl_context (widget);308 GdkGLDrawable *gldrawable = gtk_widget_get_gl_drawable (widget);309310 static GLfloat light0_ambient[] = {0.2f, 0.2f, 0.2f, 1.0f};311 static GLfloat light0_diffuse[] = {.8f, .8f, 0.8f, 1.0f};312 static GLfloat light0_position[] = {1.0f, 1.0f, 1.0f, 0.0f};313314 /* Comienza la parte <strong>de</strong> OpenGL... */315 if (!gdk_gl_drawable_gl_begin (gldrawable, glcontext)){316 g_print ("*** ERROR: Problem with init GL\n");317 return;318 }319320 glEnable(GL_LIGHTING);321 glEnable(GL_LIGHT0);322323 glLightfv(GL_LIGHT0, GL_A<strong>MB</strong>IENT, light0_ambient);324 glLightfv(GL_LIGHT0, GL_DIFFUSE, light0_diffuse);325 glLightfv(GL_LIGHT0, GL_POSITION, light0_position);326327 /* Activamos el zbuffer */328 glEnable(GL_DEPTH_TEST);329 glDepthFunc(GL_LEQUAL); /* Tipo <strong>de</strong> test <strong>de</strong> profundidad */330 glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);331332 glEnable(GL_COLOR_MATERIAL);333 glColorMaterial (GL_FRONT, GL_A<strong>MB</strong>IENT_AND_DIFFUSE);334335 gdk_gl_drawable_gl_end (gldrawable);336 }337338 /*******************************************************************339 * Funcion: reescalar_gl340 * Descripcion: Manejador <strong>de</strong>l evento <strong>de</strong> reescalado <strong>de</strong>l Widget341 * Entradas: widget --> Puntero al widget GtkGlExt342 * event --> Puntero con caracteristicas <strong>de</strong>l evento343 * data --> Puntero con los datos <strong>de</strong> los parametros344 * Salidas: Devuelve TRUE si no se produjo error.345 *******************************************************************/346 gboolean reescalar_gl (GtkWidget *widget, GdkEventConfigure *event,347 gpointer data)348 {349 GdkGLContext *glcontext = gtk_widget_get_gl_context (widget);350 GdkGLDrawable *gldrawable = gtk_widget_get_gl_drawable (widget);351352 gdk_gl_drawable_gl_begin (gldrawable, glcontext);