Hola a todos, me gustaria solicitar su ayuda sobre un programa en matlab para obtener de una imagen todos sus puntos para despues graficarlos en openGL, el programa no lo hice yo, mas bien un compañero me lo paso, pero me da error (la verdad es que nunca he heho nada en matlab), aqui les pongo el codigo de matlab y el de openGL
Matlab:
function imagen = hola('C:darkar24.jpg');
imagen = imread('C:darkar24.jpg');
resolucionImagen = size( imagen );
renglones = resolucionImagen(1,2,1);
columnas = resolucionImagen(1,1,1);
archivo = fopen( 'datosImagen.txt', 'w' );
fprintf(archivo,'%ux%un',renglones,columnas);
for x = 1:renglones
for y = 1:columnas
fprintf(archivo,'%u-%u-%u-',imagen(y,x,1),imagen(y,x,2),imagen(y,x,3));
end
end
return
el primer error me sale en esta linea
function imagen = hola('C:darkar24.jpg');
y el error que marca es este:
Error: "identifier" expected, "character string" found.
el de openGL
#include <stdio.h>
#include <stdlib.h>
#include <GL/glut.h> // The GL Utility Toolkit (Glut) Header
GLint renglones, columnas;
GLfloat ***ptrArrVertices;
void InitGL();
void display ( void );
void reshape ( int width , int height );
void keyboard ( unsigned char key, int x, int y );
GLfloat ***cargaPixeles( void );
int main ( int argc, char** argv ) // Main Function
{
ptrArrVertices = cargaPixeles();
//imprimirVertices
glutInit (&argc, argv); // Inicializamos OpenGL
//glutInitDisplayMode (GLUT_RGBA | GLUT_SINGLE | GLUT_DEPTH); // Display Mode (Clores RGB y alpha | Buffer Sencillo )
glutInitDisplayMode (GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); // Display Mode (Clores RGB y alpha | Buffer Doble )
glutInitWindowSize (renglones, columnas); // Tamaño de la Ventana
glutInitWindowPosition (500, 130); //Posicion de la Ventana
glutCreateWindow ("Concurso"); // Nombre de la Ventana
//glutFullScreen ( ); // Full Screen
InitGL (); // Parametros iniciales de la aplicacion
glutDisplayFunc ( display ); //Indicamos a Glut función de dibujo
glutReshapeFunc ( reshape ); //Indicamos a Glut función en caso de cambio de tamano
glutKeyboardFunc ( keyboard ); //Indicamos a Glut función de manejo de teclado
//glutSpecialFunc ( arrow_keys ); //Otras
//glutIdleFunc ( display ); //Hace animacíon
glutMainLoop ( ); //
return 0;
}
void InitGL ( ) // Inicializamos parametros
{
//glShadeModel(GL_SMOOTH); // Habilitamos Smooth Shading
glClearColor(1.0f, 1.0f, 1.0f, 0.0f); // Blanco de fondo
glClearDepth(1.0f); // Configuramos Depth Buffer
glEnable(GL_DEPTH_TEST); // Habilitamos Depth Testing
glDepthFunc(GL_LEQUAL); // Tipo de Depth Testing a realizar
//glEnable ( GL_COLOR_MATERIAL );
//glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
}
void display ( void ) // Creamos la funcion donde se dibuja
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Limiamos pantalla y Depth Buffer
glMatrixMode(GL_MODELVIEW);
espero alguien me pueda ayudar de antemano muchas gracias