예제 #1
0
파일: geom.c 프로젝트: Cheeseness/neverball
void shad_init(void)
{
    shad_text = make_image_from_file(IMG_SHAD, IF_MIPMAP);

    if (config_get_d(CONFIG_SHADOW) == 2)
    {
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
    }

    /* Create the clip texture. */

    glGenTextures(1, &clip_text);
    glBindTexture(GL_TEXTURE_2D, clip_text);

    glTexImage2D(GL_TEXTURE_2D, 0,
                 GL_LUMINANCE_ALPHA, 1, 2, 0,
                 GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, clip_data);

    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);

    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
}
예제 #2
0
void shad_init(void)
{
    shad_text = make_image_from_file(IMG_SHAD);

    if (config_get_d(CONFIG_SHADOW) == 2)
    {
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
    }
}
예제 #3
0
파일: flou.c 프로젝트: begarco/progSys
int main(int arg_count, char ** args) {
	if(arg_count >= 3) {
		int		procimage = 0, status = 0, repetition=1, fils[3] = {0}, fd[2], pix[3] = {0};
		clock_t start = clock(), end = 0;
		time_t	temps[2]; time(&temps[0]);
		char 	message[3] = "00\0";
		
		/// traitement des arguments
		if(arg_count == 4) {
		    repetition = strtoul(args[3], 0, 0);
		}
		
		/// creation des images
		struct image input = make_image_from_file(args[1]);

		/// ouverture des communications		
		pipe(fd);
		
		for(int i = 0 ; i < repetition ; ++i) {	/// nombre de repetition

			for(int j = 0 ; j < 3 ; ++j) {	/// traitement par canal
				pix[j] = 0;
				fils[j] = fork();
				if(!fils[j]) {
					para_blur_image(&input, fd, strtoul(args[2], 0, 0), j);
					return 0;
				}
			}

			// reception des pixels
			int nbPixels = 3 * input.row_count * input.column_count;
			close(fd[1]);	// fermeture ecriture
			while(pix[0]+pix[1]+pix[2] < nbPixels) {
				message[0] = 0; message[1] = 0;
				read(fd[0], &message, sizeof(message));	//lecture
				input.data.as_rgb8[pix[(int)message[0]]++][(int)message[0]] = (int)message[1];
			}
			
			
			/// attente fin de traitement
			for(int j = 0 ; j < 3 ; ++j)
				waitpid(fils[j], &status, 0);

		    printf("Passe %d/%d\n", i+1, repetition);
		}
		end = clock();
		time(&temps[1]);
		printf("Temps d'execution (clks) : %f\n", (double)(end-start)/CLOCKS_PER_SEC);
		printf("Temps d'execution (secs) : %f\n", difftime(temps[1], temps[0]));
		
		/// affichage a l'ecran
		FILE * final = tmpfile();
		if(final == NULL)
			printf("Impossible de creer un fichier temporaire.\n");
		else {
예제 #4
0
파일: blur.c 프로젝트: begarco/progSys
int main(int arg_count, char **args)
{
	if(arg_count == 4)
	{
		struct image input = make_image_from_file(args[1]);
		struct image output = make_image(input.type, input.row_count, input.column_count, input.max_value);
		blur_image(&input, &output, strtoul(args[3], 0, 0));
		write_image_to_file(&output, args[2]);
	}
	else
	{
		fprintf(stderr, "Essaie plutôt : %s input.ppm output.ppm 10", args[0]);
	}
}
예제 #5
0
파일: geom.c 프로젝트: Cheeseness/neverball
void back_init(const char *name)
{
    if (back_state)
        back_free();

    /* Load the background SOL and modify its material in-place to use the   */
    /* named gradient texture.                                               */

    if (sol_load_full(&back, "geom/back/back.sol", 0))
    {
        struct mtrl *mp = mtrl_get(back.base.mtrls[0]);
        mp->o = make_image_from_file(name, IF_MIPMAP);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
        back_state = 1;
    }
}
예제 #6
0
파일: flou.c 프로젝트: begarco/progSys
int main(int arg_count, char ** args) {
	if(arg_count >= 3) {
		int		procimage = 0, status = 0, repetition=1, fils[3] = {0}, shm = 0;
		clock_t start = clock(), end = 0;
		time_t	temps[2]; time(&temps[0]);
		
		/// traitement des arguments
		if(arg_count == 4) {
		    repetition = strtoul(args[3], 0, 0);
		}
		
		/// creation des images
		struct image input = make_image_from_file(args[1]);
		struct image output = make_image(input.type, input.row_count, input.column_count, input.max_value);

		/// ouverture des communications
		shm = shmget(ftok("./semtest", 1407), get_image_byte_count(&input), 0660 | IPC_CREAT);
		output.data.as_rgb8 = shmat(shm, 0, 0);
		shmctl(shm, IPC_RMID, 0);
		
		for(int i = 0 ; i < repetition ; ++i) {	/// nombre de repetition

			for(int j = 0 ; j < 3 ; ++j) {	/// traitement par canal
				fils[j] = fork();
				if(!fils[j]) {
					para_blur_image(&input, &output, strtoul(args[2], 0, 0), j);
					shmdt(output.data.as_rgb8);
					return 0;
				}
			}			
			
			/// attente fin de traitement
			for(int j = 0 ; j < 3 ; ++j)
				waitpid(fils[j], &status, 0);

		    printf("Passe %d/%d\n", i+1, repetition);
		}
		end = clock();
		time(&temps[1]);
		printf("Temps d'execution (clks) : %f\n", (double)(end-start)/CLOCKS_PER_SEC);
		printf("Temps d'execution (secs) : %f\n", difftime(temps[1], temps[0]));
		
		/// affichage a l'ecran
		FILE * final = tmpfile();
		if(final == NULL)
			printf("Impossible de creer un fichier temporaire.\n");
		else {