removed reference to Glut and OpenGL

This commit is contained in:
Phuntsok Drak-pa 2018-11-12 14:25:06 +01:00
parent 8722f52a98
commit 90d4b0cfc3
3 changed files with 16 additions and 16 deletions

View File

@ -106,13 +106,13 @@ void read_rgb(FILE* t_fp, const char* t_filename) {
}
}
unsigned long read_data(FILE *t_fp, Image *t_img, GLubyte **t_data,
unsigned long read_data(FILE *t_fp, Image *t_img, unsigned char **t_data,
const char *t_filename) {
unsigned long size;
/* allocation memoire */
size = t_img->x * t_img->y * 3;
printf("Size image %lu %lu => %lu\n", t_img->x, t_img->y, size);
*t_data = (GLubyte *)malloc((size_t)size * sizeof(GLubyte));
*t_data = (unsigned char *)malloc((size_t)size * sizeof(unsigned char));
assert(*t_data);
/* read pixel data from file */
if (!fread(*t_data, (size_t)1, (size_t)size, t_fp)) {
@ -124,17 +124,17 @@ unsigned long read_data(FILE *t_fp, Image *t_img, GLubyte **t_data,
}
/**
* Convertit vers un tableau de `GLubyte` les pixels contenus dans un conteneur
* dimage. La taille du tableau de `GLubyte` est la taille du tableau de
* Convertit vers un tableau de `unsigned char` les pixels contenus dans un conteneur
* dimage. La taille du tableau de `unsigned char` est la taille du tableau de
* pixels multipliée par trois du fait des trois emplacements séparés par
* couleur.
*
* \param[out] img Image dont les pixels doivent être convertis
* \param[in] data Données à convertir en structures \ref Pixel
* \param[in] size Taille du tableau de `GLubyte`
* \param[in] size Taille du tableau de `unsigned char`
* \return return type
*/
void dataToImage(Image *t_img, GLubyte *t_data, unsigned long t_size) {
void dataToImage(Image *t_img, unsigned char *t_data, unsigned long t_size) {
unsigned long i;
t_img->pixels = darrayNew(sizeof(Pixel));
printf("Size of data: %lu\n", t_size);
@ -153,12 +153,12 @@ void dataToImage(Image *t_img, GLubyte *t_data, unsigned long t_size) {
* \param[in] img Conteneur dimage contenant les pixels à convertir
* \return Tableau de pointeurs de `GLuint`
*/
GLubyte *imageToData(Image_t t_img) {
unsigned char *imageToData(Image_t t_img) {
Pixel_t pixel;
GLubyte *data, size;
unsigned char *data, size;
unsigned long i;
size = (GLubyte)darraySize(t_img->pixels);
data = (GLubyte *)malloc(3 * sizeof(GLubyte) * size);
size = (unsigned char)darraySize(t_img->pixels);
data = (unsigned char *)malloc(3 * sizeof(unsigned char) * size);
for(i = 0; i < size; i += 3) {
pixel = darrayGet(t_img->pixels, i / 3);
data[i] = pixel->r;
@ -181,7 +181,7 @@ GLubyte *imageToData(Image_t t_img) {
int imageLoadPPM(const char *t_filename, Image *t_img) {
FILE *fp;
unsigned long size;
GLubyte *data = NULL;
unsigned char *data = NULL;
printf("Hey auie\n");
fp = get_file(t_filename, "rb"); /* open PPM file for reading */
read_file_format(fp, t_filename); /* read image format */
@ -203,7 +203,7 @@ int imageLoadPPM(const char *t_filename, Image *t_img) {
*/
void imageSavePPM(char *t_filename, Image_t t_img) {
FILE *fp;
GLubyte *data;
unsigned char *data;
fp = get_file(t_filename, "wb"); /* open file for output */
/* write the header file */
fprintf(fp, "P6\n"); /* image format */

View File

@ -23,12 +23,12 @@ void read_file_size(FILE *fp, Image *img, const char *filename);
/// \brief Lit et vérifie le format RGB du fichier ppm
void read_rgb(FILE *fp, const char *filename);
/// \brief Lit dans le conteneur les données images du fichier ppm
unsigned long read_data(FILE *fp, Image *img, GLubyte **data,
unsigned long read_data(FILE *fp, Image *img, unsigned char **data,
const char *filename);
/// \brief Convertit les données brutes de fichier vers des conteneurs de pixels
void dataToImage(Image *img, GLubyte *data, unsigned long size);
void dataToImage(Image *img, unsigned char *data, unsigned long size);
/// \brief Convertit les pixels dune image en tableau natif OpenGL
GLubyte *imageToData(Image_t img);
unsigned char *imageToData(Image_t img);
/// \brief Ouverture et lecture de limage dentrée
int imageLoadPPM(const char *filename, Image_t img);
/// \brief Ouverture et écriture de l'image de sortie

View File

@ -11,7 +11,7 @@
#define UTILITIES_H
#include "darray.h"
#include <GL/gl.h>
/* #include <GL/gl.h> */
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>