Foros del Web » Programación para mayores de 30 ;) » C/C++ »

Problemas con programa en opengl

Estas en el tema de Problemas con programa en opengl en el foro de C/C++ en Foros del Web. Saludos Compañeros! Estaba haciendo un programa en C++ utilizando las librerias de opengl y glut pero me dan algunos errores a ver si pueden revisar ...
  #1 (permalink)  
Antiguo 20/10/2009, 10:24
 
Fecha de Ingreso: abril-2008
Mensajes: 31
Antigüedad: 16 años
Puntos: 1
Pregunta Problemas con programa en opengl

Saludos Compañeros! Estaba haciendo un programa en C++ utilizando las librerias de opengl y glut pero me dan algunos errores a ver si pueden revisar el programa y me pueden ayudar con el casito este. Se ademas que tengo q llamar el archivo txt pero ese no es el problema.Gracias de antemano! Este es el programa:
#include <stdlib.h> //line_rings_snoopy.cpp
#include <iostream>
#include <fstream.h>
#include <windows.h>
#include <GL/glut.h>

GLsizei wh = 250;
GLsizei ww = 250;

void DisplaySnoopy ( void );
void MyInit ( );

void DisplaySnoopy ( void ) {
char tfill;
GLfloat xaj[40], yaj[40]; //polygon data points
int j, no_of_pts, intring[128];
GLubyte ring[128]; //bit pattern store

fstream inRings;
fstream inStream;
inStream.open("F:\snoopy3.txt", ios ::in);
if(!inStream) { cout << "File would not open\n";
return;
}
inRings.open("F:\snoopy3.txt", ios ::in);
if(!inRings) { cout << "File would not open\n";
return;
}

for (j=0; j<128; j++) { //i/p stipple pattern as integers->bytes
inRings >> intring[j];
ring[j] = (char) intring[j];
}

glClear ( GL_COLOR_BUFFER_BIT );
glScalef(5.0, 5.0, 1.0);
glEnable(GL_POLYGON_STIPPLE);
glPolygonStipple(ring);
do {
inStream >> no_of_pts >> tfill;
//input polygon outline
for (j=1; j<=no_of_pts; j++) inStream >> xaj[j] >> yaj[j];
//draw polygon
glBegin(GL_POLYGON);
for (j=1; j<=no_of_pts; j++) glVertex2f(xaj[j],yaj[j]);
glEnd();
//draw outline & skip last point if internal to snoopy
if(tfill == 'y') no_of_pts--;
if(no_of_pts != 2) {
glBegin(GL_LINE_STRIP);
for (j=1; j<=no_of_pts; j++) glVertex2f(xaj[j],yaj[j]);
glEnd();
}
} while((no_of_pts = inStream.get()) != EOF);
glFlush();
}

void MyInit ( void ) {
glClearColor ( 1.0, 1.0, 0.0, 0.0 );
glColor3f(0.0f, 0.0f,1.0f);
glMatrixMode ( GL_MODELVIEW );
glLoadIdentity ( );
gluOrtho2D ( 0.0, (GLdouble)ww, 0.0, (GLdouble)wh );
}

int main(int argc, char **argv) {
glutInit ( &argc, argv );
glutInitDisplayMode ( GLUT_SINGLE | GLUT_RGB );
glutInitWindowSize ( ww, wh );
glutInitWindowPosition ( 50, 50 );
glutCreateWindow ( "Sleeping Snoopy" );

MyInit ( );

glutDisplayFunc ( DisplaySnoopy );
glutMainLoop ( );
}
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 08:27.