Open GL - Fayo al compilar Open GL en mac

 
Vista:

Fayo al compilar Open GL en mac

Publicado por Pascual (2 intervenciones) el 09/11/2009 12:46:44
tengo un programa que escribe las letras G.P.O., al compilarlo en unix me va perfecto, pro al hacerlo en mac os x el compilador me da un warning(deprecated conversion from string constant to ‘char*’ ) lo compilo con (g++ -framework GLUT -framework OpenGL -framework Cocoa -framework OpenGl pract1_1.cpp -o pract1_1) cuand ejecuto pract1_1 se me muestra una pantalla en blanco.

el codigo es:

#ifdef __APPLE__
#include <OpenGL/gl.h>
#include <OpenGL/glu.h>
#include <GLUT/glut.h>
#else
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glut.h>
#endif
#include <fstream>
#define an 640
#define al 480

using namespace std;

// Mi_inicio
void myInit(void)
{
glClearColor(1.0,1.0,1.0,1.0); //Selecciona el color de fondo
glColor3f(1.0f, 0.0f, 0.0f); //El color a dibujar
glPointSize(4.0); //Tamaño de los puntos
glMatrixMode (GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0.0,(double) an,0.0,(double)al);
}

void dibuja_puntos(char *archivo)
{
fstream Entrada;

Entrada.open(archivo, ios ::in); //abre el fichero
if(Entrada.fail())
return;
glClear(GL_COLOR_BUFFER_BIT); //limpia la pantalla
GLint num_puntos, x, y;
GLfloat tama_pixel;
Entrada >> tama_pixel; //lee el tamaño de pixel
glPointSize(tama_pixel); //asigna el tamaño de pixel
Entrada >> num_puntos; //lee el número de puntos
for(int j =0; j < num_puntos; j++) //lee cada polilínea
{
glBegin(GL_POINTS); //dibuja la siguiente polilínea
Entrada >> x >> y; //lee el siguiente par de x, y
glVertex2i(x ,y);
glEnd(); }
glFlush();
Entrada.close();
}

void miDibujo(void)
{
char *archivo;
archivo="puntos.dat";
dibuja_puntos(archivo);
}

// MAIN
int main (int argc, char** argv)
{
glutInit(&argc, argv); //Inicializa toolkit
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB); // Modo pantalla
glutInitWindowSize(an,al); //Tamaño de la ventana
glutInitWindowPosition(100,150);//Posición de ventana en pantalla
glutCreateWindow("Practica 1_1");//Abre la ventana
glutDisplayFunc(miDibujo); //Registra la función de redibujar
myInit();
glutMainLoop(); //Bucle continuo
return 0;
}

estoy seguro k al pasar de unix a mac hay k cambiar algo mas!! espero k me podais ayudar, incluyo tb el fichero para que podais hacer pruevas.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:Fayo al compilar Open GL en mac

Publicado por Pascual (2 intervenciones) el 09/11/2009 12:48:26
esto seria el archivo dino.dat21
29
32 435
10 439
4 438
2 433
4 428
6 425
10 420
15 416
21 413
30 408
42 406
47 403
56 398
63 391
71 383
79 369
84 356
87 337
89 316
88 302
86 294
83 278
79 256
78 235
79 220
85 204
94 190
98 183
98 182
9
116 189
105 184
98 172
98 156
93 141
93 132
99 122
104 115
104 114
38
153 116
152 112
153 107
154 93
154 81
152 67
146 56
140 47
136 39
133 30
130 17
128 7
127 3
93 2
93 10
96 16
96 20
97 21
101 24
104 27
105 31
107 36
108 40
109 47
111 51
114 58
118 66
120 71
118 79
117 88
116 97
112 105
107 113
107 118
108 126
112 138
116 146
118 148
7
153 95
158 99
159 103
161 108
161 115
160 121
160 122
7
156 80
167 79
182 76
203 73
220 78
235 79
239 80
43
262 154
259 141
259 123
257 110
255 93
259 86
272 74
287 46
290 41
299 30
305 21
307 15
307 12
300 11
299 9
301 2
303 1
313 5
320 7
307 1
312 0
321 0
325 0
331 0
336 2
336 8
334 18
335 24
331 29
327 39
323 45
317 54
312 63
308 70
301 79
297 86
296 97
300 109
303 120
304 126
307 138
306 148
305 152
5
298 86
304 92
310 104
314 114
314 119
7
255 98
251 100
246 105
242 112
236 122
231 131
233 126
7
271 73
264 74
257 76
244 76
236 80
231 84
230 86
24
242 77
242 70
245 61
246 49
248 39
249 30
248 19
245 12
242 9
241 6
243 1
256 3
259 2
266 3
271 4
274 9
277 16
277 24
277 31
277 41
277 48
278 57
278 62
278 66
24
190 73
191 64
193 51
194 39
191 25
189 17
185 7
184 5
177 4
169 4
166 4
159 5
159 6
162 19
163 25
165 32
165 39
165 47
165 57
162 65
161 70
159 75
158 78
157 80
15
96 157
93 163
88 176
82 184
78 193
75 201
72 212
72 224
72 238
73 254
75 267
78 277
82 286
89 298
89 300
9
33 428
33 428
33 427
35 426
36 425
30 427
27 428
27 428
28 428
16
2 435
5 434
10 432
13 431
16 429
19 427
21 426
22 425
24 424
26 423
27 423
30 422
33 422
34 421
36 420
36 419
77
32 436
55 423
67 415
75 409
86 401
92 395
98 389
105 378
107 372
111 362
112 355
116 345
119 338
121 328
124 317
125 312
125 304
126 294
125 288
124 280
125 277
125 258
124 255
125 241
128 235
135 225
141 218
147 211
155 208
166 205
178 203
194 202
209 203
219 204
232 205
249 206
259 207
284 205
300 198
317 189
333 182
345 170
362 153
392 135
430 118
450 104
477 91
509 75
539 65
567 61
599 60
625 59
635 58
632 54
616 51
602 46
593 46
580 45
565 41
546 38
526 36
502 42
487 48
468 53
452 57
434 63
414 71
397 77
378 82
366 86
352 90
338 92
328 91
319 88
307 86
306 85
301 85
14
318 106
333 107
346 109
359 111
369 104
391 100
411 95
431 87
445 81
458 71
473 63
491 59
497 57
499 56
7
244 109
235 104
221 100
208 96
199 97
190 98
190 98
8
160 116
165 119
171 122
172 127
170 135
168 144
170 149
174 149
4
169 118
174 120
179 124
178 126
8
293 132
294 125
297 115
291 94
287 90
290 84
297 79
297 79
6
144 97
143 83
144 72
141 58
136 52
134 49
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar