ssloy/tinyraytracer

Step 1 is broken

Shinzef opened this issue · 5 comments

When I did step 1 copied and stuff.

dropped a ppm file then tried it on a viewer it says it's not a .ppm file so I opened it in notepad.

and this appeared:

P6
1024 768
255
� � � � � � � � � � � � � � � � � � � � � � � � � � � �

� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ! ! ! ! " " " " # # # # $ $ $ $ % % % % & & & & ' ' ' ' ( ( ( ( ) ) ) ) * * * * + + + + , , , , - - - - . . . . / / / / 0 0 0 0 1 1 1 1 2 2 2 2 3 3 3 3 4 4 4 4 5 5 5 5 6 6 6 6 7 7 7 7 8 8 8 8 9 9 9 9 : : : : ; ; ; ; < < < < = = = = > > > > ? ? ? ? ? @ @ @ @ A A A A B B B B C C C C D D D D E E E E F F F F G G G G H H H H I I I I J J J J K K K K L L L L M M M M N N N N O O O O P P P P Q Q Q Q R R R R S S S S T T T T U U U U V V V V W W W W X X X X Y Y Y Y Z Z Z Z [ [ [ [ \ \ \ \ ] ] ] ] ^ ^ ^ ^ _ _ _ _ a a a a b b b b c c c c d d d d e e e e f f f f g g g g h h h h i i i i j j j j k k k k l l l l m m m m n n n n o o o o p p p p q q q q r r r r s s s s t t t t u u u u v v v v w w w w x x x x y y y y z z z z { { { { | | | | } } } } ~ ~ ~ ~ � � � � � € € € € � � � � ‚ ‚ ‚ ‚ ƒ ƒ ƒ ƒ „ „ „ „ … … … … † † † † ‡ ‡ ‡ ‡ ˆ ˆ ˆ ˆ ‰ ‰ ‰ ‰ Š Š Š Š ‹ ‹ ‹ ‹ Œ Œ Œ Œ � � � � Ž Ž Ž Ž � � � � � � � � ‘ ‘ ‘ ‘ ’ ’ ’ ’ “ “ “ “ ” ” ” ” • • • • – – – – — — — — ˜ ˜ ˜ ˜ ™ ™ ™ ™ š š š š › › › › œ œ œ œ � � � � ž ž ž ž Ÿ Ÿ Ÿ Ÿ         ¡ ¡ ¡ ¡ ¢ ¢ ¢ ¢ £ £ £ £ ¤ ¤ ¤ ¤ ¥ ¥ ¥ ¥ ¦ ¦ ¦ ¦ § § § § ¨ ¨ ¨ ¨ © © © © ª ª ª ª « « « « ¬ ¬ ¬ ¬ ­ ­ ­ ­ ® ® ® ® ¯ ¯ ¯ ¯ ° ° ° ° ± ± ± ± ² ² ² ² ³ ³ ³ ³ ´ ´ ´ ´ µ µ µ µ ¶ ¶ ¶ ¶ · · · · ¸ ¸ ¸ ¸ ¹ ¹ ¹ ¹ º º º º » » » » ¼ ¼ ¼ ¼ ½ ½ ½ ½ ¾ ¾ ¾ ¾ ¿ ¿ ¿ ¿ ¿ À À À À Á Á Á Á Â Â Â Â Ã Ã Ã Ã Ä Ä Ä Ä Å Å Å Å Æ Æ Æ Æ Ç Ç Ç Ç È È È È É É É É Ê Ê Ê Ê Ë Ë Ë Ë Ì Ì Ì Ì Í Í Í Í Î Î Î Î Ï Ï Ï Ï Ð Ð Ð Ð Ñ Ñ Ñ Ñ Ò Ò Ò Ò Ó Ó Ó Ó Ô Ô Ô Ô Õ Õ Õ Õ Ö Ö Ö Ö × × × × Ø Ø Ø Ø Ù Ù Ù Ù Ú Ú Ú Ú Û Û Û Û Ü Ü Ü Ü Ý Ý Ý Ý Þ Þ Þ Þ ß ß ß ß à à à à á á á á â â â â ã ã ã ã ä ä ä ä å å å å æ æ æ æ ç ç ç ç è è è è é é é é ê ê ê ê ë ë ë ë ì ì ì ì í í í í î î î î ï ï ï ï ð ð ð ð ñ ñ ñ ñ ò ò ò ò ó ó ó ó ô ô ô ô õ õ õ õ ö ö ö ö ÷ ÷ ÷ ÷ ø ø ø ø ù ù ù ù ú ú ú ú û û û û ü ü ü ü ý ý ý ý þ þ þ þ � � � � � � � � � � � � � � � � � � � � � � � � � � � �

note: i did
std::ofstream ofs; ofs.open(filename, std::ofstream::out | std::ofstream::binary); ofs << "P6\n" << w << " " << h << "\n255\n";

ssloy commented

does your viewer support ppm files? can you attach the file here?

Heres the file: ( change the extension to .ppm)
out.txt

The ppm viewer i used: https://www.cs.rhodes.edu/welshc/COMP141_F16/ppmReader.html

ssloy commented

Yup, the file is corrupted. Seems that you have not used std::ofstream::binary flag. Check this issue ssloy/tinyraycaster#9

i have used that flag still for some weird reason is still didn't work, i ended up writing my whole function instead but thanks for the course anyways