From 09b005145dcd0fe18e2096bf47bea7e1fec6bcce Mon Sep 17 00:00:00 2001 From: SoloArchx250 Date: Wed, 13 May 2020 15:54:11 -0400 Subject: [PATCH] Initial Commit --- .history/Makefile_20200511140830 | 16 ++ .history/Makefile_20200511200301 | 16 ++ .history/Makefile_20200511200400 | 17 ++ .history/Makefile_20200511201938 | 17 ++ .history/Makefile_20200511201953 | 16 ++ .history/Makefile_20200511202032 | 16 ++ .history/Makefile_20200511202051 | 16 ++ .history/Makefile_20200511202102 | 16 ++ .history/Makefile_20200511202110 | 16 ++ .history/Makefile_20200511202111 | 16 ++ .history/Makefile_20200511202113 | 16 ++ .history/Makefile_20200511202207 | 16 ++ .history/Makefile_20200511202225 | 16 ++ .history/Makefile_20200511202244 | 16 ++ .history/Makefile_20200511202254 | 16 ++ .history/Makefile_20200511222404 | 17 ++ .history/Makefile_20200511222408 | 17 ++ .history/Makefile_20200511222417 | 17 ++ .history/Makefile_20200511222546 | 17 ++ .history/Makefile_20200511222552 | 17 ++ .history/Makefile_20200511222632 | 17 ++ .history/Makefile_20200511223118 | 20 +++ .history/Makefile_20200511232417 | 20 +++ .history/Makefile_20200511232942 | 21 +++ .history/Makefile_20200511232949 | 21 +++ .history/Makefile_20200511233258 | 19 +++ .history/Makefile_20200511233332 | 20 +++ .history/Makefile_20200511233403 | 21 +++ .history/Makefile_20200511233423 | 22 +++ .history/Makefile_20200511233451 | 23 +++ .history/Makefile_20200511233512 | 23 +++ .history/Makefile_20200511233531 | 21 +++ .history/Makefile_20200511233537 | 21 +++ .history/Makefile_20200511233619 | 23 +++ .history/Makefile_20200511233631 | 23 +++ .history/Makefile_20200511233633 | 23 +++ .history/Makefile_20200511233703 | 23 +++ .history/Makefile_20200511233707 | 23 +++ .history/Makefile_20200511233714 | 23 +++ .history/Makefile_20200511233726 | 23 +++ .history/Makefile_20200511233826 | 23 +++ .history/Makefile_20200511233926 | 23 +++ .history/Makefile_20200511233935 | 23 +++ .history/Makefile_20200511233946 | 23 +++ .history/Makefile_20200511234024 | 23 +++ .history/Makefile_20200511234030 | 23 +++ .history/Makefile_20200511234130 | 23 +++ .history/Makefile_20200511234218 | 23 +++ .history/Makefile_20200511234223 | 23 +++ .history/Makefile_20200511234429 | 23 +++ .history/Makefile_20200511234457 | 23 +++ .history/Makefile_20200511234505 | 23 +++ .history/Makefile_20200511234522 | 23 +++ .history/Makefile_20200511234615 | 23 +++ .history/Makefile_20200511234621 | 23 +++ .history/Makefile_20200511234639 | 23 +++ .history/Makefile_20200511234646 | 23 +++ .history/Makefile_20200511235501 | 23 +++ .history/Makefile_20200511235522 | 23 +++ .history/Makefile_20200511235543 | 23 +++ .history/Makefile_20200511235607 | 23 +++ .history/Makefile_20200511235632 | 23 +++ .history/Makefile_20200511235725 | 23 +++ .history/Makefile_20200511235727 | 23 +++ .history/Makefile_20200511235737 | 23 +++ .history/Makefile_20200511235920 | 23 +++ .history/Makefile_20200512000709 | 23 +++ .history/Makefile_20200512001624 | 23 +++ .history/Makefile_20200512001633 | 23 +++ .history/Makefile_20200512001749 | 23 +++ .history/Makefile_20200512001840 | 23 +++ .history/Makefile_20200512001924 | 23 +++ .history/Makefile_20200512001959 | 23 +++ .history/Makefile_20200512002002 | 23 +++ .history/Makefile_20200512002353 | 23 +++ .history/Makefile_20200512002453 | 23 +++ .history/Makefile_20200512002502 | 23 +++ .history/Makefile_20200512002516 | 23 +++ .history/Makefile_20200512002533 | 23 +++ .history/Makefile_20200512002632 | 23 +++ .history/Makefile_20200512002654 | 23 +++ .history/Makefile_20200512002708 | 23 +++ .history/Makefile_20200512002742 | 23 +++ .history/Makefile_20200512002756 | 23 +++ .history/Makefile_20200512003649 | 15 ++ .history/Makefile_20200512003657 | 15 ++ .history/Makefile_20200512003732 | 15 ++ .history/Makefile_20200512003757 | 15 ++ .history/Makefile_20200512003818 | 15 ++ .history/Makefile_20200512003822 | 15 ++ .history/Makefile_20200512003829 | 15 ++ .history/Makefile_20200512003842 | 16 ++ .history/Makefile_20200512003911 | 16 ++ .history/Makefile_20200512003927 | 16 ++ .history/Makefile_20200512003938 | 16 ++ .history/Makefile_20200512004016 | 15 ++ .history/Makefile_20200512004205 | 16 ++ .history/Makefile_20200512005117 | 25 +++ .history/Makefile_20200512005124 | 25 +++ .history/Makefile_20200512005227 | 26 +++ .history/Makefile_20200512005507 | 25 +++ .history/Makefile_20200512005538 | 25 +++ .history/Makefile_20200512005607 | 25 +++ .history/Makefile_20200512005648 | 25 +++ .history/Makefile_20200512005729 | 30 ++++ .history/Makefile_20200512005741 | 30 ++++ .history/Makefile_20200512005803 | 30 ++++ .history/Makefile_20200512005826 | 30 ++++ .history/Makefile_20200512005851 | 28 ++++ .history/Makefile_20200512005925 | 29 ++++ .history/Makefile_20200512005944 | 29 ++++ .history/Makefile_20200512010012 | 29 ++++ .history/Makefile_20200512095009 | 29 ++++ .history/Makefile_20200512095614 | 29 ++++ .history/Makefile_20200512095616 | 29 ++++ .history/Makefile_20200512113711 | 33 ++++ .history/Makefile_20200512122020 | 34 ++++ .history/Makefile_20200512122058 | 34 ++++ .history/Makefile_20200512122134 | 34 ++++ .history/Makefile_20200512122202 | 33 ++++ .history/Makefile_20200512122220 | 33 ++++ .history/Makefile_20200512122241 | 33 ++++ .history/Makefile_20200512122259 | 33 ++++ .history/Makefile_20200512122307 | 33 ++++ .history/Makefile_20200512122440 | 33 ++++ .history/Makefile_20200512122803 | 34 ++++ .history/Makefile_20200512122821 | 34 ++++ .history/Makefile_20200512122910 | 33 ++++ .history/Makefile_20200512145408 | 34 ++++ .history/Makefile_20200512145509 | 36 ++++ .history/Makefile_20200512145543 | 36 ++++ .history/Makefile_20200512145729 | 33 ++++ .history/Makefile_20200512145745 | 33 ++++ .history/Makefile_20200513122930 | 37 +++++ .history/Makefile_20200513122959 | 37 +++++ .history/Makefile_20200513123017 | 38 +++++ .history/Makefile_20200513123140 | 38 +++++ .history/Makefile_20200513123200 | 38 +++++ .history/Makefile_20200513123243 | 38 +++++ .history/Makefile_20200513123410 | 38 +++++ .history/Makefile_20200513123423 | 38 +++++ .history/Makefile_20200513123433 | 38 +++++ .history/Makefile_20200513123441 | 38 +++++ .history/Makefile_20200513123514 | 39 +++++ .history/Makefile_20200513123603 | 39 +++++ .history/Makefile_20200513123629 | 39 +++++ .history/Makefile_20200513123759 | 39 +++++ .history/Makefile_20200513123840 | 39 +++++ .history/Makefile_20200513123854 | 39 +++++ .history/Makefile_20200513123905 | 39 +++++ .history/Makefile_20200513124216 | 39 +++++ .history/Makefile_20200513124320 | 39 +++++ .history/Makefile_20200513124438 | 40 +++++ .history/Makefile_20200513124541 | 39 +++++ .history/Makefile_20200513124558 | 39 +++++ .history/Makefile_20200513124608 | 39 +++++ .history/Makefile_20200513124624 | 39 +++++ .history/Makefile_20200513125013 | 40 +++++ .history/Makefile_20200513125052 | 40 +++++ .history/Makefile_20200513125126 | 40 +++++ .history/Makefile_20200513125143 | 40 +++++ .history/Makefile_20200513125206 | 40 +++++ .history/Makefile_20200513125218 | 39 +++++ .history/Makefile_20200513125946 | 40 +++++ .history/Makefile_20200513130104 | 42 +++++ .history/Makefile_20200513130117 | 42 +++++ .history/Makefile_20200513130353 | 42 +++++ .history/Makefile_20200513130432 | 39 +++++ .history/Makefile_20200513130456 | 40 +++++ .history/Makefile_20200513130508 | 40 +++++ .history/Makefile_20200513130809 | 40 +++++ .history/Makefile_20200513130839 | 40 +++++ .history/Makefile_20200513130844 | 39 +++++ .history/Makefile_20200513130854 | 40 +++++ .history/Makefile_20200513130906 | 39 +++++ .history/Makefile_20200513130915 | 40 +++++ .history/Makefile_20200513130933 | 41 +++++ .history/Makefile_20200513131004 | 42 +++++ .history/Makefile_20200513131017 | 42 +++++ .history/Makefile_20200513131041 | 40 +++++ .history/Makefile_20200513131048 | 40 +++++ .history/Makefile_20200513131123 | 40 +++++ .history/Makefile_20200513131132 | 40 +++++ .history/Makefile_20200513131146 | 40 +++++ .history/Makefile_20200513131336 | 40 +++++ .history/Makefile_20200513131344 | 40 +++++ .history/Makefile_20200513131602 | 42 +++++ .history/Makefile_20200513131621 | 42 +++++ .history/Makefile_20200513131845 | 42 +++++ .history/Makefile_20200513131940 | 42 +++++ .history/Makefile_20200513132006 | 42 +++++ .history/Makefile_20200513132016 | 42 +++++ .history/Makefile_20200513132905 | 39 +++++ .history/Makefile_20200513132931 | 40 +++++ .history/Makefile_20200513132942 | 40 +++++ .history/Makefile_20200513134126 | 40 +++++ .history/Makefile_20200513134548 | 1 + .history/Makefile_20200513135257 | 4 + .history/generatecube_20200511164401.lua | 0 .history/generatecube_20200511171029.lua | 2 + .history/src/Color_20200511171542.h | 10 ++ .history/src/Color_20200511175158.h | 10 ++ .history/src/Color_20200511175840.h | 16 ++ .history/src/Color_20200511175845.h | 16 ++ .history/src/Color_20200511175902.h | 16 ++ .history/src/Color_20200511180426.h | 19 +++ .history/src/Color_20200511180509.h | 11 ++ .history/src/Color_20200511184059.h | 11 ++ .history/src/Color_20200511184834.h | 11 ++ .history/src/Color_20200511184840.h | 11 ++ .history/src/Color_20200511185132.h | 11 ++ .history/src/Color_20200511195616.h | 16 ++ .history/src/Color_20200511214107.cpp | 0 .history/src/Color_20200511214344.cpp | 1 + .history/src/Color_20200511214346.cpp | 8 + .history/src/Color_20200511214352.cpp | 8 + .history/src/Color_20200511214540.h | 10 ++ .history/src/Color_20200511214543.cpp | 8 + .history/src/Color_20200511214549.cpp | 1 + .history/src/Color_20200511214553.h | 16 ++ .history/src/Color_20200511214556.h | 16 ++ .history/src/Color_20200511214607.h | 16 ++ .history/src/Color_20200511214903.h | 11 ++ .history/src/Color_20200511214929.cpp | 8 + .history/src/Color_20200511215000.cpp | 8 + .history/src/Color_20200511215006.cpp | 8 + .history/src/Color_20200511215017.cpp | 9 + .history/src/Color_20200511215019.cpp | 9 + .history/src/Color_20200511215026.cpp | 9 + .history/src/Color_20200511215048.cpp | 9 + .history/src/Color_20200512000019.h | 11 ++ .history/src/Color_20200512000031.h | 11 ++ .history/src/Color_20200512000048.cpp | 9 + .history/src/Color_20200512011729.h | 13 ++ .history/src/Color_20200512011730.h | 13 ++ .history/src/Cube_20200511182530.h | 0 .history/src/Cube_20200511182542.h | 1 + .history/src/Cube_20200511183329.h | 6 + .history/src/Cube_20200511183343.h | 8 + .history/src/Cube_20200511183548.h | 8 + .history/src/Cube_20200511184002.h | 26 +++ .history/src/Cube_20200511184009.h | 26 +++ .history/src/Cube_20200511184116.h | 26 +++ .history/src/Cube_20200511184202.h | 27 +++ .history/src/Cube_20200511184203.h | 27 +++ .history/src/Cube_20200511184209.h | 28 ++++ .history/src/Cube_20200511184212.h | 27 +++ .history/src/Cube_20200511184523.h | 41 +++++ .history/src/Cube_20200511184555.h | 41 +++++ .history/src/Cube_20200511184633.h | 45 +++++ .history/src/Cube_20200511184644.h | 46 ++++++ .history/src/Cube_20200511185025.h | 46 ++++++ .history/src/Cube_20200511200128.h | 46 ++++++ .history/src/Cube_20200511215053.cpp | 0 .history/src/Cube_20200511215349.cpp | 13 ++ .history/src/Cube_20200511215400.cpp | 13 ++ .history/src/Cube_20200511215430.cpp | 20 +++ .history/src/Cube_20200511215539.cpp | 35 ++++ .history/src/Cube_20200511215544.cpp | 35 ++++ .history/src/Cube_20200511215553.h | 30 ++++ .history/src/Cube_20200511215555.h | 30 ++++ .history/src/Cube_20200511215557.h | 30 ++++ .history/src/Cube_20200511215604.h | 30 ++++ .history/src/Cube_20200511215610.h | 30 ++++ .history/src/Cube_20200511215619.h | 26 +++ .history/src/Cube_20200511215638.cpp | 40 +++++ .history/src/Cube_20200511215641.cpp | 40 +++++ .history/src/Cube_20200511215657.h | 26 +++ .history/src/Cube_20200511215708.h | 27 +++ .history/src/Cube_20200511215722.cpp | 40 +++++ .history/src/Cube_20200512000150.h | 27 +++ .history/src/Cube_20200512000152.h | 27 +++ .history/src/Cube_20200512000204.cpp | 40 +++++ .history/src/Cube_20200512005406.h | 26 +++ .history/src/Cube_20200512005416.h | 26 +++ .history/src/Quad_20200511171624.h | 0 .history/src/Quad_20200511171639.h | 19 +++ .history/src/Quad_20200511171657.h | 22 +++ .history/src/Quad_20200511171706.h | 23 +++ .history/src/Quad_20200511171710.h | 23 +++ .history/src/Quad_20200511171713.h | 23 +++ .history/src/Quad_20200511171740.h | 23 +++ .history/src/Quad_20200511175511.h | 27 +++ .history/src/Quad_20200511175543.h | 29 ++++ .history/src/Quad_20200511175550.h | 29 ++++ .history/src/Quad_20200511175556.h | 29 ++++ .history/src/Quad_20200511175559.h | 29 ++++ .history/src/Quad_20200511175623.h | 29 ++++ .history/src/Quad_20200511175926.h | 29 ++++ .history/src/Quad_20200511175932.h | 29 ++++ .history/src/Quad_20200511184026.h | 30 ++++ .history/src/Quad_20200511184038.h | 30 ++++ .history/src/Quad_20200511184041.h | 30 ++++ .history/src/Quad_20200511184044.h | 29 ++++ .history/src/Quad_20200511184053.h | 30 ++++ .history/src/Quad_20200511184056.h | 30 ++++ .history/src/Quad_20200511184723.h | 30 ++++ .history/src/Quad_20200511184816.h | 30 ++++ .history/src/Quad_20200511185058.h | 30 ++++ .history/src/Quad_20200511200147.h | 30 ++++ .history/src/Quad_20200511215736.cpp | 0 .history/src/Quad_20200511215936.cpp | 8 + .history/src/Quad_20200511220007.cpp | 8 + .history/src/Quad_20200511220027.h | 25 +++ .history/src/Quad_20200511220042.cpp | 10 ++ .history/src/Quad_20200511220043.cpp | 10 ++ .history/src/Quad_20200511220045.cpp | 9 + .history/src/Quad_20200511220046.cpp | 10 ++ .history/src/Quad_20200511220105.cpp | 14 ++ .history/src/Quad_20200511220115.h | 25 +++ .history/src/Quad_20200511220118.h | 21 +++ .history/src/Quad_20200511220128.cpp | 14 ++ .history/src/Quad_20200511220143.cpp | 22 +++ .history/src/Quad_20200511220149.cpp | 22 +++ .history/src/Quad_20200511220152.h | 13 ++ .history/src/Quad_20200511220156.cpp | 22 +++ .history/src/Quad_20200512000121.cpp | 22 +++ .history/src/Quad_20200512000128.h | 13 ++ .history/src/Quad_20200512000132.h | 13 ++ .history/src/Quad_20200512000134.h | 13 ++ .history/src/Quad_20200512000139.h | 13 ++ .history/src/Quad_20200512010256.cpp | 23 +++ .history/src/Quad_20200512010259.cpp | 23 +++ .history/src/Quad_20200512010312.cpp | 24 +++ .history/src/Quad_20200512010331.cpp | 24 +++ .history/src/Quad_20200512010514.cpp | 23 +++ .history/src/Vertex_20200511171556.h | 0 .history/src/Vertex_20200511171606.h | 4 + .history/src/Vertex_20200511172125.h | 9 + .history/src/Vertex_20200511172637.h | 9 + .history/src/Vertex_20200511180436.h | 10 ++ .history/src/Vertex_20200511220207.cpp | 0 .history/src/Vertex_20200511220407.cpp | 7 + .history/src/Vertex_20200511220725.cpp | 9 + .history/src/Vertex_20200511220729.h | 6 + .history/src/Vertex_20200511220731.cpp | 9 + .history/src/Vertex_20200512010117.cpp | 10 ++ .history/src/Vertex_20200512010119.cpp | 10 ++ .history/src/Vertex_20200512010126.cpp | 10 ++ .history/src/Vertex_20200512010150.cpp | 10 ++ .history/src/Vertex_20200512010152.cpp | 11 ++ .history/src/Vertex_20200512010338.cpp | 11 ++ .history/src/color_20200511171454.h | 0 .history/src/color_20200511171508.h | 10 ++ .history/src/gl_20200511140709.cpp | 38 +++++ .history/src/gl_20200511175144.cpp | 38 +++++ .history/src/main_20200511141624.cpp | 120 ++++++++++++++ .history/src/main_20200511144632.cpp | 120 ++++++++++++++ .history/src/main_20200511145101.cpp | 120 ++++++++++++++ .history/src/main_20200511150605.cpp | 120 ++++++++++++++ .history/src/main_20200511151949.cpp | 120 ++++++++++++++ .history/src/main_20200511152157.cpp | 120 ++++++++++++++ .history/src/main_20200511152206.cpp | 120 ++++++++++++++ .history/src/main_20200511152249.cpp | 120 ++++++++++++++ .history/src/main_20200511152326.cpp | 121 ++++++++++++++ .history/src/main_20200511152538.cpp | 156 +++++++++++++++++ .history/src/main_20200511152716.cpp | 151 +++++++++++++++++ .history/src/main_20200511152836.cpp | 152 +++++++++++++++++ .history/src/main_20200511152956.cpp | 152 +++++++++++++++++ .history/src/main_20200511153000.cpp | 152 +++++++++++++++++ .history/src/main_20200511153143.cpp | 152 +++++++++++++++++ .history/src/main_20200511153153.cpp | 152 +++++++++++++++++ .history/src/main_20200511153206.cpp | 152 +++++++++++++++++ .history/src/main_20200511153351.cpp | 153 +++++++++++++++++ .history/src/main_20200511153439.cpp | 153 +++++++++++++++++ .history/src/main_20200511153501.cpp | 153 +++++++++++++++++ .history/src/main_20200511153512.cpp | 153 +++++++++++++++++ .history/src/main_20200511153525.cpp | 153 +++++++++++++++++ .history/src/main_20200511153527.cpp | 153 +++++++++++++++++ .history/src/main_20200511153536.cpp | 153 +++++++++++++++++ .history/src/main_20200511153539.cpp | 153 +++++++++++++++++ .history/src/main_20200511153548.cpp | 153 +++++++++++++++++ .history/src/main_20200511153600.cpp | 153 +++++++++++++++++ .history/src/main_20200511153617.cpp | 154 +++++++++++++++++ .history/src/main_20200511153630.cpp | 154 +++++++++++++++++ .history/src/main_20200511153654.cpp | 155 +++++++++++++++++ .history/src/main_20200511153655.cpp | 155 +++++++++++++++++ .history/src/main_20200511153712.cpp | 155 +++++++++++++++++ .history/src/main_20200511153828.cpp | 155 +++++++++++++++++ .history/src/main_20200511153840.cpp | 155 +++++++++++++++++ .history/src/main_20200511153905.cpp | 155 +++++++++++++++++ .history/src/main_20200511153910.cpp | 155 +++++++++++++++++ .history/src/main_20200511153920.cpp | 155 +++++++++++++++++ .history/src/main_20200511153926.cpp | 155 +++++++++++++++++ .history/src/main_20200511153948.cpp | 155 +++++++++++++++++ .history/src/main_20200511153957.cpp | 155 +++++++++++++++++ .history/src/main_20200511154013.cpp | 155 +++++++++++++++++ .history/src/main_20200511154031.cpp | 155 +++++++++++++++++ .history/src/main_20200511154055.cpp | 155 +++++++++++++++++ .history/src/main_20200511154127.cpp | 155 +++++++++++++++++ .history/src/main_20200511163804.cpp | 155 +++++++++++++++++ .history/src/main_20200511163907.cpp | 155 +++++++++++++++++ .history/src/main_20200511163917.cpp | 155 +++++++++++++++++ .history/src/main_20200511164038.cpp | 155 +++++++++++++++++ .history/src/main_20200511164730.cpp | 153 +++++++++++++++++ .history/src/main_20200511164948.cpp | 158 ++++++++++++++++++ .history/src/main_20200511165120.cpp | 163 ++++++++++++++++++ .history/src/main_20200511165122.cpp | 163 ++++++++++++++++++ .history/src/main_20200511165240.cpp | 168 +++++++++++++++++++ .history/src/main_20200511165437.cpp | 168 +++++++++++++++++++ .history/src/main_20200511165658.cpp | 171 +++++++++++++++++++ .history/src/main_20200511165816.cpp | 171 +++++++++++++++++++ .history/src/main_20200511165944.cpp | 181 ++++++++++++++++++++ .history/src/main_20200511165954.cpp | 181 ++++++++++++++++++++ .history/src/main_20200511170722.cpp | 187 +++++++++++++++++++++ .history/src/main_20200511170815.cpp | 189 +++++++++++++++++++++ .history/src/main_20200511170819.cpp | 189 +++++++++++++++++++++ .history/src/main_20200511170856.cpp | 189 +++++++++++++++++++++ .history/src/main_20200511170941.cpp | 189 +++++++++++++++++++++ .history/src/main_20200511171006.cpp | 189 +++++++++++++++++++++ .history/src/main_20200511171313.cpp | 201 ++++++++++++++++++++++ .history/src/main_20200511171319.cpp | 202 +++++++++++++++++++++++ .history/src/main_20200511171334.cpp | 202 +++++++++++++++++++++++ .history/src/main_20200511171517.cpp | 192 +++++++++++++++++++++ .history/src/main_20200511171546.cpp | 192 +++++++++++++++++++++ .history/src/main_20200511171549.cpp | 192 +++++++++++++++++++++ .history/src/main_20200511171615.cpp | 188 +++++++++++++++++++++ .history/src/main_20200511171753.cpp | 166 +++++++++++++++++++ .history/src/main_20200511175200.cpp | 166 +++++++++++++++++++ .history/src/main_20200511175201.cpp | 166 +++++++++++++++++++ .history/src/main_20200511175225.cpp | 167 +++++++++++++++++++ .history/src/main_20200511175904.cpp | 167 +++++++++++++++++++ .history/src/main_20200511180500.cpp | 167 +++++++++++++++++++ .history/src/main_20200511185350.cpp | 167 +++++++++++++++++++ .history/src/main_20200511185420.cpp | 134 +++++++++++++++ .history/src/main_20200511191949.cpp | 135 +++++++++++++++ .history/src/main_20200511192159.cpp | 139 ++++++++++++++++ .history/src/main_20200511194222.cpp | 141 ++++++++++++++++ .history/src/main_20200511194426.cpp | 146 ++++++++++++++++ .history/src/main_20200511194624.cpp | 148 +++++++++++++++++ .history/src/main_20200511194806.cpp | 150 +++++++++++++++++ .history/src/main_20200511194836.cpp | 151 +++++++++++++++++ .history/src/main_20200511194848.cpp | 151 +++++++++++++++++ .history/src/main_20200511194909.cpp | 152 +++++++++++++++++ .history/src/main_20200511194919.cpp | 151 +++++++++++++++++ .history/src/main_20200511195619.cpp | 152 +++++++++++++++++ .history/src/main_20200511195626.cpp | 152 +++++++++++++++++ .history/src/main_20200511195635.cpp | 152 +++++++++++++++++ .history/src/main_20200511195700.cpp | 152 +++++++++++++++++ .history/src/main_20200511195754.cpp | 155 +++++++++++++++++ .history/src/main_20200511195830.cpp | 158 ++++++++++++++++++ .history/src/main_20200511195907.cpp | 158 ++++++++++++++++++ .history/src/main_20200511195930.cpp | 158 ++++++++++++++++++ .history/src/main_20200511195933.cpp | 158 ++++++++++++++++++ .history/src/main_20200511195942.cpp | 158 ++++++++++++++++++ .history/src/main_20200511200052.cpp | 158 ++++++++++++++++++ .history/src/main_20200511200156.cpp | 158 ++++++++++++++++++ .history/src/main_20200511235857.cpp | 158 ++++++++++++++++++ .history/src/main_20200511235900.cpp | 158 ++++++++++++++++++ .history/src/main_20200511235911.cpp | 159 ++++++++++++++++++ .history/src/main_20200511235939.cpp | 159 ++++++++++++++++++ .history/src/main_20200512000104.cpp | 159 ++++++++++++++++++ .history/src/main_20200512000113.cpp | 159 ++++++++++++++++++ .history/src/main_20200512000411.cpp | 153 +++++++++++++++++ .history/src/main_20200512000429.cpp | 154 +++++++++++++++++ .history/src/main_20200512000549.cpp | 154 +++++++++++++++++ .history/src/main_20200512000614.cpp | 154 +++++++++++++++++ .history/src/main_20200512010342.cpp | 154 +++++++++++++++++ .history/src/main_20200512010405.cpp | 155 +++++++++++++++++ .history/src/main_20200512010408.cpp | 155 +++++++++++++++++ .history/src/main_20200512010440.cpp | 157 ++++++++++++++++++ .history/src/main_20200512010451.cpp | 159 ++++++++++++++++++ .history/src/main_20200512010535.cpp | 159 ++++++++++++++++++ .history/src/main_20200512010630.cpp | 159 ++++++++++++++++++ .history/src/main_20200512010633.cpp | 159 ++++++++++++++++++ .history/src/main_20200512010641.cpp | 159 ++++++++++++++++++ .history/src/main_20200512010651.cpp | 160 ++++++++++++++++++ .history/src/main_20200512010809.cpp | 164 ++++++++++++++++++ .history/src/main_20200512010815.cpp | 164 ++++++++++++++++++ .history/src/main_20200512010819.cpp | 164 ++++++++++++++++++ .history/src/main_20200512010823.cpp | 164 ++++++++++++++++++ .history/src/main_20200512010947.cpp | 164 ++++++++++++++++++ .history/src/main_20200512011009.cpp | 163 ++++++++++++++++++ .history/src/main_20200512011055.cpp | 163 ++++++++++++++++++ .history/src/main_20200512011126.cpp | 164 ++++++++++++++++++ .history/src/main_20200512011142.cpp | 165 ++++++++++++++++++ .history/src/main_20200512011153.cpp | 167 +++++++++++++++++++ .history/src/main_20200512011236.cpp | 168 +++++++++++++++++++ .history/src/main_20200512011317.cpp | 160 ++++++++++++++++++ .history/src/main_20200512011351.cpp | 162 ++++++++++++++++++ .history/src/main_20200512011417.cpp | 163 ++++++++++++++++++ .history/src/main_20200512011436.cpp | 164 ++++++++++++++++++ .history/src/main_20200512011507.cpp | 164 ++++++++++++++++++ .history/src/main_20200512011542.cpp | 164 ++++++++++++++++++ .history/src/main_20200512011547.cpp | 164 ++++++++++++++++++ .history/src/main_20200512011559.cpp | 164 ++++++++++++++++++ .history/src/main_20200512011641.cpp | 164 ++++++++++++++++++ .history/src/main_20200512011807.cpp | 162 ++++++++++++++++++ .history/src/main_20200512011831.cpp | 162 ++++++++++++++++++ .history/src/main_20200512011844.cpp | 162 ++++++++++++++++++ .history/src/main_20200512011858.cpp | 162 ++++++++++++++++++ .history/src/main_20200512011906.cpp | 160 ++++++++++++++++++ .kdev4/hs-cpp.kdev4 | 2 + .vscode/settings.json | 25 +++ Makefile | 4 + Makefile.bak | 40 +++++ hs-cpp.kdev4 | 4 + src/Color.cpp | 9 + src/Color.h | 13 ++ src/Cube.cpp | 40 +++++ src/Cube.h | 26 +++ src/Quad.cpp | 23 +++ src/Quad.h | 13 ++ src/Vertex.cpp | 11 ++ src/Vertex.h | 6 + src/main.cpp | 160 ++++++++++++++++++ 506 files changed, 31836 insertions(+) create mode 100644 .history/Makefile_20200511140830 create mode 100644 .history/Makefile_20200511200301 create mode 100644 .history/Makefile_20200511200400 create mode 100644 .history/Makefile_20200511201938 create mode 100644 .history/Makefile_20200511201953 create mode 100644 .history/Makefile_20200511202032 create mode 100644 .history/Makefile_20200511202051 create mode 100644 .history/Makefile_20200511202102 create mode 100644 .history/Makefile_20200511202110 create mode 100644 .history/Makefile_20200511202111 create mode 100644 .history/Makefile_20200511202113 create mode 100644 .history/Makefile_20200511202207 create mode 100644 .history/Makefile_20200511202225 create mode 100644 .history/Makefile_20200511202244 create mode 100644 .history/Makefile_20200511202254 create mode 100644 .history/Makefile_20200511222404 create mode 100644 .history/Makefile_20200511222408 create mode 100644 .history/Makefile_20200511222417 create mode 100644 .history/Makefile_20200511222546 create mode 100644 .history/Makefile_20200511222552 create mode 100644 .history/Makefile_20200511222632 create mode 100644 .history/Makefile_20200511223118 create mode 100644 .history/Makefile_20200511232417 create mode 100644 .history/Makefile_20200511232942 create mode 100644 .history/Makefile_20200511232949 create mode 100644 .history/Makefile_20200511233258 create mode 100644 .history/Makefile_20200511233332 create mode 100644 .history/Makefile_20200511233403 create mode 100644 .history/Makefile_20200511233423 create mode 100644 .history/Makefile_20200511233451 create mode 100644 .history/Makefile_20200511233512 create mode 100644 .history/Makefile_20200511233531 create mode 100644 .history/Makefile_20200511233537 create mode 100644 .history/Makefile_20200511233619 create mode 100644 .history/Makefile_20200511233631 create mode 100644 .history/Makefile_20200511233633 create mode 100644 .history/Makefile_20200511233703 create mode 100644 .history/Makefile_20200511233707 create mode 100644 .history/Makefile_20200511233714 create mode 100644 .history/Makefile_20200511233726 create mode 100644 .history/Makefile_20200511233826 create mode 100644 .history/Makefile_20200511233926 create mode 100644 .history/Makefile_20200511233935 create mode 100644 .history/Makefile_20200511233946 create mode 100644 .history/Makefile_20200511234024 create mode 100644 .history/Makefile_20200511234030 create mode 100644 .history/Makefile_20200511234130 create mode 100644 .history/Makefile_20200511234218 create mode 100644 .history/Makefile_20200511234223 create mode 100644 .history/Makefile_20200511234429 create mode 100644 .history/Makefile_20200511234457 create mode 100644 .history/Makefile_20200511234505 create mode 100644 .history/Makefile_20200511234522 create mode 100644 .history/Makefile_20200511234615 create mode 100644 .history/Makefile_20200511234621 create mode 100644 .history/Makefile_20200511234639 create mode 100644 .history/Makefile_20200511234646 create mode 100644 .history/Makefile_20200511235501 create mode 100644 .history/Makefile_20200511235522 create mode 100644 .history/Makefile_20200511235543 create mode 100644 .history/Makefile_20200511235607 create mode 100644 .history/Makefile_20200511235632 create mode 100644 .history/Makefile_20200511235725 create mode 100644 .history/Makefile_20200511235727 create mode 100644 .history/Makefile_20200511235737 create mode 100644 .history/Makefile_20200511235920 create mode 100644 .history/Makefile_20200512000709 create mode 100644 .history/Makefile_20200512001624 create mode 100644 .history/Makefile_20200512001633 create mode 100644 .history/Makefile_20200512001749 create mode 100644 .history/Makefile_20200512001840 create mode 100644 .history/Makefile_20200512001924 create mode 100644 .history/Makefile_20200512001959 create mode 100644 .history/Makefile_20200512002002 create mode 100644 .history/Makefile_20200512002353 create mode 100644 .history/Makefile_20200512002453 create mode 100644 .history/Makefile_20200512002502 create mode 100644 .history/Makefile_20200512002516 create mode 100644 .history/Makefile_20200512002533 create mode 100644 .history/Makefile_20200512002632 create mode 100644 .history/Makefile_20200512002654 create mode 100644 .history/Makefile_20200512002708 create mode 100644 .history/Makefile_20200512002742 create mode 100644 .history/Makefile_20200512002756 create mode 100644 .history/Makefile_20200512003649 create mode 100644 .history/Makefile_20200512003657 create mode 100644 .history/Makefile_20200512003732 create mode 100644 .history/Makefile_20200512003757 create mode 100644 .history/Makefile_20200512003818 create mode 100644 .history/Makefile_20200512003822 create mode 100644 .history/Makefile_20200512003829 create mode 100644 .history/Makefile_20200512003842 create mode 100644 .history/Makefile_20200512003911 create mode 100644 .history/Makefile_20200512003927 create mode 100644 .history/Makefile_20200512003938 create mode 100644 .history/Makefile_20200512004016 create mode 100644 .history/Makefile_20200512004205 create mode 100644 .history/Makefile_20200512005117 create mode 100644 .history/Makefile_20200512005124 create mode 100644 .history/Makefile_20200512005227 create mode 100644 .history/Makefile_20200512005507 create mode 100644 .history/Makefile_20200512005538 create mode 100644 .history/Makefile_20200512005607 create mode 100644 .history/Makefile_20200512005648 create mode 100644 .history/Makefile_20200512005729 create mode 100644 .history/Makefile_20200512005741 create mode 100644 .history/Makefile_20200512005803 create mode 100644 .history/Makefile_20200512005826 create mode 100644 .history/Makefile_20200512005851 create mode 100644 .history/Makefile_20200512005925 create mode 100644 .history/Makefile_20200512005944 create mode 100644 .history/Makefile_20200512010012 create mode 100644 .history/Makefile_20200512095009 create mode 100644 .history/Makefile_20200512095614 create mode 100644 .history/Makefile_20200512095616 create mode 100644 .history/Makefile_20200512113711 create mode 100644 .history/Makefile_20200512122020 create mode 100644 .history/Makefile_20200512122058 create mode 100644 .history/Makefile_20200512122134 create mode 100644 .history/Makefile_20200512122202 create mode 100644 .history/Makefile_20200512122220 create mode 100644 .history/Makefile_20200512122241 create mode 100644 .history/Makefile_20200512122259 create mode 100644 .history/Makefile_20200512122307 create mode 100644 .history/Makefile_20200512122440 create mode 100644 .history/Makefile_20200512122803 create mode 100644 .history/Makefile_20200512122821 create mode 100644 .history/Makefile_20200512122910 create mode 100644 .history/Makefile_20200512145408 create mode 100644 .history/Makefile_20200512145509 create mode 100644 .history/Makefile_20200512145543 create mode 100644 .history/Makefile_20200512145729 create mode 100644 .history/Makefile_20200512145745 create mode 100644 .history/Makefile_20200513122930 create mode 100644 .history/Makefile_20200513122959 create mode 100644 .history/Makefile_20200513123017 create mode 100644 .history/Makefile_20200513123140 create mode 100644 .history/Makefile_20200513123200 create mode 100644 .history/Makefile_20200513123243 create mode 100644 .history/Makefile_20200513123410 create mode 100644 .history/Makefile_20200513123423 create mode 100644 .history/Makefile_20200513123433 create mode 100644 .history/Makefile_20200513123441 create mode 100644 .history/Makefile_20200513123514 create mode 100644 .history/Makefile_20200513123603 create mode 100644 .history/Makefile_20200513123629 create mode 100644 .history/Makefile_20200513123759 create mode 100644 .history/Makefile_20200513123840 create mode 100644 .history/Makefile_20200513123854 create mode 100644 .history/Makefile_20200513123905 create mode 100644 .history/Makefile_20200513124216 create mode 100644 .history/Makefile_20200513124320 create mode 100644 .history/Makefile_20200513124438 create mode 100644 .history/Makefile_20200513124541 create mode 100644 .history/Makefile_20200513124558 create mode 100644 .history/Makefile_20200513124608 create mode 100644 .history/Makefile_20200513124624 create mode 100644 .history/Makefile_20200513125013 create mode 100644 .history/Makefile_20200513125052 create mode 100644 .history/Makefile_20200513125126 create mode 100644 .history/Makefile_20200513125143 create mode 100644 .history/Makefile_20200513125206 create mode 100644 .history/Makefile_20200513125218 create mode 100644 .history/Makefile_20200513125946 create mode 100644 .history/Makefile_20200513130104 create mode 100644 .history/Makefile_20200513130117 create mode 100644 .history/Makefile_20200513130353 create mode 100644 .history/Makefile_20200513130432 create mode 100644 .history/Makefile_20200513130456 create mode 100644 .history/Makefile_20200513130508 create mode 100644 .history/Makefile_20200513130809 create mode 100644 .history/Makefile_20200513130839 create mode 100644 .history/Makefile_20200513130844 create mode 100644 .history/Makefile_20200513130854 create mode 100644 .history/Makefile_20200513130906 create mode 100644 .history/Makefile_20200513130915 create mode 100644 .history/Makefile_20200513130933 create mode 100644 .history/Makefile_20200513131004 create mode 100644 .history/Makefile_20200513131017 create mode 100644 .history/Makefile_20200513131041 create mode 100644 .history/Makefile_20200513131048 create mode 100644 .history/Makefile_20200513131123 create mode 100644 .history/Makefile_20200513131132 create mode 100644 .history/Makefile_20200513131146 create mode 100644 .history/Makefile_20200513131336 create mode 100644 .history/Makefile_20200513131344 create mode 100644 .history/Makefile_20200513131602 create mode 100644 .history/Makefile_20200513131621 create mode 100644 .history/Makefile_20200513131845 create mode 100644 .history/Makefile_20200513131940 create mode 100644 .history/Makefile_20200513132006 create mode 100644 .history/Makefile_20200513132016 create mode 100644 .history/Makefile_20200513132905 create mode 100644 .history/Makefile_20200513132931 create mode 100644 .history/Makefile_20200513132942 create mode 100644 .history/Makefile_20200513134126 create mode 100644 .history/Makefile_20200513134548 create mode 100644 .history/Makefile_20200513135257 create mode 100644 .history/generatecube_20200511164401.lua create mode 100644 .history/generatecube_20200511171029.lua create mode 100644 .history/src/Color_20200511171542.h create mode 100644 .history/src/Color_20200511175158.h create mode 100644 .history/src/Color_20200511175840.h create mode 100644 .history/src/Color_20200511175845.h create mode 100644 .history/src/Color_20200511175902.h create mode 100644 .history/src/Color_20200511180426.h create mode 100644 .history/src/Color_20200511180509.h create mode 100644 .history/src/Color_20200511184059.h create mode 100644 .history/src/Color_20200511184834.h create mode 100644 .history/src/Color_20200511184840.h create mode 100644 .history/src/Color_20200511185132.h create mode 100644 .history/src/Color_20200511195616.h create mode 100644 .history/src/Color_20200511214107.cpp create mode 100644 .history/src/Color_20200511214344.cpp create mode 100644 .history/src/Color_20200511214346.cpp create mode 100644 .history/src/Color_20200511214352.cpp create mode 100644 .history/src/Color_20200511214540.h create mode 100644 .history/src/Color_20200511214543.cpp create mode 100644 .history/src/Color_20200511214549.cpp create mode 100644 .history/src/Color_20200511214553.h create mode 100644 .history/src/Color_20200511214556.h create mode 100644 .history/src/Color_20200511214607.h create mode 100644 .history/src/Color_20200511214903.h create mode 100644 .history/src/Color_20200511214929.cpp create mode 100644 .history/src/Color_20200511215000.cpp create mode 100644 .history/src/Color_20200511215006.cpp create mode 100644 .history/src/Color_20200511215017.cpp create mode 100644 .history/src/Color_20200511215019.cpp create mode 100644 .history/src/Color_20200511215026.cpp create mode 100644 .history/src/Color_20200511215048.cpp create mode 100644 .history/src/Color_20200512000019.h create mode 100644 .history/src/Color_20200512000031.h create mode 100644 .history/src/Color_20200512000048.cpp create mode 100644 .history/src/Color_20200512011729.h create mode 100644 .history/src/Color_20200512011730.h create mode 100644 .history/src/Cube_20200511182530.h create mode 100644 .history/src/Cube_20200511182542.h create mode 100644 .history/src/Cube_20200511183329.h create mode 100644 .history/src/Cube_20200511183343.h create mode 100644 .history/src/Cube_20200511183548.h create mode 100644 .history/src/Cube_20200511184002.h create mode 100644 .history/src/Cube_20200511184009.h create mode 100644 .history/src/Cube_20200511184116.h create mode 100644 .history/src/Cube_20200511184202.h create mode 100644 .history/src/Cube_20200511184203.h create mode 100644 .history/src/Cube_20200511184209.h create mode 100644 .history/src/Cube_20200511184212.h create mode 100644 .history/src/Cube_20200511184523.h create mode 100644 .history/src/Cube_20200511184555.h create mode 100644 .history/src/Cube_20200511184633.h create mode 100644 .history/src/Cube_20200511184644.h create mode 100644 .history/src/Cube_20200511185025.h create mode 100644 .history/src/Cube_20200511200128.h create mode 100644 .history/src/Cube_20200511215053.cpp create mode 100644 .history/src/Cube_20200511215349.cpp create mode 100644 .history/src/Cube_20200511215400.cpp create mode 100644 .history/src/Cube_20200511215430.cpp create mode 100644 .history/src/Cube_20200511215539.cpp create mode 100644 .history/src/Cube_20200511215544.cpp create mode 100644 .history/src/Cube_20200511215553.h create mode 100644 .history/src/Cube_20200511215555.h create mode 100644 .history/src/Cube_20200511215557.h create mode 100644 .history/src/Cube_20200511215604.h create mode 100644 .history/src/Cube_20200511215610.h create mode 100644 .history/src/Cube_20200511215619.h create mode 100644 .history/src/Cube_20200511215638.cpp create mode 100644 .history/src/Cube_20200511215641.cpp create mode 100644 .history/src/Cube_20200511215657.h create mode 100644 .history/src/Cube_20200511215708.h create mode 100644 .history/src/Cube_20200511215722.cpp create mode 100644 .history/src/Cube_20200512000150.h create mode 100644 .history/src/Cube_20200512000152.h create mode 100644 .history/src/Cube_20200512000204.cpp create mode 100644 .history/src/Cube_20200512005406.h create mode 100644 .history/src/Cube_20200512005416.h create mode 100644 .history/src/Quad_20200511171624.h create mode 100644 .history/src/Quad_20200511171639.h create mode 100644 .history/src/Quad_20200511171657.h create mode 100644 .history/src/Quad_20200511171706.h create mode 100644 .history/src/Quad_20200511171710.h create mode 100644 .history/src/Quad_20200511171713.h create mode 100644 .history/src/Quad_20200511171740.h create mode 100644 .history/src/Quad_20200511175511.h create mode 100644 .history/src/Quad_20200511175543.h create mode 100644 .history/src/Quad_20200511175550.h create mode 100644 .history/src/Quad_20200511175556.h create mode 100644 .history/src/Quad_20200511175559.h create mode 100644 .history/src/Quad_20200511175623.h create mode 100644 .history/src/Quad_20200511175926.h create mode 100644 .history/src/Quad_20200511175932.h create mode 100644 .history/src/Quad_20200511184026.h create mode 100644 .history/src/Quad_20200511184038.h create mode 100644 .history/src/Quad_20200511184041.h create mode 100644 .history/src/Quad_20200511184044.h create mode 100644 .history/src/Quad_20200511184053.h create mode 100644 .history/src/Quad_20200511184056.h create mode 100644 .history/src/Quad_20200511184723.h create mode 100644 .history/src/Quad_20200511184816.h create mode 100644 .history/src/Quad_20200511185058.h create mode 100644 .history/src/Quad_20200511200147.h create mode 100644 .history/src/Quad_20200511215736.cpp create mode 100644 .history/src/Quad_20200511215936.cpp create mode 100644 .history/src/Quad_20200511220007.cpp create mode 100644 .history/src/Quad_20200511220027.h create mode 100644 .history/src/Quad_20200511220042.cpp create mode 100644 .history/src/Quad_20200511220043.cpp create mode 100644 .history/src/Quad_20200511220045.cpp create mode 100644 .history/src/Quad_20200511220046.cpp create mode 100644 .history/src/Quad_20200511220105.cpp create mode 100644 .history/src/Quad_20200511220115.h create mode 100644 .history/src/Quad_20200511220118.h create mode 100644 .history/src/Quad_20200511220128.cpp create mode 100644 .history/src/Quad_20200511220143.cpp create mode 100644 .history/src/Quad_20200511220149.cpp create mode 100644 .history/src/Quad_20200511220152.h create mode 100644 .history/src/Quad_20200511220156.cpp create mode 100644 .history/src/Quad_20200512000121.cpp create mode 100644 .history/src/Quad_20200512000128.h create mode 100644 .history/src/Quad_20200512000132.h create mode 100644 .history/src/Quad_20200512000134.h create mode 100644 .history/src/Quad_20200512000139.h create mode 100644 .history/src/Quad_20200512010256.cpp create mode 100644 .history/src/Quad_20200512010259.cpp create mode 100644 .history/src/Quad_20200512010312.cpp create mode 100644 .history/src/Quad_20200512010331.cpp create mode 100644 .history/src/Quad_20200512010514.cpp create mode 100644 .history/src/Vertex_20200511171556.h create mode 100644 .history/src/Vertex_20200511171606.h create mode 100644 .history/src/Vertex_20200511172125.h create mode 100644 .history/src/Vertex_20200511172637.h create mode 100644 .history/src/Vertex_20200511180436.h create mode 100644 .history/src/Vertex_20200511220207.cpp create mode 100644 .history/src/Vertex_20200511220407.cpp create mode 100644 .history/src/Vertex_20200511220725.cpp create mode 100644 .history/src/Vertex_20200511220729.h create mode 100644 .history/src/Vertex_20200511220731.cpp create mode 100644 .history/src/Vertex_20200512010117.cpp create mode 100644 .history/src/Vertex_20200512010119.cpp create mode 100644 .history/src/Vertex_20200512010126.cpp create mode 100644 .history/src/Vertex_20200512010150.cpp create mode 100644 .history/src/Vertex_20200512010152.cpp create mode 100644 .history/src/Vertex_20200512010338.cpp create mode 100644 .history/src/color_20200511171454.h create mode 100644 .history/src/color_20200511171508.h create mode 100644 .history/src/gl_20200511140709.cpp create mode 100644 .history/src/gl_20200511175144.cpp create mode 100644 .history/src/main_20200511141624.cpp create mode 100644 .history/src/main_20200511144632.cpp create mode 100644 .history/src/main_20200511145101.cpp create mode 100644 .history/src/main_20200511150605.cpp create mode 100644 .history/src/main_20200511151949.cpp create mode 100644 .history/src/main_20200511152157.cpp create mode 100644 .history/src/main_20200511152206.cpp create mode 100644 .history/src/main_20200511152249.cpp create mode 100644 .history/src/main_20200511152326.cpp create mode 100644 .history/src/main_20200511152538.cpp create mode 100644 .history/src/main_20200511152716.cpp create mode 100644 .history/src/main_20200511152836.cpp create mode 100644 .history/src/main_20200511152956.cpp create mode 100644 .history/src/main_20200511153000.cpp create mode 100644 .history/src/main_20200511153143.cpp create mode 100644 .history/src/main_20200511153153.cpp create mode 100644 .history/src/main_20200511153206.cpp create mode 100644 .history/src/main_20200511153351.cpp create mode 100644 .history/src/main_20200511153439.cpp create mode 100644 .history/src/main_20200511153501.cpp create mode 100644 .history/src/main_20200511153512.cpp create mode 100644 .history/src/main_20200511153525.cpp create mode 100644 .history/src/main_20200511153527.cpp create mode 100644 .history/src/main_20200511153536.cpp create mode 100644 .history/src/main_20200511153539.cpp create mode 100644 .history/src/main_20200511153548.cpp create mode 100644 .history/src/main_20200511153600.cpp create mode 100644 .history/src/main_20200511153617.cpp create mode 100644 .history/src/main_20200511153630.cpp create mode 100644 .history/src/main_20200511153654.cpp create mode 100644 .history/src/main_20200511153655.cpp create mode 100644 .history/src/main_20200511153712.cpp create mode 100644 .history/src/main_20200511153828.cpp create mode 100644 .history/src/main_20200511153840.cpp create mode 100644 .history/src/main_20200511153905.cpp create mode 100644 .history/src/main_20200511153910.cpp create mode 100644 .history/src/main_20200511153920.cpp create mode 100644 .history/src/main_20200511153926.cpp create mode 100644 .history/src/main_20200511153948.cpp create mode 100644 .history/src/main_20200511153957.cpp create mode 100644 .history/src/main_20200511154013.cpp create mode 100644 .history/src/main_20200511154031.cpp create mode 100644 .history/src/main_20200511154055.cpp create mode 100644 .history/src/main_20200511154127.cpp create mode 100644 .history/src/main_20200511163804.cpp create mode 100644 .history/src/main_20200511163907.cpp create mode 100644 .history/src/main_20200511163917.cpp create mode 100644 .history/src/main_20200511164038.cpp create mode 100644 .history/src/main_20200511164730.cpp create mode 100644 .history/src/main_20200511164948.cpp create mode 100644 .history/src/main_20200511165120.cpp create mode 100644 .history/src/main_20200511165122.cpp create mode 100644 .history/src/main_20200511165240.cpp create mode 100644 .history/src/main_20200511165437.cpp create mode 100644 .history/src/main_20200511165658.cpp create mode 100644 .history/src/main_20200511165816.cpp create mode 100644 .history/src/main_20200511165944.cpp create mode 100644 .history/src/main_20200511165954.cpp create mode 100644 .history/src/main_20200511170722.cpp create mode 100644 .history/src/main_20200511170815.cpp create mode 100644 .history/src/main_20200511170819.cpp create mode 100644 .history/src/main_20200511170856.cpp create mode 100644 .history/src/main_20200511170941.cpp create mode 100644 .history/src/main_20200511171006.cpp create mode 100644 .history/src/main_20200511171313.cpp create mode 100644 .history/src/main_20200511171319.cpp create mode 100644 .history/src/main_20200511171334.cpp create mode 100644 .history/src/main_20200511171517.cpp create mode 100644 .history/src/main_20200511171546.cpp create mode 100644 .history/src/main_20200511171549.cpp create mode 100644 .history/src/main_20200511171615.cpp create mode 100644 .history/src/main_20200511171753.cpp create mode 100644 .history/src/main_20200511175200.cpp create mode 100644 .history/src/main_20200511175201.cpp create mode 100644 .history/src/main_20200511175225.cpp create mode 100644 .history/src/main_20200511175904.cpp create mode 100644 .history/src/main_20200511180500.cpp create mode 100644 .history/src/main_20200511185350.cpp create mode 100644 .history/src/main_20200511185420.cpp create mode 100644 .history/src/main_20200511191949.cpp create mode 100644 .history/src/main_20200511192159.cpp create mode 100644 .history/src/main_20200511194222.cpp create mode 100644 .history/src/main_20200511194426.cpp create mode 100644 .history/src/main_20200511194624.cpp create mode 100644 .history/src/main_20200511194806.cpp create mode 100644 .history/src/main_20200511194836.cpp create mode 100644 .history/src/main_20200511194848.cpp create mode 100644 .history/src/main_20200511194909.cpp create mode 100644 .history/src/main_20200511194919.cpp create mode 100644 .history/src/main_20200511195619.cpp create mode 100644 .history/src/main_20200511195626.cpp create mode 100644 .history/src/main_20200511195635.cpp create mode 100644 .history/src/main_20200511195700.cpp create mode 100644 .history/src/main_20200511195754.cpp create mode 100644 .history/src/main_20200511195830.cpp create mode 100644 .history/src/main_20200511195907.cpp create mode 100644 .history/src/main_20200511195930.cpp create mode 100644 .history/src/main_20200511195933.cpp create mode 100644 .history/src/main_20200511195942.cpp create mode 100644 .history/src/main_20200511200052.cpp create mode 100644 .history/src/main_20200511200156.cpp create mode 100644 .history/src/main_20200511235857.cpp create mode 100644 .history/src/main_20200511235900.cpp create mode 100644 .history/src/main_20200511235911.cpp create mode 100644 .history/src/main_20200511235939.cpp create mode 100644 .history/src/main_20200512000104.cpp create mode 100644 .history/src/main_20200512000113.cpp create mode 100644 .history/src/main_20200512000411.cpp create mode 100644 .history/src/main_20200512000429.cpp create mode 100644 .history/src/main_20200512000549.cpp create mode 100644 .history/src/main_20200512000614.cpp create mode 100644 .history/src/main_20200512010342.cpp create mode 100644 .history/src/main_20200512010405.cpp create mode 100644 .history/src/main_20200512010408.cpp create mode 100644 .history/src/main_20200512010440.cpp create mode 100644 .history/src/main_20200512010451.cpp create mode 100644 .history/src/main_20200512010535.cpp create mode 100644 .history/src/main_20200512010630.cpp create mode 100644 .history/src/main_20200512010633.cpp create mode 100644 .history/src/main_20200512010641.cpp create mode 100644 .history/src/main_20200512010651.cpp create mode 100644 .history/src/main_20200512010809.cpp create mode 100644 .history/src/main_20200512010815.cpp create mode 100644 .history/src/main_20200512010819.cpp create mode 100644 .history/src/main_20200512010823.cpp create mode 100644 .history/src/main_20200512010947.cpp create mode 100644 .history/src/main_20200512011009.cpp create mode 100644 .history/src/main_20200512011055.cpp create mode 100644 .history/src/main_20200512011126.cpp create mode 100644 .history/src/main_20200512011142.cpp create mode 100644 .history/src/main_20200512011153.cpp create mode 100644 .history/src/main_20200512011236.cpp create mode 100644 .history/src/main_20200512011317.cpp create mode 100644 .history/src/main_20200512011351.cpp create mode 100644 .history/src/main_20200512011417.cpp create mode 100644 .history/src/main_20200512011436.cpp create mode 100644 .history/src/main_20200512011507.cpp create mode 100644 .history/src/main_20200512011542.cpp create mode 100644 .history/src/main_20200512011547.cpp create mode 100644 .history/src/main_20200512011559.cpp create mode 100644 .history/src/main_20200512011641.cpp create mode 100644 .history/src/main_20200512011807.cpp create mode 100644 .history/src/main_20200512011831.cpp create mode 100644 .history/src/main_20200512011844.cpp create mode 100644 .history/src/main_20200512011858.cpp create mode 100644 .history/src/main_20200512011906.cpp create mode 100644 .kdev4/hs-cpp.kdev4 create mode 100644 .vscode/settings.json create mode 100644 Makefile create mode 100644 Makefile.bak create mode 100644 hs-cpp.kdev4 create mode 100644 src/Color.cpp create mode 100644 src/Color.h create mode 100644 src/Cube.cpp create mode 100644 src/Cube.h create mode 100644 src/Quad.cpp create mode 100644 src/Quad.h create mode 100644 src/Vertex.cpp create mode 100644 src/Vertex.h create mode 100644 src/main.cpp diff --git a/.history/Makefile_20200511140830 b/.history/Makefile_20200511140830 new file mode 100644 index 0000000..c088c1a --- /dev/null +++ b/.history/Makefile_20200511140830 @@ -0,0 +1,16 @@ +CC = clang +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall + +all: build ; + +targets = ./src/*.cpp + +build: $(targets) ; + $(CC) $(DBG) ./src/main.cpp -o ./bin/main.o $(LINK) + +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main.o diff --git a/.history/Makefile_20200511200301 b/.history/Makefile_20200511200301 new file mode 100644 index 0000000..c088c1a --- /dev/null +++ b/.history/Makefile_20200511200301 @@ -0,0 +1,16 @@ +CC = clang +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall + +all: build ; + +targets = ./src/*.cpp + +build: $(targets) ; + $(CC) $(DBG) ./src/main.cpp -o ./bin/main.o $(LINK) + +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main.o diff --git a/.history/Makefile_20200511200400 b/.history/Makefile_20200511200400 new file mode 100644 index 0000000..19eaee0 --- /dev/null +++ b/.history/Makefile_20200511200400 @@ -0,0 +1,17 @@ +CC = clang +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall + +all: build ; + +targets = ./src/*.cpp +targets += ./src/*.h + +build: $(targets) ; + $(CC) $(DBG) ./src/main.cpp -o ./bin/main.o $(LINK) + +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main.o diff --git a/.history/Makefile_20200511201938 b/.history/Makefile_20200511201938 new file mode 100644 index 0000000..19eaee0 --- /dev/null +++ b/.history/Makefile_20200511201938 @@ -0,0 +1,17 @@ +CC = clang +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall + +all: build ; + +targets = ./src/*.cpp +targets += ./src/*.h + +build: $(targets) ; + $(CC) $(DBG) ./src/main.cpp -o ./bin/main.o $(LINK) + +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main.o diff --git a/.history/Makefile_20200511201953 b/.history/Makefile_20200511201953 new file mode 100644 index 0000000..60451b1 --- /dev/null +++ b/.history/Makefile_20200511201953 @@ -0,0 +1,16 @@ +CC = clang +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall + +all: build ; + +targets = ./src/*.cpp ./src/*.h + +build: $(targets) ; + $(CC) $(DBG) ./src/main.cpp -o ./bin/main.o $(LINK) + +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main.o diff --git a/.history/Makefile_20200511202032 b/.history/Makefile_20200511202032 new file mode 100644 index 0000000..a0eda76 --- /dev/null +++ b/.history/Makefile_20200511202032 @@ -0,0 +1,16 @@ +CC = clang +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall + +all: build ; + +targets = ./src/*.cpp ./src/*.h + +build: $(targets) ; + $(CC) $(DBG) $(targets) -o ./bin/main.o $(LINK) + +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main.o diff --git a/.history/Makefile_20200511202051 b/.history/Makefile_20200511202051 new file mode 100644 index 0000000..3254380 --- /dev/null +++ b/.history/Makefile_20200511202051 @@ -0,0 +1,16 @@ +CC = clang +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall + +all: build ; + +targets = ./src/*.cpp ./src/*.h + +build: $(targets) ; + $(CC) $(DBG) $(targets) -o ./bin/ $(LINK) + +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main.o diff --git a/.history/Makefile_20200511202102 b/.history/Makefile_20200511202102 new file mode 100644 index 0000000..3bd73c7 --- /dev/null +++ b/.history/Makefile_20200511202102 @@ -0,0 +1,16 @@ +CC = clang +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall + +all: build ; + +targets = ./src/*.cpp ./src/*.h + +build: $(targets) ; + $(CC) $(DBG) $(targets) -o $(LINK) + +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main.o diff --git a/.history/Makefile_20200511202110 b/.history/Makefile_20200511202110 new file mode 100644 index 0000000..9935baf --- /dev/null +++ b/.history/Makefile_20200511202110 @@ -0,0 +1,16 @@ +CC = clang +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall + +all: build ; + +targets = ./src/*.cpp ./src/*.h + +build: $(targets) ; + $(CC) $(DBG) $(targets)$(LINK) + +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main.o diff --git a/.history/Makefile_20200511202111 b/.history/Makefile_20200511202111 new file mode 100644 index 0000000..9935baf --- /dev/null +++ b/.history/Makefile_20200511202111 @@ -0,0 +1,16 @@ +CC = clang +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall + +all: build ; + +targets = ./src/*.cpp ./src/*.h + +build: $(targets) ; + $(CC) $(DBG) $(targets)$(LINK) + +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main.o diff --git a/.history/Makefile_20200511202113 b/.history/Makefile_20200511202113 new file mode 100644 index 0000000..88a9863 --- /dev/null +++ b/.history/Makefile_20200511202113 @@ -0,0 +1,16 @@ +CC = clang +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall + +all: build ; + +targets = ./src/*.cpp ./src/*.h + +build: $(targets) ; + $(CC) $(DBG) $(targets) $(LINK) + +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main.o diff --git a/.history/Makefile_20200511202207 b/.history/Makefile_20200511202207 new file mode 100644 index 0000000..52ca0fd --- /dev/null +++ b/.history/Makefile_20200511202207 @@ -0,0 +1,16 @@ +CC = clang +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall + +all: build ; + +targets = ./src/*.cpp ./src/*.h + +build: $(targets) ; + $(CC) $(DBG) ./src/main.cpp $(LINK) + +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main.o diff --git a/.history/Makefile_20200511202225 b/.history/Makefile_20200511202225 new file mode 100644 index 0000000..0fa6c21 --- /dev/null +++ b/.history/Makefile_20200511202225 @@ -0,0 +1,16 @@ +CC = clang +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall + +all: build ; + +targets = ./src/*.cpp ./src/*.h + +build: $(targets) ; + $(CC) $(DBG) ./src/main.cpp -o ./src/main.o $(LINK) + +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main.o diff --git a/.history/Makefile_20200511202244 b/.history/Makefile_20200511202244 new file mode 100644 index 0000000..60451b1 --- /dev/null +++ b/.history/Makefile_20200511202244 @@ -0,0 +1,16 @@ +CC = clang +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall + +all: build ; + +targets = ./src/*.cpp ./src/*.h + +build: $(targets) ; + $(CC) $(DBG) ./src/main.cpp -o ./bin/main.o $(LINK) + +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main.o diff --git a/.history/Makefile_20200511202254 b/.history/Makefile_20200511202254 new file mode 100644 index 0000000..60451b1 --- /dev/null +++ b/.history/Makefile_20200511202254 @@ -0,0 +1,16 @@ +CC = clang +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall + +all: build ; + +targets = ./src/*.cpp ./src/*.h + +build: $(targets) ; + $(CC) $(DBG) ./src/main.cpp -o ./bin/main.o $(LINK) + +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main.o diff --git a/.history/Makefile_20200511222404 b/.history/Makefile_20200511222404 new file mode 100644 index 0000000..ced9bae --- /dev/null +++ b/.history/Makefile_20200511222404 @@ -0,0 +1,17 @@ +CC = clang +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall + +all: build ; + +targets = ./src/*.cpp ./src/*.h + +build: $(targets) ; + $(CC) $(DBG) ./src/main.cpp -o ./bin/main.o $(LINK) + +.PHONY +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main.o diff --git a/.history/Makefile_20200511222408 b/.history/Makefile_20200511222408 new file mode 100644 index 0000000..c3d6287 --- /dev/null +++ b/.history/Makefile_20200511222408 @@ -0,0 +1,17 @@ +CC = clang +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall + +all: build ; + +targets = ./src/*.cpp ./src/*.h + +build: $(targets) ; + $(CC) $(DBG) ./src/main.cpp -o ./bin/main.o $(LINK) + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main.o diff --git a/.history/Makefile_20200511222417 b/.history/Makefile_20200511222417 new file mode 100644 index 0000000..c3d6287 --- /dev/null +++ b/.history/Makefile_20200511222417 @@ -0,0 +1,17 @@ +CC = clang +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall + +all: build ; + +targets = ./src/*.cpp ./src/*.h + +build: $(targets) ; + $(CC) $(DBG) ./src/main.cpp -o ./bin/main.o $(LINK) + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main.o diff --git a/.history/Makefile_20200511222546 b/.history/Makefile_20200511222546 new file mode 100644 index 0000000..c3d6287 --- /dev/null +++ b/.history/Makefile_20200511222546 @@ -0,0 +1,17 @@ +CC = clang +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall + +all: build ; + +targets = ./src/*.cpp ./src/*.h + +build: $(targets) ; + $(CC) $(DBG) ./src/main.cpp -o ./bin/main.o $(LINK) + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main.o diff --git a/.history/Makefile_20200511222552 b/.history/Makefile_20200511222552 new file mode 100644 index 0000000..c3d6287 --- /dev/null +++ b/.history/Makefile_20200511222552 @@ -0,0 +1,17 @@ +CC = clang +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall + +all: build ; + +targets = ./src/*.cpp ./src/*.h + +build: $(targets) ; + $(CC) $(DBG) ./src/main.cpp -o ./bin/main.o $(LINK) + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main.o diff --git a/.history/Makefile_20200511222632 b/.history/Makefile_20200511222632 new file mode 100644 index 0000000..4af94b0 --- /dev/null +++ b/.history/Makefile_20200511222632 @@ -0,0 +1,17 @@ +CC = clang +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall + +all: build ; + +targets = ./src/*.cpp ./src/*.h + +build: $(targets) ; + $(CC) $(DBG) ./src/main.cpp -o ./bin/main.o $(LINK) + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main.o \ No newline at end of file diff --git a/.history/Makefile_20200511223118 b/.history/Makefile_20200511223118 new file mode 100644 index 0000000..fc3f2a5 --- /dev/null +++ b/.history/Makefile_20200511223118 @@ -0,0 +1,20 @@ +CC = clang +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall + +all: build ; + +Color.o: Color.* ; + + +main.o: + +build: $(targets) ; + $(CC) $(DBG) ./src/main.cpp -o ./bin/main.o $(LINK) + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main.o \ No newline at end of file diff --git a/.history/Makefile_20200511232417 b/.history/Makefile_20200511232417 new file mode 100644 index 0000000..c59dad6 --- /dev/null +++ b/.history/Makefile_20200511232417 @@ -0,0 +1,20 @@ +CC = clang +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall + +all: build ; + +Color.o: Color.c Color.h ; + + +main.o: + +build: $(targets) ; + $(CC) $(DBG) ./src/main.cpp -o ./bin/main.o $(LINK) + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main.o \ No newline at end of file diff --git a/.history/Makefile_20200511232942 b/.history/Makefile_20200511232942 new file mode 100644 index 0000000..55bc55d --- /dev/null +++ b/.history/Makefile_20200511232942 @@ -0,0 +1,21 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +Color.o: Color.c Color.h ; + + + +main.o: + +build: $(targets) ; + $(CC) $(DBG) ./src/main.cpp -o ./bin/main.o $(LINK) + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main.o \ No newline at end of file diff --git a/.history/Makefile_20200511232949 b/.history/Makefile_20200511232949 new file mode 100644 index 0000000..2cc3e72 --- /dev/null +++ b/.history/Makefile_20200511232949 @@ -0,0 +1,21 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +Color.o: Color.c Color.h ; + + + +main.o: + +build: $(targets) ; + $(CC) ./src/main.cpp -o ./bin/main.o $(LINK) + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main.o \ No newline at end of file diff --git a/.history/Makefile_20200511233258 b/.history/Makefile_20200511233258 new file mode 100644 index 0000000..e2c9d7e --- /dev/null +++ b/.history/Makefile_20200511233258 @@ -0,0 +1,19 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +Color.o: Color.h + +main.o: + +build: $(targets) ; + $(CC) ./src/main.cpp -o ./bin/main.o $(LINK) + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main.o \ No newline at end of file diff --git a/.history/Makefile_20200511233332 b/.history/Makefile_20200511233332 new file mode 100644 index 0000000..cb6dd84 --- /dev/null +++ b/.history/Makefile_20200511233332 @@ -0,0 +1,20 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +Color.o: Color.h +Cube.o: Cube.h + +main.o: + +build: $(targets) ; + $(CC) ./src/main.cpp -o ./bin/main.o $(LINK) + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main.o \ No newline at end of file diff --git a/.history/Makefile_20200511233403 b/.history/Makefile_20200511233403 new file mode 100644 index 0000000..2933079 --- /dev/null +++ b/.history/Makefile_20200511233403 @@ -0,0 +1,21 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +Color.o: Color.h +Cube.o: Cube.h +main.o: Quad.h + +main.o: + +build: $(targets) ; + $(CC) ./src/main.cpp -o ./bin/main.o $(LINK) + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main.o \ No newline at end of file diff --git a/.history/Makefile_20200511233423 b/.history/Makefile_20200511233423 new file mode 100644 index 0000000..6d66fcd --- /dev/null +++ b/.history/Makefile_20200511233423 @@ -0,0 +1,22 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +Color.o: Color.h +Cube.o: Cube.h +main.o: Quad.h +Quad.o: Color.h Vertex.h + +main.o: + +build: $(targets) ; + $(CC) ./src/main.cpp -o ./bin/main.o $(LINK) + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main.o \ No newline at end of file diff --git a/.history/Makefile_20200511233451 b/.history/Makefile_20200511233451 new file mode 100644 index 0000000..6449a2a --- /dev/null +++ b/.history/Makefile_20200511233451 @@ -0,0 +1,23 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +Color.o: Color.h +Cube.o: Cube.h +main.o: Quad.h +Quad.o: Color.h Vertex.h +Vertex.o: Vertex.h + +main.o: + +build: $(targets) ; + $(CC) ./src/main.cpp -o ./bin/main.o $(LINK) + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main.o \ No newline at end of file diff --git a/.history/Makefile_20200511233512 b/.history/Makefile_20200511233512 new file mode 100644 index 0000000..6449a2a --- /dev/null +++ b/.history/Makefile_20200511233512 @@ -0,0 +1,23 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +Color.o: Color.h +Cube.o: Cube.h +main.o: Quad.h +Quad.o: Color.h Vertex.h +Vertex.o: Vertex.h + +main.o: + +build: $(targets) ; + $(CC) ./src/main.cpp -o ./bin/main.o $(LINK) + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main.o \ No newline at end of file diff --git a/.history/Makefile_20200511233531 b/.history/Makefile_20200511233531 new file mode 100644 index 0000000..b1b9824 --- /dev/null +++ b/.history/Makefile_20200511233531 @@ -0,0 +1,21 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +Color.o: Color.h +Cube.o: Cube.h +main.o: Quad.h +Quad.o: Color.h Vertex.h +Vertex.o: Vertex.h + +build: $(targets) ; + $(CC) ./src/main.cpp -o ./bin/main.o $(LINK) + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main.o \ No newline at end of file diff --git a/.history/Makefile_20200511233537 b/.history/Makefile_20200511233537 new file mode 100644 index 0000000..6697c44 --- /dev/null +++ b/.history/Makefile_20200511233537 @@ -0,0 +1,21 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +Color.o: Color.h +Cube.o: Cube.h +main.o: Quad.h +Quad.o: Color.h Vertex.h +Vertex.o: Vertex.h + +build: + $(CC) ./src/main.cpp -o ./bin/main.o $(LINK) + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main.o \ No newline at end of file diff --git a/.history/Makefile_20200511233619 b/.history/Makefile_20200511233619 new file mode 100644 index 0000000..24dd55f --- /dev/null +++ b/.history/Makefile_20200511233619 @@ -0,0 +1,23 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +targets = Color.o Cube.o main.o Quad.o Vertex.o + +all: build ; + +Color.o: Color.h +Cube.o: Cube.h +main.o: Quad.h +Quad.o: Color.h Vertex.h +Vertex.o: Vertex.h + +build: + $(CC) ./src/main.cpp -o ./bin/main.o $(LINK) + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main.o \ No newline at end of file diff --git a/.history/Makefile_20200511233631 b/.history/Makefile_20200511233631 new file mode 100644 index 0000000..851129a --- /dev/null +++ b/.history/Makefile_20200511233631 @@ -0,0 +1,23 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +targets = Color.o Cube.o main.o Quad.o Vertex.o + +all: build ; + +Color.o: Color.h +Cube.o: Cube.h +main.o: Quad.h +Quad.o: Color.h Vertex.h +Vertex.o: Vertex.h + +build: $(targets) + $(CC) ./src/main.cpp -o ./bin/main.o $(LINK) + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main.o \ No newline at end of file diff --git a/.history/Makefile_20200511233633 b/.history/Makefile_20200511233633 new file mode 100644 index 0000000..aa71094 --- /dev/null +++ b/.history/Makefile_20200511233633 @@ -0,0 +1,23 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +targets = Color.o Cube.o main.o Quad.o Vertex.o + +all: build ; + +Color.o: Color.h +Cube.o: Cube.h +main.o: Quad.h +Quad.o: Color.h Vertex.h +Vertex.o: Vertex.h + +build: $(targets) ; + $(CC) ./src/main.cpp -o ./bin/main.o $(LINK) + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main.o \ No newline at end of file diff --git a/.history/Makefile_20200511233703 b/.history/Makefile_20200511233703 new file mode 100644 index 0000000..10c1980 --- /dev/null +++ b/.history/Makefile_20200511233703 @@ -0,0 +1,23 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +targets = Color.o Cube.o main.o Quad.o Vertex.o + +all: build ; + +Color.o: Color.h +Cube.o: Cube.h +main.o: Quad.h +Quad.o: Color.h Vertex.h +Vertex.o: Vertex.h + +build: $(targets) ; + $(CC) -o ./bin/main $(LINK) + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main.o \ No newline at end of file diff --git a/.history/Makefile_20200511233707 b/.history/Makefile_20200511233707 new file mode 100644 index 0000000..323bcd3 --- /dev/null +++ b/.history/Makefile_20200511233707 @@ -0,0 +1,23 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +targets = Color.o Cube.o main.o Quad.o Vertex.o + +all: build ; + +Color.o: Color.h +Cube.o: Cube.h +main.o: Quad.h +Quad.o: Color.h Vertex.h +Vertex.o: Vertex.h + +build: $(targets) ; + $(CC) -o ./bin/main $(LINK) + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main \ No newline at end of file diff --git a/.history/Makefile_20200511233714 b/.history/Makefile_20200511233714 new file mode 100644 index 0000000..323bcd3 --- /dev/null +++ b/.history/Makefile_20200511233714 @@ -0,0 +1,23 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +targets = Color.o Cube.o main.o Quad.o Vertex.o + +all: build ; + +Color.o: Color.h +Cube.o: Cube.h +main.o: Quad.h +Quad.o: Color.h Vertex.h +Vertex.o: Vertex.h + +build: $(targets) ; + $(CC) -o ./bin/main $(LINK) + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main \ No newline at end of file diff --git a/.history/Makefile_20200511233726 b/.history/Makefile_20200511233726 new file mode 100644 index 0000000..323bcd3 --- /dev/null +++ b/.history/Makefile_20200511233726 @@ -0,0 +1,23 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +targets = Color.o Cube.o main.o Quad.o Vertex.o + +all: build ; + +Color.o: Color.h +Cube.o: Cube.h +main.o: Quad.h +Quad.o: Color.h Vertex.h +Vertex.o: Vertex.h + +build: $(targets) ; + $(CC) -o ./bin/main $(LINK) + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main \ No newline at end of file diff --git a/.history/Makefile_20200511233826 b/.history/Makefile_20200511233826 new file mode 100644 index 0000000..70744a8 --- /dev/null +++ b/.history/Makefile_20200511233826 @@ -0,0 +1,23 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +targets = Color.o Cube.o main.o Quad.o Vertex.o + +all: build ; + +Color.o: ./src/Color.h +Cube.o: ./src/Cube.h +main.o: ./src/Quad.h +Quad.o: ./src/Color.h ./src/Vertex.h +Vertex.o: ./src/Vertex.h + +build: $(targets) ; + $(CC) -o ./bin/main $(LINK) + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main \ No newline at end of file diff --git a/.history/Makefile_20200511233926 b/.history/Makefile_20200511233926 new file mode 100644 index 0000000..762598d --- /dev/null +++ b/.history/Makefile_20200511233926 @@ -0,0 +1,23 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +targets = Color.o Cube.o main.o Quad.o Vertex.o + +all: build ; + +Color.o: ./src/Color.h +Cube.o: ./src/Cube.h +main.o: ./src/Quad.h ./src/main.cpp +Quad.o: ./src/Color.h ./src/Vertex.h +Vertex.o: ./src/Vertex.h + +build: $(targets) ; + $(CC) -o ./bin/main $(LINK) + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main \ No newline at end of file diff --git a/.history/Makefile_20200511233935 b/.history/Makefile_20200511233935 new file mode 100644 index 0000000..70744a8 --- /dev/null +++ b/.history/Makefile_20200511233935 @@ -0,0 +1,23 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +targets = Color.o Cube.o main.o Quad.o Vertex.o + +all: build ; + +Color.o: ./src/Color.h +Cube.o: ./src/Cube.h +main.o: ./src/Quad.h +Quad.o: ./src/Color.h ./src/Vertex.h +Vertex.o: ./src/Vertex.h + +build: $(targets) ; + $(CC) -o ./bin/main $(LINK) + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main \ No newline at end of file diff --git a/.history/Makefile_20200511233946 b/.history/Makefile_20200511233946 new file mode 100644 index 0000000..b988680 --- /dev/null +++ b/.history/Makefile_20200511233946 @@ -0,0 +1,23 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +targets = Color.o Cube.o main.o Quad.o Vertex.o + +all: build ; + +Color.o: ./src/Color.h +Cube.o: ./src/Cube.h +main.o: ./src/Quad.h +Quad.o: ./src/Color.h ./src/Vertex.h +Vertex.o: ./src/Vertex.h + +build: $(targets) ; + $(CC) ./src/main.cpp -o ./bin/main $(LINK) + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main \ No newline at end of file diff --git a/.history/Makefile_20200511234024 b/.history/Makefile_20200511234024 new file mode 100644 index 0000000..d11ab9d --- /dev/null +++ b/.history/Makefile_20200511234024 @@ -0,0 +1,23 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +targets = Color.o Cube.o main.o Quad.o Vertex.o + +all: build ; + +Color.o: ./src/Color.h +Cube.o: ./src/Cube.h +main.o: ./src/Quad.h +Quad.o: ./src/Color.h ./src/Vertex.h +Vertex.o: ./src/Vertex.h + +build: $(targets) ; + $(CC) -c ./src/main.cpp -o ./bin/main $(LINK) + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main \ No newline at end of file diff --git a/.history/Makefile_20200511234030 b/.history/Makefile_20200511234030 new file mode 100644 index 0000000..d11ab9d --- /dev/null +++ b/.history/Makefile_20200511234030 @@ -0,0 +1,23 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +targets = Color.o Cube.o main.o Quad.o Vertex.o + +all: build ; + +Color.o: ./src/Color.h +Cube.o: ./src/Cube.h +main.o: ./src/Quad.h +Quad.o: ./src/Color.h ./src/Vertex.h +Vertex.o: ./src/Vertex.h + +build: $(targets) ; + $(CC) -c ./src/main.cpp -o ./bin/main $(LINK) + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main \ No newline at end of file diff --git a/.history/Makefile_20200511234130 b/.history/Makefile_20200511234130 new file mode 100644 index 0000000..b589692 --- /dev/null +++ b/.history/Makefile_20200511234130 @@ -0,0 +1,23 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := cc $(DBG) + +targets = Color.o Cube.o main.o Quad.o Vertex.o + +all: build ; + +Color.o: ./src/Color.h +Cube.o: ./src/Cube.h +main.o: ./src/Quad.h +Quad.o: ./src/Color.h ./src/Vertex.h +Vertex.o: ./src/Vertex.h + +build: $(targets) ; + $(CC) -c ./src/main.cpp -o ./bin/main $(LINK) + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main \ No newline at end of file diff --git a/.history/Makefile_20200511234218 b/.history/Makefile_20200511234218 new file mode 100644 index 0000000..d11ab9d --- /dev/null +++ b/.history/Makefile_20200511234218 @@ -0,0 +1,23 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +targets = Color.o Cube.o main.o Quad.o Vertex.o + +all: build ; + +Color.o: ./src/Color.h +Cube.o: ./src/Cube.h +main.o: ./src/Quad.h +Quad.o: ./src/Color.h ./src/Vertex.h +Vertex.o: ./src/Vertex.h + +build: $(targets) ; + $(CC) -c ./src/main.cpp -o ./bin/main $(LINK) + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main \ No newline at end of file diff --git a/.history/Makefile_20200511234223 b/.history/Makefile_20200511234223 new file mode 100644 index 0000000..b988680 --- /dev/null +++ b/.history/Makefile_20200511234223 @@ -0,0 +1,23 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +targets = Color.o Cube.o main.o Quad.o Vertex.o + +all: build ; + +Color.o: ./src/Color.h +Cube.o: ./src/Cube.h +main.o: ./src/Quad.h +Quad.o: ./src/Color.h ./src/Vertex.h +Vertex.o: ./src/Vertex.h + +build: $(targets) ; + $(CC) ./src/main.cpp -o ./bin/main $(LINK) + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main \ No newline at end of file diff --git a/.history/Makefile_20200511234429 b/.history/Makefile_20200511234429 new file mode 100644 index 0000000..5cba1af --- /dev/null +++ b/.history/Makefile_20200511234429 @@ -0,0 +1,23 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +targets = Color.o Cube.o main.o Quad.o Vertex.o + +all: build ; + +./bin/Color.o: ./src/Color.h +./bin/Cube.o: ./src/Cube.h +./bin/main.o: ./src/Quad.h +./bin/Quad.o: ./src/Color.h ./src/Vertex.h +./bin/Vertex.o: ./src/Vertex.h + +build: $(targets) ; + $(CC) ./src/main.cpp -o ./bin/main $(LINK) + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main \ No newline at end of file diff --git a/.history/Makefile_20200511234457 b/.history/Makefile_20200511234457 new file mode 100644 index 0000000..edef597 --- /dev/null +++ b/.history/Makefile_20200511234457 @@ -0,0 +1,23 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +targets = bin/Color.o Cube.o main.o Quad.o Vertex.o + +all: build ; + +bin/Color.o: ./src/Color.h +bin/Cube.o: ./src/Cube.h +bin/main.o: ./src/Quad.h +bin/Quad.o: ./src/Color.h ./src/Vertex.h +bin/Vertex.o: ./src/Vertex.h + +build: $(targets) ; + $(CC) src/main.cpp -o ./bin/main $(LINK) + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main \ No newline at end of file diff --git a/.history/Makefile_20200511234505 b/.history/Makefile_20200511234505 new file mode 100644 index 0000000..c5db739 --- /dev/null +++ b/.history/Makefile_20200511234505 @@ -0,0 +1,23 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +targets = bin/Color.o Cube.o main.o Quad.o Vertex.o + +all: build ; + +bin/Color.o: src/Color.h +bin/Cube.o: src/Cube.h +bin/main.o: src/Quad.h +bin/Quad.o: src/Color.h ./src/Vertex.h +bin/Vertex.o: src/Vertex.h + +build: $(targets) ; + $(CC) src/main.cpp -o ./bin/main $(LINK) + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main \ No newline at end of file diff --git a/.history/Makefile_20200511234522 b/.history/Makefile_20200511234522 new file mode 100644 index 0000000..86f8ce8 --- /dev/null +++ b/.history/Makefile_20200511234522 @@ -0,0 +1,23 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +targets = bin/Color.o bin/Cube.o bin/main.o bin/Quad.o bin/Vertex.o + +all: build ; + +bin/Color.o: src/Color.h +bin/Cube.o: src/Cube.h +bin/main.o: src/Quad.h +bin/Quad.o: src/Color.h ./src/Vertex.h +bin/Vertex.o: src/Vertex.h + +build: $(targets) ; + $(CC) src/main.cpp -o ./bin/main $(LINK) + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main \ No newline at end of file diff --git a/.history/Makefile_20200511234615 b/.history/Makefile_20200511234615 new file mode 100644 index 0000000..d075b1c --- /dev/null +++ b/.history/Makefile_20200511234615 @@ -0,0 +1,23 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +targets = bin/Color.o bin/Cube.o bin/main.o bin/Quad.o bin/Vertex.o + +all: build ; + +bin/Color.o: src/Color.h +bin/Cube.o: src/Cube.h +bin/main.o: src/Quad.h +bin/Quad.o: src/Color.h ./src/Vertex.h +bin/Vertex.o: src/Vertex.h + +build: $(targets) ; + $(CC) -o ./bin/main $(LINK) + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main \ No newline at end of file diff --git a/.history/Makefile_20200511234621 b/.history/Makefile_20200511234621 new file mode 100644 index 0000000..d075b1c --- /dev/null +++ b/.history/Makefile_20200511234621 @@ -0,0 +1,23 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +targets = bin/Color.o bin/Cube.o bin/main.o bin/Quad.o bin/Vertex.o + +all: build ; + +bin/Color.o: src/Color.h +bin/Cube.o: src/Cube.h +bin/main.o: src/Quad.h +bin/Quad.o: src/Color.h ./src/Vertex.h +bin/Vertex.o: src/Vertex.h + +build: $(targets) ; + $(CC) -o ./bin/main $(LINK) + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main \ No newline at end of file diff --git a/.history/Makefile_20200511234639 b/.history/Makefile_20200511234639 new file mode 100644 index 0000000..98c2355 --- /dev/null +++ b/.history/Makefile_20200511234639 @@ -0,0 +1,23 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +targets = bin/Color.o bin/Cube.o bin/main.o bin/Quad.o bin/Vertex.o + +all: build ; + +bin/Color.o: src/Color.h +bin/Cube.o: src/Cube.h +bin/main.o: src/main.cpp src/Quad.h +bin/Quad.o: src/Color.h ./src/Vertex.h +bin/Vertex.o: src/Vertex.h + +build: $(targets) ; + $(CC) -o ./bin/main $(LINK) + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main \ No newline at end of file diff --git a/.history/Makefile_20200511234646 b/.history/Makefile_20200511234646 new file mode 100644 index 0000000..d075b1c --- /dev/null +++ b/.history/Makefile_20200511234646 @@ -0,0 +1,23 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +targets = bin/Color.o bin/Cube.o bin/main.o bin/Quad.o bin/Vertex.o + +all: build ; + +bin/Color.o: src/Color.h +bin/Cube.o: src/Cube.h +bin/main.o: src/Quad.h +bin/Quad.o: src/Color.h ./src/Vertex.h +bin/Vertex.o: src/Vertex.h + +build: $(targets) ; + $(CC) -o ./bin/main $(LINK) + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main \ No newline at end of file diff --git a/.history/Makefile_20200511235501 b/.history/Makefile_20200511235501 new file mode 100644 index 0000000..cfafe60 --- /dev/null +++ b/.history/Makefile_20200511235501 @@ -0,0 +1,23 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +targets = bin/Color.o bin/Cube.o bin/main.o bin/Quad.o bin/Vertex.o + +all: build ; + +Color.o: src/Color.h Color.o +Cube.o: src/Cube.h Cube.o +main.o: src/Quad.h main.o +Quad.o: src/Color.h ./src/Vertex.h Quad.o +Vertex.o: src/Vertex.h Vertex.o + +build: $(targets) ; + $(CC) -o ./bin/main $(LINK) + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main \ No newline at end of file diff --git a/.history/Makefile_20200511235522 b/.history/Makefile_20200511235522 new file mode 100644 index 0000000..eb0070b --- /dev/null +++ b/.history/Makefile_20200511235522 @@ -0,0 +1,23 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +targets = Color.o Cube.o main.o Quad.o Vertex.o + +all: build ; + +Color.o: src/Color.h Color.o +Cube.o: src/Cube.h Cube.o +main.o: src/Quad.h main.o +Quad.o: src/Color.h ./src/Vertex.h Quad.o +Vertex.o: src/Vertex.h Vertex.o + +build: $(targets) ; + $(CC) -o ./bin/main $(LINK) + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main \ No newline at end of file diff --git a/.history/Makefile_20200511235543 b/.history/Makefile_20200511235543 new file mode 100644 index 0000000..b4c16f6 --- /dev/null +++ b/.history/Makefile_20200511235543 @@ -0,0 +1,23 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +targets = Color.o Cube.o main.o Quad.o Vertex.o + +all: build ; + +Color.o: src/Color.h Color.o +Cube.o: src/Cube.h Cube.o +main.o: src/Quad.h main.o +Quad.o: src/Color.h ./src/Vertex.h Quad.o +Vertex.o: src/Vertex.h ./bin/Vertex.o + +build: $(targets) ; + $(CC) -o ./bin/main $(LINK) + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main \ No newline at end of file diff --git a/.history/Makefile_20200511235607 b/.history/Makefile_20200511235607 new file mode 100644 index 0000000..d5436d2 --- /dev/null +++ b/.history/Makefile_20200511235607 @@ -0,0 +1,23 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +targets = Color.o Cube.o main.o Quad.o Vertex.o + +all: build ; + +Color.o: src/Color.h +Cube.o: src/Cube.h +main.o: src/Quad.h +Quad.o: src/Color.h +Vertex.o: src/Vertex.h + +build: $(targets) ; + $(CC) -o ./bin/main $(LINK) + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main \ No newline at end of file diff --git a/.history/Makefile_20200511235632 b/.history/Makefile_20200511235632 new file mode 100644 index 0000000..d5436d2 --- /dev/null +++ b/.history/Makefile_20200511235632 @@ -0,0 +1,23 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +targets = Color.o Cube.o main.o Quad.o Vertex.o + +all: build ; + +Color.o: src/Color.h +Cube.o: src/Cube.h +main.o: src/Quad.h +Quad.o: src/Color.h +Vertex.o: src/Vertex.h + +build: $(targets) ; + $(CC) -o ./bin/main $(LINK) + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main \ No newline at end of file diff --git a/.history/Makefile_20200511235725 b/.history/Makefile_20200511235725 new file mode 100644 index 0000000..d5436d2 --- /dev/null +++ b/.history/Makefile_20200511235725 @@ -0,0 +1,23 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +targets = Color.o Cube.o main.o Quad.o Vertex.o + +all: build ; + +Color.o: src/Color.h +Cube.o: src/Cube.h +main.o: src/Quad.h +Quad.o: src/Color.h +Vertex.o: src/Vertex.h + +build: $(targets) ; + $(CC) -o ./bin/main $(LINK) + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main \ No newline at end of file diff --git a/.history/Makefile_20200511235727 b/.history/Makefile_20200511235727 new file mode 100644 index 0000000..ecd037e --- /dev/null +++ b/.history/Makefile_20200511235727 @@ -0,0 +1,23 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +targets = Color.o Cube.o main.o Quad.o Vertex.o + +all: build ; + +Color.o: src/Color.h +Cube.o: src/Cube.h +main.o: src/Quad.h +Quad.o: src/Color.h +Vertex.o: src/Vertex.h + +build: $(targets) ; + $(CC) -o ./bin/main.o $(LINK) + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main \ No newline at end of file diff --git a/.history/Makefile_20200511235737 b/.history/Makefile_20200511235737 new file mode 100644 index 0000000..938e9a4 --- /dev/null +++ b/.history/Makefile_20200511235737 @@ -0,0 +1,23 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +targets = Color.o Cube.o main.o Quad.o Vertex.o + +all: build ; + +Color.o: src/Color.h +Cube.o: src/Cube.h +main.o: src/Quad.h +Quad.o: src/Color.h +Vertex.o: src/Vertex.h + +build: $(targets) ; + $(CC) ./src/main.cpp -o ./bin/main.o $(LINK) + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main \ No newline at end of file diff --git a/.history/Makefile_20200511235920 b/.history/Makefile_20200511235920 new file mode 100644 index 0000000..d16f7c8 --- /dev/null +++ b/.history/Makefile_20200511235920 @@ -0,0 +1,23 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +targets = Color.o Cube.o main.o Quad.o Vertex.o + +all: build ; + +Color.o: src/Color.h +Cube.o: src/Cube.h +main.o: src/Quad.h src/Color.h +Quad.o: src/Color.h +Vertex.o: src/Vertex.h + +build: $(targets) ; + $(CC) ./src/main.cpp -o ./bin/main.o $(LINK) + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main \ No newline at end of file diff --git a/.history/Makefile_20200512000709 b/.history/Makefile_20200512000709 new file mode 100644 index 0000000..83fe95f --- /dev/null +++ b/.history/Makefile_20200512000709 @@ -0,0 +1,23 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU -I./src/ +DBG = -Wall +CC := clang $(DBG) + +targets = Color.o Cube.o main.o Quad.o Vertex.o + +all: build ; + +Color.o: src/Color.h +Cube.o: src/Cube.h +main.o: src/Quad.h src/Color.h +Quad.o: src/Color.h +Vertex.o: src/Vertex.h + +build: $(targets) ; + $(CC) ./src/main.cpp -o ./bin/main.o $(LINK) + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main \ No newline at end of file diff --git a/.history/Makefile_20200512001624 b/.history/Makefile_20200512001624 new file mode 100644 index 0000000..9c4d281 --- /dev/null +++ b/.history/Makefile_20200512001624 @@ -0,0 +1,23 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU -I./src/ +DBG = -Wall +CC := clang $(DBG) + +targets = Color.o Cube.o main.o Quad.o Vertex.o + +all: build ; + +Color.o: src/Color.h +Cube.o: src/Cube.h +main.o: src/Quad.h src/Color.h +Quad.o: src/Color.h +Vertex.o: src/Vertex.h + +build: $(targets) ; + $(CC) -c ./src/main.cpp -o ./bin/main.o $(LINK) + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main \ No newline at end of file diff --git a/.history/Makefile_20200512001633 b/.history/Makefile_20200512001633 new file mode 100644 index 0000000..a9c98dd --- /dev/null +++ b/.history/Makefile_20200512001633 @@ -0,0 +1,23 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU -I./src/ +DBG = -Wall +CC := clang $(DBG) + +targets = Color.o Cube.o main.o Quad.o Vertex.o + +all: build ; + +Color.o: src/Color.h +Cube.o: src/Cube.h +main.o: src/Quad.h src/Color.h +Quad.o: src/Color.h +Vertex.o: src/Vertex.h + +build: $(targets) ; + $(CC) -c ./src/main.cpp $(LINK) + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main \ No newline at end of file diff --git a/.history/Makefile_20200512001749 b/.history/Makefile_20200512001749 new file mode 100644 index 0000000..9c4d281 --- /dev/null +++ b/.history/Makefile_20200512001749 @@ -0,0 +1,23 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU -I./src/ +DBG = -Wall +CC := clang $(DBG) + +targets = Color.o Cube.o main.o Quad.o Vertex.o + +all: build ; + +Color.o: src/Color.h +Cube.o: src/Cube.h +main.o: src/Quad.h src/Color.h +Quad.o: src/Color.h +Vertex.o: src/Vertex.h + +build: $(targets) ; + $(CC) -c ./src/main.cpp -o ./bin/main.o $(LINK) + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main \ No newline at end of file diff --git a/.history/Makefile_20200512001840 b/.history/Makefile_20200512001840 new file mode 100644 index 0000000..bce1f6d --- /dev/null +++ b/.history/Makefile_20200512001840 @@ -0,0 +1,23 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU -I./src/ +DBG = -Wall +CC := clang $(DBG) + +targets = Color.o Cube.o main.o Quad.o Vertex.o + +all: build ; + +Color.o: src/Color.h +Cube.o: src/Cube.h +main.o: src/Quad.h src/Color.h +Quad.o: src/Color.h +Vertex.o: src/Vertex.h + +build: $(targets) ; + $(CC) -o ./bin/main $(LINK) + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main \ No newline at end of file diff --git a/.history/Makefile_20200512001924 b/.history/Makefile_20200512001924 new file mode 100644 index 0000000..a66a4f3 --- /dev/null +++ b/.history/Makefile_20200512001924 @@ -0,0 +1,23 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU -I./src/ +DBG = -Wall +CC := clang $(DBG) + +targets = Color.o Cube.o main.o Quad.o Vertex.o + +all: build ; + +Color.o: src/Color.h +Cube.o: src/Cube.h +main.o: src/Quad.h src/Color.h +Quad.o: src/Color.h +Vertex.o: src/Vertex.h + +build: $(targets) ; + $(CC) -o ./bin/main $(targets) $(LINK) + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main \ No newline at end of file diff --git a/.history/Makefile_20200512001959 b/.history/Makefile_20200512001959 new file mode 100644 index 0000000..20556a6 --- /dev/null +++ b/.history/Makefile_20200512001959 @@ -0,0 +1,23 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU -I./src/ +DBG = -Wall +CC := clang $(DBG) + +targets = Color.o Cube.o main.o Quad.o Vertex.o + +all: build ; + +Color.o: src/Color.h +Cube.o: src/Cube.h +main.o: src/Quad.h src/Color.h +Quad.o: src/Color.h +Vertex.o: src/Vertex.h + +build: $(targets) ; + $(CC) -o ./bin/main.o $(LINK) + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main \ No newline at end of file diff --git a/.history/Makefile_20200512002002 b/.history/Makefile_20200512002002 new file mode 100644 index 0000000..20556a6 --- /dev/null +++ b/.history/Makefile_20200512002002 @@ -0,0 +1,23 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU -I./src/ +DBG = -Wall +CC := clang $(DBG) + +targets = Color.o Cube.o main.o Quad.o Vertex.o + +all: build ; + +Color.o: src/Color.h +Cube.o: src/Cube.h +main.o: src/Quad.h src/Color.h +Quad.o: src/Color.h +Vertex.o: src/Vertex.h + +build: $(targets) ; + $(CC) -o ./bin/main.o $(LINK) + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main \ No newline at end of file diff --git a/.history/Makefile_20200512002353 b/.history/Makefile_20200512002353 new file mode 100644 index 0000000..83429b4 --- /dev/null +++ b/.history/Makefile_20200512002353 @@ -0,0 +1,23 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU -I./src/ +DBG = -Wall +CC := clang $(DBG) + +targets = Color.o Cube.o main.o Quad.o Vertex.o + +all: build ; + +Color.o: src/Color.h src/Color.cpp +Cube.o: src/Cube.h src/Cube.cpp +main.o: src/Quad.h src/Color.h src/main.cpp +Quad.o: src/Color.h src/Quad.cpp +Vertex.o: src/Vertex.h Vertex.cpp + +build: $(targets) ; + $(CC) -o ./bin/main.o $(LINK) + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main \ No newline at end of file diff --git a/.history/Makefile_20200512002453 b/.history/Makefile_20200512002453 new file mode 100644 index 0000000..8951f83 --- /dev/null +++ b/.history/Makefile_20200512002453 @@ -0,0 +1,23 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU -I./src/ +DBG = -Wall +CC := clang $(DBG) + +targets = Color.o Cube.o main.o Quad.o Vertex.o + +all: build ; + +Color.o: src/Color.h src/Color.cpp +Cube.o: src/Cube.h src/Cube.cpp +main.o: src/Quad.h src/Color.h src/main.cpp +Quad.o: src/Color.h src/Quad.cpp +Vertex.o: src/Vertex.h Vertex.cpp + +build: $(targets) ; + $(CC) -c -o ./bin/main $(targets) $(LINK) + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main \ No newline at end of file diff --git a/.history/Makefile_20200512002502 b/.history/Makefile_20200512002502 new file mode 100644 index 0000000..8951f83 --- /dev/null +++ b/.history/Makefile_20200512002502 @@ -0,0 +1,23 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU -I./src/ +DBG = -Wall +CC := clang $(DBG) + +targets = Color.o Cube.o main.o Quad.o Vertex.o + +all: build ; + +Color.o: src/Color.h src/Color.cpp +Cube.o: src/Cube.h src/Cube.cpp +main.o: src/Quad.h src/Color.h src/main.cpp +Quad.o: src/Color.h src/Quad.cpp +Vertex.o: src/Vertex.h Vertex.cpp + +build: $(targets) ; + $(CC) -c -o ./bin/main $(targets) $(LINK) + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main \ No newline at end of file diff --git a/.history/Makefile_20200512002516 b/.history/Makefile_20200512002516 new file mode 100644 index 0000000..8951f83 --- /dev/null +++ b/.history/Makefile_20200512002516 @@ -0,0 +1,23 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU -I./src/ +DBG = -Wall +CC := clang $(DBG) + +targets = Color.o Cube.o main.o Quad.o Vertex.o + +all: build ; + +Color.o: src/Color.h src/Color.cpp +Cube.o: src/Cube.h src/Cube.cpp +main.o: src/Quad.h src/Color.h src/main.cpp +Quad.o: src/Color.h src/Quad.cpp +Vertex.o: src/Vertex.h Vertex.cpp + +build: $(targets) ; + $(CC) -c -o ./bin/main $(targets) $(LINK) + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main \ No newline at end of file diff --git a/.history/Makefile_20200512002533 b/.history/Makefile_20200512002533 new file mode 100644 index 0000000..c4ba34a --- /dev/null +++ b/.history/Makefile_20200512002533 @@ -0,0 +1,23 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU -I./src/ +DBG = -Wall +CC := clang $(DBG) + +targets = Color.o Cube.o main.o Quad.o Vertex.o + +all: build ; + +Color.o: src/Color.h src/Color.cpp +Cube.o: src/Cube.h src/Cube.cpp +main.o: src/Quad.h src/Color.h src/main.cpp +Quad.o: src/Color.h src/Quad.cpp +Vertex.o: src/Vertex.h src/Vertex.cpp + +build: $(targets) ; + $(CC) -c -o ./bin/main $(targets) $(LINK) + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main \ No newline at end of file diff --git a/.history/Makefile_20200512002632 b/.history/Makefile_20200512002632 new file mode 100644 index 0000000..bd72e92 --- /dev/null +++ b/.history/Makefile_20200512002632 @@ -0,0 +1,23 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU -I./src/ +DBG = -Wall +CC := clang $(DBG) + +targets = Color.cpp Cube.cpp main.cpp Quad.cpp Vertex.cpp + +all: build ; + +Color.cpp: src/Color.h src/Color.cpp +Cube.cpp: src/Cube.h src/Cube.cpp +main.cpp: src/Quad.h src/Color.h src/main.cpp +Quad.cpp: src/Color.h src/Quad.cpp +Vertex.cpp: src/Vertex.h src/Vertex.cpp + +build: $(targets) ; + $(CC) -c -o ./bin/main $(targets) $(LINK) + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main \ No newline at end of file diff --git a/.history/Makefile_20200512002654 b/.history/Makefile_20200512002654 new file mode 100644 index 0000000..2821a23 --- /dev/null +++ b/.history/Makefile_20200512002654 @@ -0,0 +1,23 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU -I./src/ +DBG = -Wall +CC := clang $(DBG) + +targets = src/Color.cpp src/Cube.cpp src/main.cpp src/Quad.cpp src/Vertex.cpp + +all: build ; + +Color.cpp: src/Color.h src/Color.cpp +Cube.cpp: src/Cube.h src/Cube.cpp +main.cpp: src/Quad.h src/Color.h src/main.cpp +Quad.cpp: src/Color.h src/Quad.cpp +Vertex.cpp: src/Vertex.h src/Vertex.cpp + +build: $(targets) ; + $(CC) -c -o ./bin/main $(targets) $(LINK) + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main \ No newline at end of file diff --git a/.history/Makefile_20200512002708 b/.history/Makefile_20200512002708 new file mode 100644 index 0000000..6d3f62f --- /dev/null +++ b/.history/Makefile_20200512002708 @@ -0,0 +1,23 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +targets = src/Color.cpp src/Cube.cpp src/main.cpp src/Quad.cpp src/Vertex.cpp + +all: build ; + +Color.cpp: src/Color.h src/Color.cpp +Cube.cpp: src/Cube.h src/Cube.cpp +main.cpp: src/Quad.h src/Color.h src/main.cpp +Quad.cpp: src/Color.h src/Quad.cpp +Vertex.cpp: src/Vertex.h src/Vertex.cpp + +build: $(targets) ; + $(CC) -c -o ./bin/main $(targets) $(LINK) + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main \ No newline at end of file diff --git a/.history/Makefile_20200512002742 b/.history/Makefile_20200512002742 new file mode 100644 index 0000000..ec608c2 --- /dev/null +++ b/.history/Makefile_20200512002742 @@ -0,0 +1,23 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +targets = src/Color.cpp src/Cube.cpp src/main.cpp src/Quad.cpp src/Vertex.cpp + +all: build ; + +Color.cpp: src/Color.h src/Color.cpp +Cube.cpp: src/Cube.h src/Cube.cpp +main.cpp: src/Quad.h src/Color.h src/main.cpp +Quad.cpp: src/Color.h src/Quad.cpp +Vertex.cpp: src/Vertex.h src/Vertex.cpp + +build: $(targets) ; + $(CC) $(targets) -c -o ./bin/main $(LINK) + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main \ No newline at end of file diff --git a/.history/Makefile_20200512002756 b/.history/Makefile_20200512002756 new file mode 100644 index 0000000..96a8643 --- /dev/null +++ b/.history/Makefile_20200512002756 @@ -0,0 +1,23 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +targets = src/Color.cpp src/Cube.cpp src/main.cpp src/Quad.cpp src/Vertex.cpp + +all: build ; + +Color.cpp: src/Color.h src/Color.cpp +Cube.cpp: src/Cube.h src/Cube.cpp +main.cpp: src/Quad.h src/Color.h src/main.cpp +Quad.cpp: src/Color.h src/Quad.cpp +Vertex.cpp: src/Vertex.h src/Vertex.cpp + +build: $(targets) ; + $(CC) $(targets) -c $(LINK) + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main \ No newline at end of file diff --git a/.history/Makefile_20200512003649 b/.history/Makefile_20200512003649 new file mode 100644 index 0000000..8880e83 --- /dev/null +++ b/.history/Makefile_20200512003649 @@ -0,0 +1,15 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +build: $(targets) ; + $(CC) src/main.cpp -o bin/main.o $(LINK) + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main \ No newline at end of file diff --git a/.history/Makefile_20200512003657 b/.history/Makefile_20200512003657 new file mode 100644 index 0000000..2935f1b --- /dev/null +++ b/.history/Makefile_20200512003657 @@ -0,0 +1,15 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +build: $(targets) ; + $(CC) -c src/main.cpp -o bin/main.o $(LINK) + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main \ No newline at end of file diff --git a/.history/Makefile_20200512003732 b/.history/Makefile_20200512003732 new file mode 100644 index 0000000..0f92f73 --- /dev/null +++ b/.history/Makefile_20200512003732 @@ -0,0 +1,15 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +build: $(targets) ; + $(CC) -c src/main.* -o bin/main.o + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main \ No newline at end of file diff --git a/.history/Makefile_20200512003757 b/.history/Makefile_20200512003757 new file mode 100644 index 0000000..9fe4834 --- /dev/null +++ b/.history/Makefile_20200512003757 @@ -0,0 +1,15 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +build: $(targets) ; + $(CC) -c src/main.* + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main \ No newline at end of file diff --git a/.history/Makefile_20200512003818 b/.history/Makefile_20200512003818 new file mode 100644 index 0000000..4ca1a6d --- /dev/null +++ b/.history/Makefile_20200512003818 @@ -0,0 +1,15 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +build: $(targets) ; + $(CC) -c src/*.cpp + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main \ No newline at end of file diff --git a/.history/Makefile_20200512003822 b/.history/Makefile_20200512003822 new file mode 100644 index 0000000..c0e1479 --- /dev/null +++ b/.history/Makefile_20200512003822 @@ -0,0 +1,15 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +build: $(targets) ; + $(CC) -c src/*.cpp -o bin/ + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main \ No newline at end of file diff --git a/.history/Makefile_20200512003829 b/.history/Makefile_20200512003829 new file mode 100644 index 0000000..4ca1a6d --- /dev/null +++ b/.history/Makefile_20200512003829 @@ -0,0 +1,15 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +build: $(targets) ; + $(CC) -c src/*.cpp + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main \ No newline at end of file diff --git a/.history/Makefile_20200512003842 b/.history/Makefile_20200512003842 new file mode 100644 index 0000000..c8e1dbc --- /dev/null +++ b/.history/Makefile_20200512003842 @@ -0,0 +1,16 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +build: $(targets) ; + cd bin/ + $(CC) -c ../src/*.cpp + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main \ No newline at end of file diff --git a/.history/Makefile_20200512003911 b/.history/Makefile_20200512003911 new file mode 100644 index 0000000..a416d21 --- /dev/null +++ b/.history/Makefile_20200512003911 @@ -0,0 +1,16 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +build: $(targets) ; + cd bin/ + $(CC) -c ../src/* + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main \ No newline at end of file diff --git a/.history/Makefile_20200512003927 b/.history/Makefile_20200512003927 new file mode 100644 index 0000000..87f89e4 --- /dev/null +++ b/.history/Makefile_20200512003927 @@ -0,0 +1,16 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +build: $(targets) ; + cd bin/ + $(CC) -c src/* + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main \ No newline at end of file diff --git a/.history/Makefile_20200512003938 b/.history/Makefile_20200512003938 new file mode 100644 index 0000000..51390b7 --- /dev/null +++ b/.history/Makefile_20200512003938 @@ -0,0 +1,16 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +build: $(targets) ; + cd bin/ + $(CC) -c src/*.cpp + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main \ No newline at end of file diff --git a/.history/Makefile_20200512004016 b/.history/Makefile_20200512004016 new file mode 100644 index 0000000..4ca1a6d --- /dev/null +++ b/.history/Makefile_20200512004016 @@ -0,0 +1,15 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +build: $(targets) ; + $(CC) -c src/*.cpp + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main \ No newline at end of file diff --git a/.history/Makefile_20200512004205 b/.history/Makefile_20200512004205 new file mode 100644 index 0000000..86a0d11 --- /dev/null +++ b/.history/Makefile_20200512004205 @@ -0,0 +1,16 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +build: $(targets) ; + @cd src/ + $(CC) -c src/*.cpp + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main \ No newline at end of file diff --git a/.history/Makefile_20200512005117 b/.history/Makefile_20200512005117 new file mode 100644 index 0000000..bdc3452 --- /dev/null +++ b/.history/Makefile_20200512005117 @@ -0,0 +1,25 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +bin/main.o: src/main.cpp +bin/Cube.o: src/Cube.cpp +bin/Color.o: src/Color.cpp +bin/Quad.o: src/Quad.cpp +bin/Vertex.o: src/Vertex.cpp +bin/simulator: + +build: $(targets) ; + @cd src/ + $(CC) -c src/*.cpp + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main \ No newline at end of file diff --git a/.history/Makefile_20200512005124 b/.history/Makefile_20200512005124 new file mode 100644 index 0000000..5e3986e --- /dev/null +++ b/.history/Makefile_20200512005124 @@ -0,0 +1,25 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +bin/main.o: src/main.cpp +bin/Cube.o: src/Cube.cpp +bin/Color.o: src/Color.cpp +bin/Quad.o: src/Quad.cpp +bin/Vertex.o: src/Vertex.cpp +bin/simulator: $(goals) + +build: $(targets) ; + @cd src/ + $(CC) -c src/*.cpp + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main \ No newline at end of file diff --git a/.history/Makefile_20200512005227 b/.history/Makefile_20200512005227 new file mode 100644 index 0000000..ae181b6 --- /dev/null +++ b/.history/Makefile_20200512005227 @@ -0,0 +1,26 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +bin/main.o: src/main.cpp +bin/Cube.o: src/Cube.cpp +bin/Color.o: src/Color.cpp +bin/Quad.o: src/Quad.cpp +bin/Vertex.o: src/Vertex.cpp +bin/simulator: $(goals) ; + $(CC) $^ -o $@ + +build: $(targets) ; + @cd src/ + $(CC) -c src/*.cpp + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main \ No newline at end of file diff --git a/.history/Makefile_20200512005507 b/.history/Makefile_20200512005507 new file mode 100644 index 0000000..9889c80 --- /dev/null +++ b/.history/Makefile_20200512005507 @@ -0,0 +1,25 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +bin/main.o: src/main.cpp +bin/Cube.o: src/Cube.cpp +bin/Color.o: src/Color.cpp +bin/Quad.o: src/Quad.cpp +bin/Vertex.o: src/Vertex.cpp +bin/simulator: $(goals) ; + $(CC) $^ -o $@ + +build: $(targets) ; + bin/simulator + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main \ No newline at end of file diff --git a/.history/Makefile_20200512005538 b/.history/Makefile_20200512005538 new file mode 100644 index 0000000..152a2d7 --- /dev/null +++ b/.history/Makefile_20200512005538 @@ -0,0 +1,25 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +bin/main.o: src/main.cpp +bin/Cube.o: src/Cube.cpp +bin/Color.o: src/Color.cpp +bin/Quad.o: src/Quad.cpp +bin/Vertex.o: src/Vertex.cpp +bin/simulator: $(goals) ; + $(CC) $^ -o $@ + +build: + bin/simulator + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main \ No newline at end of file diff --git a/.history/Makefile_20200512005607 b/.history/Makefile_20200512005607 new file mode 100644 index 0000000..f74ee7a --- /dev/null +++ b/.history/Makefile_20200512005607 @@ -0,0 +1,25 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +bin/main.o: src/main.cpp +bin/Cube.o: src/Cube.cpp +bin/Color.o: src/Color.cpp +bin/Quad.o: src/Quad.cpp +bin/Vertex.o: src/Vertex.cpp +bin/simulator: $(goals) ; + $(CC) $^ -o $@ + +build: + $(CC) $(goals) -o ./bin/simulator + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main \ No newline at end of file diff --git a/.history/Makefile_20200512005648 b/.history/Makefile_20200512005648 new file mode 100644 index 0000000..f74ee7a --- /dev/null +++ b/.history/Makefile_20200512005648 @@ -0,0 +1,25 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +bin/main.o: src/main.cpp +bin/Cube.o: src/Cube.cpp +bin/Color.o: src/Color.cpp +bin/Quad.o: src/Quad.cpp +bin/Vertex.o: src/Vertex.cpp +bin/simulator: $(goals) ; + $(CC) $^ -o $@ + +build: + $(CC) $(goals) -o ./bin/simulator + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main \ No newline at end of file diff --git a/.history/Makefile_20200512005729 b/.history/Makefile_20200512005729 new file mode 100644 index 0000000..f10b98c --- /dev/null +++ b/.history/Makefile_20200512005729 @@ -0,0 +1,30 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +bin/main.o: src/main.cpp + $(CC) $^ -o $@ +bin/Cube.o: src/Cube.cpp + $(CC) $^ -o $@ +bin/Color.o: src/Color.cpp + $(CC) $^ -o $@ +bin/Quad.o: src/Quad.cpp + $(CC) $^ -o $@ +bin/Vertex.o: src/Vertex.cpp + $(CC) $^ -o $@ +bin/simulator: $(goals) ; + $(CC) $^ -o $@ + +build: + $(CC) $(goals) -o ./bin/simulator + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main \ No newline at end of file diff --git a/.history/Makefile_20200512005741 b/.history/Makefile_20200512005741 new file mode 100644 index 0000000..218a211 --- /dev/null +++ b/.history/Makefile_20200512005741 @@ -0,0 +1,30 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +bin/main.o: src/main.cpp + $(CC) $^ -o $@ +bin/Cube.o: src/Cube.cpp + $(CC) $^ -o $@ +bin/Color.o: src/Color.cpp + $(CC) $^ -o $@ +bin/Quad.o: src/Quad.cpp + $(CC) $^ -o $@ +bin/Vertex.o: src/Vertex.cpp + $(CC) $^ -o $@ +bin/simulator: $(goals) ; + $(CC) $^ -o $@ + +build: $(goals) ; + $(CC) $(goals) -o ./bin/simulator + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main \ No newline at end of file diff --git a/.history/Makefile_20200512005803 b/.history/Makefile_20200512005803 new file mode 100644 index 0000000..63e86c7 --- /dev/null +++ b/.history/Makefile_20200512005803 @@ -0,0 +1,30 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +bin/main.o: src/main.cpp + $(CC) -c $^ -o $@ +bin/Cube.o: src/Cube.cpp + $(CC) -c $^ -o $@ +bin/Color.o: src/Color.cpp + $(CC) -c $^ -o $@ +bin/Quad.o: src/Quad.cpp + $(CC) -c $^ -o $@ +bin/Vertex.o: src/Vertex.cpp + $(CC) -c $^ -o $@ +bin/simulator: $(goals) ; + $(CC) -c $^ -o $@ + +build: $(goals) ; + $(CC) $(goals) -o ./bin/simulator + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main \ No newline at end of file diff --git a/.history/Makefile_20200512005826 b/.history/Makefile_20200512005826 new file mode 100644 index 0000000..2adf4de --- /dev/null +++ b/.history/Makefile_20200512005826 @@ -0,0 +1,30 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +bin/main.o: src/main.cpp + $(CC) -c $^ -o $@ +bin/Cube.o: src/Cube.cpp + $(CC) -c $^ -o $@ +bin/Color.o: src/Color.cpp + $(CC) -c $^ -o $@ +bin/Quad.o: src/Quad.cpp + $(CC) -c $^ -o $@ +bin/Vertex.o: src/Vertex.cpp + $(CC) -c $^ -o $@ +bin/simulator: $(goals) ; + $(CC) -c $^ -o $@ + +build: $(goals) ; + $(CC) $(goals) -o ./bin/simulator $(LINK) + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main \ No newline at end of file diff --git a/.history/Makefile_20200512005851 b/.history/Makefile_20200512005851 new file mode 100644 index 0000000..1eca7e6 --- /dev/null +++ b/.history/Makefile_20200512005851 @@ -0,0 +1,28 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +bin/main.o: src/main.cpp + $(CC) -c $^ -o $@ +bin/Cube.o: src/Cube.cpp + $(CC) -c $^ -o $@ +bin/Color.o: src/Color.cpp + $(CC) -c $^ -o $@ +bin/Quad.o: src/Quad.cpp + $(CC) -c $^ -o $@ +bin/Vertex.o: src/Vertex.cpp + $(CC) -c $^ -o $@ + +build: $(goals) ; + $(CC) $(goals) -o ./bin/simulator $(LINK) + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +run: build ; + ./bin/main \ No newline at end of file diff --git a/.history/Makefile_20200512005925 b/.history/Makefile_20200512005925 new file mode 100644 index 0000000..6d5d3f8 --- /dev/null +++ b/.history/Makefile_20200512005925 @@ -0,0 +1,29 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +bin/main.o: src/main.cpp + $(CC) -c $^ -o $@ +bin/Cube.o: src/Cube.cpp + $(CC) -c $^ -o $@ +bin/Color.o: src/Color.cpp + $(CC) -c $^ -o $@ +bin/Quad.o: src/Quad.cpp + $(CC) -c $^ -o $@ +bin/Vertex.o: src/Vertex.cpp + $(CC) -c $^ -o $@ + +build: $(goals) ; + $(CC) $(goals) -o ./bin/simulator $(LINK) + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +.PHONY run +run: build ; + ./bin/main \ No newline at end of file diff --git a/.history/Makefile_20200512005944 b/.history/Makefile_20200512005944 new file mode 100644 index 0000000..65dd269 --- /dev/null +++ b/.history/Makefile_20200512005944 @@ -0,0 +1,29 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +bin/main.o: src/main.cpp + $(CC) -c $^ -o $@ +bin/Cube.o: src/Cube.cpp + $(CC) -c $^ -o $@ +bin/Color.o: src/Color.cpp + $(CC) -c $^ -o $@ +bin/Quad.o: src/Quad.cpp + $(CC) -c $^ -o $@ +bin/Vertex.o: src/Vertex.cpp + $(CC) -c $^ -o $@ + +build: $(goals) ; + $(CC) $(goals) -o ./bin/simulator $(LINK) + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +.PHONY run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200512010012 b/.history/Makefile_20200512010012 new file mode 100644 index 0000000..94723e4 --- /dev/null +++ b/.history/Makefile_20200512010012 @@ -0,0 +1,29 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +bin/main.o: src/main.cpp + $(CC) -c $^ -o $@ +bin/Cube.o: src/Cube.cpp + $(CC) -c $^ -o $@ +bin/Color.o: src/Color.cpp + $(CC) -c $^ -o $@ +bin/Quad.o: src/Quad.cpp + $(CC) -c $^ -o $@ +bin/Vertex.o: src/Vertex.cpp + $(CC) -c $^ -o $@ + +build: $(goals) ; + $(CC) $(goals) -o ./bin/simulator $(LINK) + +.PHONY: clean +clean: main.o ; + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200512095009 b/.history/Makefile_20200512095009 new file mode 100644 index 0000000..69ba4b4 --- /dev/null +++ b/.history/Makefile_20200512095009 @@ -0,0 +1,29 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +bin/main.o: src/main.cpp + $(CC) -c $^ -o $@ +bin/Cube.o: src/Cube.cpp + $(CC) -c $^ -o $@ +bin/Color.o: src/Color.cpp + $(CC) -c $^ -o $@ +bin/Quad.o: src/Quad.cpp + $(CC) -c $^ -o $@ +bin/Vertex.o: src/Vertex.cpp + $(CC) -c $^ -o $@ + +build: $(goals) ; + $(CC) $(goals) -o ./bin/simulator $(LINK) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200512095614 b/.history/Makefile_20200512095614 new file mode 100644 index 0000000..69ba4b4 --- /dev/null +++ b/.history/Makefile_20200512095614 @@ -0,0 +1,29 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +bin/main.o: src/main.cpp + $(CC) -c $^ -o $@ +bin/Cube.o: src/Cube.cpp + $(CC) -c $^ -o $@ +bin/Color.o: src/Color.cpp + $(CC) -c $^ -o $@ +bin/Quad.o: src/Quad.cpp + $(CC) -c $^ -o $@ +bin/Vertex.o: src/Vertex.cpp + $(CC) -c $^ -o $@ + +build: $(goals) ; + $(CC) $(goals) -o ./bin/simulator $(LINK) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200512095616 b/.history/Makefile_20200512095616 new file mode 100644 index 0000000..69ba4b4 --- /dev/null +++ b/.history/Makefile_20200512095616 @@ -0,0 +1,29 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +bin/main.o: src/main.cpp + $(CC) -c $^ -o $@ +bin/Cube.o: src/Cube.cpp + $(CC) -c $^ -o $@ +bin/Color.o: src/Color.cpp + $(CC) -c $^ -o $@ +bin/Quad.o: src/Quad.cpp + $(CC) -c $^ -o $@ +bin/Vertex.o: src/Vertex.cpp + $(CC) -c $^ -o $@ + +build: $(goals) ; + $(CC) $(goals) -o ./bin/simulator $(LINK) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200512113711 b/.history/Makefile_20200512113711 new file mode 100644 index 0000000..cff1683 --- /dev/null +++ b/.history/Makefile_20200512113711 @@ -0,0 +1,33 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +bin/main.o: src/main.cpp + $(pro) +bin/Cube.o: src/Cube.cpp + $(pro) +bin/Color.o: src/Color.cpp + $(pro) +bin/Quad.o: src/Quad.cpp + $(pro) +bin/Vertex.o: src/Vertex.cpp + $(pro) + +build: $(goals) ; + $(CC) $(goals) -o ./bin/simulator $(LINK) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200512122020 b/.history/Makefile_20200512122020 new file mode 100644 index 0000000..12c3215 --- /dev/null +++ b/.history/Makefile_20200512122020 @@ -0,0 +1,34 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +echo $% +endef + +bin/main.o: src/main.cpp + $(pro) +bin/Cube.o: src/Cube.cpp + $(pro) +bin/Color.o: src/Color.cpp + $(pro) +bin/Quad.o: src/Quad.cpp + $(pro) +bin/Vertex.o: src/Vertex.cpp + $(pro) + +build: $(goals) ; + $(CC) $(goals) -o ./bin/simulator $(LINK) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200512122058 b/.history/Makefile_20200512122058 new file mode 100644 index 0000000..2fb661d --- /dev/null +++ b/.history/Makefile_20200512122058 @@ -0,0 +1,34 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +echo $% +endef + +bin/main.o: src/main.cpp src/Quad.h + $(pro) +bin/Cube.o: src/Cube.cpp src/Cube.h + $(pro) +bin/Color.o: src/Color.cpp + $(pro) +bin/Quad.o: src/Quad.cpp + $(pro) +bin/Vertex.o: src/Vertex.cpp + $(pro) + +build: $(goals) ; + $(CC) $(goals) -o ./bin/simulator $(LINK) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200512122134 b/.history/Makefile_20200512122134 new file mode 100644 index 0000000..12c3215 --- /dev/null +++ b/.history/Makefile_20200512122134 @@ -0,0 +1,34 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +echo $% +endef + +bin/main.o: src/main.cpp + $(pro) +bin/Cube.o: src/Cube.cpp + $(pro) +bin/Color.o: src/Color.cpp + $(pro) +bin/Quad.o: src/Quad.cpp + $(pro) +bin/Vertex.o: src/Vertex.cpp + $(pro) + +build: $(goals) ; + $(CC) $(goals) -o ./bin/simulator $(LINK) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200512122202 b/.history/Makefile_20200512122202 new file mode 100644 index 0000000..cff1683 --- /dev/null +++ b/.history/Makefile_20200512122202 @@ -0,0 +1,33 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +bin/main.o: src/main.cpp + $(pro) +bin/Cube.o: src/Cube.cpp + $(pro) +bin/Color.o: src/Color.cpp + $(pro) +bin/Quad.o: src/Quad.cpp + $(pro) +bin/Vertex.o: src/Vertex.cpp + $(pro) + +build: $(goals) ; + $(CC) $(goals) -o ./bin/simulator $(LINK) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200512122220 b/.history/Makefile_20200512122220 new file mode 100644 index 0000000..d4799cd --- /dev/null +++ b/.history/Makefile_20200512122220 @@ -0,0 +1,33 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +bin/main.o: %o : %cpp + $(pro) +bin/Cube.o: src/Cube.cpp + $(pro) +bin/Color.o: src/Color.cpp + $(pro) +bin/Quad.o: src/Quad.cpp + $(pro) +bin/Vertex.o: src/Vertex.cpp + $(pro) + +build: $(goals) ; + $(CC) $(goals) -o ./bin/simulator $(LINK) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200512122241 b/.history/Makefile_20200512122241 new file mode 100644 index 0000000..717ecc4 --- /dev/null +++ b/.history/Makefile_20200512122241 @@ -0,0 +1,33 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +bin/main.o: %o : src/%cpp + $(pro) +bin/Cube.o: src/Cube.cpp + $(pro) +bin/Color.o: src/Color.cpp + $(pro) +bin/Quad.o: src/Quad.cpp + $(pro) +bin/Vertex.o: src/Vertex.cpp + $(pro) + +build: $(goals) ; + $(CC) $(goals) -o ./bin/simulator $(LINK) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200512122259 b/.history/Makefile_20200512122259 new file mode 100644 index 0000000..af85ee1 --- /dev/null +++ b/.history/Makefile_20200512122259 @@ -0,0 +1,33 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +bin/main.o: %o : ../src/%cpp + $(pro) +bin/Cube.o: src/Cube.cpp + $(pro) +bin/Color.o: src/Color.cpp + $(pro) +bin/Quad.o: src/Quad.cpp + $(pro) +bin/Vertex.o: src/Vertex.cpp + $(pro) + +build: $(goals) ; + $(CC) $(goals) -o ./bin/simulator $(LINK) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200512122307 b/.history/Makefile_20200512122307 new file mode 100644 index 0000000..d4799cd --- /dev/null +++ b/.history/Makefile_20200512122307 @@ -0,0 +1,33 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +bin/main.o: %o : %cpp + $(pro) +bin/Cube.o: src/Cube.cpp + $(pro) +bin/Color.o: src/Color.cpp + $(pro) +bin/Quad.o: src/Quad.cpp + $(pro) +bin/Vertex.o: src/Vertex.cpp + $(pro) + +build: $(goals) ; + $(CC) $(goals) -o ./bin/simulator $(LINK) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200512122440 b/.history/Makefile_20200512122440 new file mode 100644 index 0000000..d4799cd --- /dev/null +++ b/.history/Makefile_20200512122440 @@ -0,0 +1,33 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +bin/main.o: %o : %cpp + $(pro) +bin/Cube.o: src/Cube.cpp + $(pro) +bin/Color.o: src/Color.cpp + $(pro) +bin/Quad.o: src/Quad.cpp + $(pro) +bin/Vertex.o: src/Vertex.cpp + $(pro) + +build: $(goals) ; + $(CC) $(goals) -o ./bin/simulator $(LINK) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200512122803 b/.history/Makefile_20200512122803 new file mode 100644 index 0000000..b39e781 --- /dev/null +++ b/.history/Makefile_20200512122803 @@ -0,0 +1,34 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +echo $* +endef + +bin/main.o: %o : %cpp + $(pro) +bin/Cube.o: src/Cube.cpp + $(pro) +bin/Color.o: src/Color.cpp + $(pro) +bin/Quad.o: src/Quad.cpp + $(pro) +bin/Vertex.o: src/Vertex.cpp + $(pro) + +build: $(goals) ; + $(CC) $(goals) -o ./bin/simulator $(LINK) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200512122821 b/.history/Makefile_20200512122821 new file mode 100644 index 0000000..c7c9890 --- /dev/null +++ b/.history/Makefile_20200512122821 @@ -0,0 +1,34 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +echo $* +endef + +bin/main.o: src/main.cpp + $(pro) +bin/Cube.o: src/Cube.cpp + $(pro) +bin/Color.o: src/Color.cpp + $(pro) +bin/Quad.o: src/Quad.cpp + $(pro) +bin/Vertex.o: src/Vertex.cpp + $(pro) + +build: $(goals) ; + $(CC) $(goals) -o ./bin/simulator $(LINK) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200512122910 b/.history/Makefile_20200512122910 new file mode 100644 index 0000000..cff1683 --- /dev/null +++ b/.history/Makefile_20200512122910 @@ -0,0 +1,33 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +bin/main.o: src/main.cpp + $(pro) +bin/Cube.o: src/Cube.cpp + $(pro) +bin/Color.o: src/Color.cpp + $(pro) +bin/Quad.o: src/Quad.cpp + $(pro) +bin/Vertex.o: src/Vertex.cpp + $(pro) + +build: $(goals) ; + $(CC) $(goals) -o ./bin/simulator $(LINK) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200512145408 b/.history/Makefile_20200512145408 new file mode 100644 index 0000000..491201b --- /dev/null +++ b/.history/Makefile_20200512145408 @@ -0,0 +1,34 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +#bin/main.o: src/main.cpp +# $(pro) +#bin/Cube.o: src/Cube.cpp +# $(pro) +#bin/Color.o: src/Color.cpp +# $(pro) +#bin/Quad.o: src/Quad.cpp +# $(pro) +#bin/Vertex.o: src/Vertex.cpp +# $(pro) + +build: $(goals) ; + for goal in $(goals) do + $(CC) $(goals) -o ./bin/simulator $(LINK) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200512145509 b/.history/Makefile_20200512145509 new file mode 100644 index 0000000..f2a64b7 --- /dev/null +++ b/.history/Makefile_20200512145509 @@ -0,0 +1,36 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +#bin/main.o: src/main.cpp +# $(pro) +#bin/Cube.o: src/Cube.cpp +# $(pro) +#bin/Color.o: src/Color.cpp +# $(pro) +#bin/Quad.o: src/Quad.cpp +# $(pro) +#bin/Vertex.o: src/Vertex.cpp +# $(pro) + +build: $(goals) ; + for goal in $(goals) ; do\ + echo $$goal ; \ + done + $(CC) $(goals) -o ./bin/simulator $(LINK) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200512145543 b/.history/Makefile_20200512145543 new file mode 100644 index 0000000..5386e38 --- /dev/null +++ b/.history/Makefile_20200512145543 @@ -0,0 +1,36 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +#bin/main.o: src/main.cpp +# $(pro) +#bin/Cube.o: src/Cube.cpp +# $(pro) +#bin/Color.o: src/Color.cpp +# $(pro) +#bin/Quad.o: src/Quad.cpp +# $(pro) +#bin/Vertex.o: src/Vertex.cpp +# $(pro) + +build: $(goals) ; + for goal in $(goals) ; do\ + $(pro) $$goal ; \ + done + $(CC) $(goals) -o ./bin/simulator $(LINK) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200512145729 b/.history/Makefile_20200512145729 new file mode 100644 index 0000000..cff1683 --- /dev/null +++ b/.history/Makefile_20200512145729 @@ -0,0 +1,33 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +bin/main.o: src/main.cpp + $(pro) +bin/Cube.o: src/Cube.cpp + $(pro) +bin/Color.o: src/Color.cpp + $(pro) +bin/Quad.o: src/Quad.cpp + $(pro) +bin/Vertex.o: src/Vertex.cpp + $(pro) + +build: $(goals) ; + $(CC) $(goals) -o ./bin/simulator $(LINK) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200512145745 b/.history/Makefile_20200512145745 new file mode 100644 index 0000000..cff1683 --- /dev/null +++ b/.history/Makefile_20200512145745 @@ -0,0 +1,33 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +bin/main.o: src/main.cpp + $(pro) +bin/Cube.o: src/Cube.cpp + $(pro) +bin/Color.o: src/Color.cpp + $(pro) +bin/Quad.o: src/Quad.cpp + $(pro) +bin/Vertex.o: src/Vertex.cpp + $(pro) + +build: $(goals) ; + $(CC) $(goals) -o ./bin/simulator $(LINK) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200513122930 b/.history/Makefile_20200513122930 new file mode 100644 index 0000000..5508590 --- /dev/null +++ b/.history/Makefile_20200513122930 @@ -0,0 +1,37 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +bin/main.o: src/main.cpp + $(pro) +bin/Cube.o: src/Cube.cpp + $(pro) +bin/Color.o: src/Color.cpp + $(pro) +bin/Quad.o: src/Quad.cpp + $(pro) +bin/Vertex.o: src/Vertex.cpp + $(pro) + +$(goals): %.o : %.cpp + for goal in $(goals) ; do\ + $(CC) $($$goal: %.o : %.cpp) $$goal + +build: $(goals) ; + $(CC) $(goals) -o ./bin/simulator $(LINK) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200513122959 b/.history/Makefile_20200513122959 new file mode 100644 index 0000000..7f9c690 --- /dev/null +++ b/.history/Makefile_20200513122959 @@ -0,0 +1,37 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +#bin/main.o: src/main.cpp +# $(pro) +#bin/Cube.o: src/Cube.cpp +# $(pro) +#bin/Color.o: src/Color.cpp +# $(pro) +#bin/Quad.o: src/Quad.cpp +# $(pro) +#bin/Vertex.o: src/Vertex.cpp +# $(pro) + +$(goals): %.o : %.cpp + for goal in $(goals) ; do\ + $(CC) $($$goal: %.o : %.cpp) $$goal + +build: $(goals) ; + $(CC) $(goals) -o ./bin/simulator $(LINK) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200513123017 b/.history/Makefile_20200513123017 new file mode 100644 index 0000000..db34590 --- /dev/null +++ b/.history/Makefile_20200513123017 @@ -0,0 +1,38 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +#bin/main.o: src/main.cpp +# $(pro) +#bin/Cube.o: src/Cube.cpp +# $(pro) +#bin/Color.o: src/Color.cpp +# $(pro) +#bin/Quad.o: src/Quad.cpp +# $(pro) +#bin/Vertex.o: src/Vertex.cpp +# $(pro) + +$(goals): %.o : %.cpp + for goal in $(goals) ; do\ + $(CC) $($$goal: %.o : %.cpp) $$goal + +build: $(goals) ; + #$(CC) $(goals) -o ./bin/simulator $(LINK) + $(goals) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200513123140 b/.history/Makefile_20200513123140 new file mode 100644 index 0000000..8f95f95 --- /dev/null +++ b/.history/Makefile_20200513123140 @@ -0,0 +1,38 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +#bin/main.o: src/main.cpp +# $(pro) +#bin/Cube.o: src/Cube.cpp +# $(pro) +#bin/Color.o: src/Color.cpp +# $(pro) +#bin/Quad.o: src/Quad.cpp +# $(pro) +#bin/Vertex.o: src/Vertex.cpp +# $(pro) + +$(goals): %bin/ : %src/ : %.o : %.cpp + for goal in $(goals) ; do\ + $(CC) $($$goal: %.o : %.cpp) $$goal + +build: $(goals) ; + #$(CC) $(goals) -o ./bin/simulator $(LINK) + $(goals) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200513123200 b/.history/Makefile_20200513123200 new file mode 100644 index 0000000..3824998 --- /dev/null +++ b/.history/Makefile_20200513123200 @@ -0,0 +1,38 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +#bin/main.o: src/main.cpp +# $(pro) +#bin/Cube.o: src/Cube.cpp +# $(pro) +#bin/Color.o: src/Color.cpp +# $(pro) +#bin/Quad.o: src/Quad.cpp +# $(pro) +#bin/Vertex.o: src/Vertex.cpp +# $(pro) + +$(goals): %bin/ : %src/ %.o : %.cpp + for goal in $(goals) ; do\ + $(CC) $($$goal: %.o : %.cpp) $$goal + +build: $(goals) ; + #$(CC) $(goals) -o ./bin/simulator $(LINK) + $(goals) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200513123243 b/.history/Makefile_20200513123243 new file mode 100644 index 0000000..102cb82 --- /dev/null +++ b/.history/Makefile_20200513123243 @@ -0,0 +1,38 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +#bin/main.o: src/main.cpp +# $(pro) +#bin/Cube.o: src/Cube.cpp +# $(pro) +#bin/Color.o: src/Color.cpp +# $(pro) +#bin/Quad.o: src/Quad.cpp +# $(pro) +#bin/Vertex.o: src/Vertex.cpp +# $(pro) + +$(goals): bin/%.o : src/%.cpp + for goal in $(goals) ; do\ + $(CC) $($$goal: %.o : %.cpp) $$goal + +build: $(goals) ; + #$(CC) $(goals) -o ./bin/simulator $(LINK) + $(goals) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200513123410 b/.history/Makefile_20200513123410 new file mode 100644 index 0000000..01ede3c --- /dev/null +++ b/.history/Makefile_20200513123410 @@ -0,0 +1,38 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +#bin/main.o: src/main.cpp +# $(pro) +#bin/Cube.o: src/Cube.cpp +# $(pro) +#bin/Color.o: src/Color.cpp +# $(pro) +#bin/Quad.o: src/Quad.cpp +# $(pro) +#bin/Vertex.o: src/Vertex.cpp +# $(pro) + +$goals: bin/%.o : src/%.cpp + for goal in $(goals) ; do\ + $(CC) $($$goal: %.o : %.cpp) $$goal + +build: $(goals) ; + #$(CC) $(goals) -o ./bin/simulator $(LINK) + $(goals) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200513123423 b/.history/Makefile_20200513123423 new file mode 100644 index 0000000..102cb82 --- /dev/null +++ b/.history/Makefile_20200513123423 @@ -0,0 +1,38 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +#bin/main.o: src/main.cpp +# $(pro) +#bin/Cube.o: src/Cube.cpp +# $(pro) +#bin/Color.o: src/Color.cpp +# $(pro) +#bin/Quad.o: src/Quad.cpp +# $(pro) +#bin/Vertex.o: src/Vertex.cpp +# $(pro) + +$(goals): bin/%.o : src/%.cpp + for goal in $(goals) ; do\ + $(CC) $($$goal: %.o : %.cpp) $$goal + +build: $(goals) ; + #$(CC) $(goals) -o ./bin/simulator $(LINK) + $(goals) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200513123433 b/.history/Makefile_20200513123433 new file mode 100644 index 0000000..3e3a18b --- /dev/null +++ b/.history/Makefile_20200513123433 @@ -0,0 +1,38 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +bin/main.o: src/main.cpp +# $(pro) +bin/Cube.o: src/Cube.cpp +# $(pro) +bin/Color.o: src/Color.cpp +# $(pro) +bin/Quad.o: src/Quad.cpp +# $(pro) +bin/Vertex.o: src/Vertex.cpp +# $(pro) + +$(goals): bin/%.o : src/%.cpp + for goal in $(goals) ; do\ + $(CC) $($$goal: %.o : %.cpp) $$goal + +build: $(goals) ; + #$(CC) $(goals) -o ./bin/simulator $(LINK) + $(goals) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200513123441 b/.history/Makefile_20200513123441 new file mode 100644 index 0000000..102cb82 --- /dev/null +++ b/.history/Makefile_20200513123441 @@ -0,0 +1,38 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +#bin/main.o: src/main.cpp +# $(pro) +#bin/Cube.o: src/Cube.cpp +# $(pro) +#bin/Color.o: src/Color.cpp +# $(pro) +#bin/Quad.o: src/Quad.cpp +# $(pro) +#bin/Vertex.o: src/Vertex.cpp +# $(pro) + +$(goals): bin/%.o : src/%.cpp + for goal in $(goals) ; do\ + $(CC) $($$goal: %.o : %.cpp) $$goal + +build: $(goals) ; + #$(CC) $(goals) -o ./bin/simulator $(LINK) + $(goals) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200513123514 b/.history/Makefile_20200513123514 new file mode 100644 index 0000000..0f38f32 --- /dev/null +++ b/.history/Makefile_20200513123514 @@ -0,0 +1,39 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +#bin/main.o: src/main.cpp +# $(pro) +#bin/Cube.o: src/Cube.cpp +# $(pro) +#bin/Color.o: src/Color.cpp +# $(pro) +#bin/Quad.o: src/Quad.cpp +# $(pro) +#bin/Vertex.o: src/Vertex.cpp +# $(pro) + +$(goals): bin/%.o : src/%.cpp + for goal in $(goals) ; do\ + $(CC) $($$goal: %.o : %.cpp) $$goal ; \ + done + +build: $(goals) ; + #$(CC) $(goals) -o ./bin/simulator $(LINK) + $(goals) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200513123603 b/.history/Makefile_20200513123603 new file mode 100644 index 0000000..a6465a8 --- /dev/null +++ b/.history/Makefile_20200513123603 @@ -0,0 +1,39 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +#bin/main.o: src/main.cpp +# $(pro) +#bin/Cube.o: src/Cube.cpp +# $(pro) +#bin/Color.o: src/Color.cpp +# $(pro) +#bin/Quad.o: src/Quad.cpp +# $(pro) +#bin/Vertex.o: src/Vertex.cpp +# $(pro) + +$(goals): %.o : %.cpp + for goal in $(goals) ; do\ + $(CC) $($$goal: %.o : %.cpp) $$goal ; \ + done + +build: $(goals) ; + #$(CC) $(goals) -o ./bin/simulator $(LINK) + $(goals) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200513123629 b/.history/Makefile_20200513123629 new file mode 100644 index 0000000..a6465a8 --- /dev/null +++ b/.history/Makefile_20200513123629 @@ -0,0 +1,39 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +#bin/main.o: src/main.cpp +# $(pro) +#bin/Cube.o: src/Cube.cpp +# $(pro) +#bin/Color.o: src/Color.cpp +# $(pro) +#bin/Quad.o: src/Quad.cpp +# $(pro) +#bin/Vertex.o: src/Vertex.cpp +# $(pro) + +$(goals): %.o : %.cpp + for goal in $(goals) ; do\ + $(CC) $($$goal: %.o : %.cpp) $$goal ; \ + done + +build: $(goals) ; + #$(CC) $(goals) -o ./bin/simulator $(LINK) + $(goals) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200513123759 b/.history/Makefile_20200513123759 new file mode 100644 index 0000000..5f973ac --- /dev/null +++ b/.history/Makefile_20200513123759 @@ -0,0 +1,39 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +#bin/main.o: src/main.cpp +# $(pro) +#bin/Cube.o: src/Cube.cpp +# $(pro) +#bin/Color.o: src/Color.cpp +# $(pro) +#bin/Quad.o: src/Quad.cpp +# $(pro) +#bin/Vertex.o: src/Vertex.cpp +# $(pro) + +$(goals): %.o:%.cpp + for goal in $(goals) ; do\ + $(CC) $($$goal: %.o : %.cpp) $$goal ; \ + done + +build: $(goals) ; + #$(CC) $(goals) -o ./bin/simulator $(LINK) + $(goals) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200513123840 b/.history/Makefile_20200513123840 new file mode 100644 index 0000000..864dceb --- /dev/null +++ b/.history/Makefile_20200513123840 @@ -0,0 +1,39 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +#bin/main.o: src/main.cpp +# $(pro) +#bin/Cube.o: src/Cube.cpp +# $(pro) +#bin/Color.o: src/Color.cpp +# $(pro) +#bin/Quad.o: src/Quad.cpp +# $(pro) +#bin/Vertex.o: src/Vertex.cpp +# $(pro) + +$(goals): bin/%.o:src/%.cpp + for goal in $(goals) ; do\ + $(CC) $($$goal: src/%.o : src/%.cpp) $$goal ; \ + done + +build: $(goals) ; + #$(CC) $(goals) -o ./bin/simulator $(LINK) + $(goals) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200513123854 b/.history/Makefile_20200513123854 new file mode 100644 index 0000000..0450088 --- /dev/null +++ b/.history/Makefile_20200513123854 @@ -0,0 +1,39 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +#bin/main.o: src/main.cpp +# $(pro) +#bin/Cube.o: src/Cube.cpp +# $(pro) +#bin/Color.o: src/Color.cpp +# $(pro) +#bin/Quad.o: src/Quad.cpp +# $(pro) +#bin/Vertex.o: src/Vertex.cpp +# $(pro) + +$(goals): %.o:%.cpp + for goal in $(goals) ; do\ + $(CC) $($$goal: src/%.o : src/%.cpp) $$goal ; \ + done + +build: $(goals) ; + #$(CC) $(goals) -o ./bin/simulator $(LINK) + $(goals) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200513123905 b/.history/Makefile_20200513123905 new file mode 100644 index 0000000..0450088 --- /dev/null +++ b/.history/Makefile_20200513123905 @@ -0,0 +1,39 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +#bin/main.o: src/main.cpp +# $(pro) +#bin/Cube.o: src/Cube.cpp +# $(pro) +#bin/Color.o: src/Color.cpp +# $(pro) +#bin/Quad.o: src/Quad.cpp +# $(pro) +#bin/Vertex.o: src/Vertex.cpp +# $(pro) + +$(goals): %.o:%.cpp + for goal in $(goals) ; do\ + $(CC) $($$goal: src/%.o : src/%.cpp) $$goal ; \ + done + +build: $(goals) ; + #$(CC) $(goals) -o ./bin/simulator $(LINK) + $(goals) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200513124216 b/.history/Makefile_20200513124216 new file mode 100644 index 0000000..5f973ac --- /dev/null +++ b/.history/Makefile_20200513124216 @@ -0,0 +1,39 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +#bin/main.o: src/main.cpp +# $(pro) +#bin/Cube.o: src/Cube.cpp +# $(pro) +#bin/Color.o: src/Color.cpp +# $(pro) +#bin/Quad.o: src/Quad.cpp +# $(pro) +#bin/Vertex.o: src/Vertex.cpp +# $(pro) + +$(goals): %.o:%.cpp + for goal in $(goals) ; do\ + $(CC) $($$goal: %.o : %.cpp) $$goal ; \ + done + +build: $(goals) ; + #$(CC) $(goals) -o ./bin/simulator $(LINK) + $(goals) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200513124320 b/.history/Makefile_20200513124320 new file mode 100644 index 0000000..7ba8f22 --- /dev/null +++ b/.history/Makefile_20200513124320 @@ -0,0 +1,39 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +#bin/main.o: src/main.cpp +# $(pro) +#bin/Cube.o: src/Cube.cpp +# $(pro) +#bin/Color.o: src/Color.cpp +# $(pro) +#bin/Quad.o: src/Quad.cpp +# $(pro) +#bin/Vertex.o: src/Vertex.cpp +# $(pro) + +$(goals): $(substr bin/,src/,%.o:%.cpp) + for goal in $(goals) ; do\ + $(CC) $(subst bin/,src/,$($$goal: %.o : %.cpp)) $$goal ; \ + done + +build: $(goals) ; + #$(CC) $(goals) -o ./bin/simulator $(LINK) + $(goals) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200513124438 b/.history/Makefile_20200513124438 new file mode 100644 index 0000000..072cddb --- /dev/null +++ b/.history/Makefile_20200513124438 @@ -0,0 +1,40 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +#bin/main.o: src/main.cpp +# $(pro) +#bin/Cube.o: src/Cube.cpp +# $(pro) +#bin/Color.o: src/Color.cpp +# $(pro) +#bin/Quad.o: src/Quad.cpp +# $(pro) +#bin/Vertex.o: src/Vertex.cpp +# $(pro) +targets = $(substr bin/*.o,src/*.cpp,$(goals)) +$(goals): $(substr bin/,src/,%.o:%.cpp) + + for goal in $(goals) ; do\ + $(CC) $(subst bin/,src/,$($$goal: %.o : %.cpp)) $$goal ; \ + done + +build: $(goals) ; + #$(CC) $(goals) -o ./bin/simulator $(LINK) + $(goals) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200513124541 b/.history/Makefile_20200513124541 new file mode 100644 index 0000000..73e5635 --- /dev/null +++ b/.history/Makefile_20200513124541 @@ -0,0 +1,39 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +#bin/main.o: src/main.cpp +# $(pro) +#bin/Cube.o: src/Cube.cpp +# $(pro) +#bin/Color.o: src/Color.cpp +# $(pro) +#bin/Quad.o: src/Quad.cpp +# $(pro) +#bin/Vertex.o: src/Vertex.cpp +# $(pro) +targets = $(substr bin/*.o,src/*.cpp,$(goals)) +$(goals): $(targets) + for goal in $(goals) ; do\ + $(CC) $(subst bin/,src/,$($$goal: %.o : %.cpp)) $$goal ; \ + done + +build: $(goals) ; + #$(CC) $(goals) -o ./bin/simulator $(LINK) + $(goals) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200513124558 b/.history/Makefile_20200513124558 new file mode 100644 index 0000000..73e5635 --- /dev/null +++ b/.history/Makefile_20200513124558 @@ -0,0 +1,39 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +#bin/main.o: src/main.cpp +# $(pro) +#bin/Cube.o: src/Cube.cpp +# $(pro) +#bin/Color.o: src/Color.cpp +# $(pro) +#bin/Quad.o: src/Quad.cpp +# $(pro) +#bin/Vertex.o: src/Vertex.cpp +# $(pro) +targets = $(substr bin/*.o,src/*.cpp,$(goals)) +$(goals): $(targets) + for goal in $(goals) ; do\ + $(CC) $(subst bin/,src/,$($$goal: %.o : %.cpp)) $$goal ; \ + done + +build: $(goals) ; + #$(CC) $(goals) -o ./bin/simulator $(LINK) + $(goals) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200513124608 b/.history/Makefile_20200513124608 new file mode 100644 index 0000000..f802d81 --- /dev/null +++ b/.history/Makefile_20200513124608 @@ -0,0 +1,39 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +#bin/main.o: src/main.cpp +# $(pro) +#bin/Cube.o: src/Cube.cpp +# $(pro) +#bin/Color.o: src/Color.cpp +# $(pro) +#bin/Quad.o: src/Quad.cpp +# $(pro) +#bin/Vertex.o: src/Vertex.cpp +# $(pro) +targets = $(substr bin/*.o,src/*.cpp,$(goals)) +$(goals): $(targets) + for goal in $(goals) ; do\ + $(CC) $(subst bin/,src/,$($$goal: %.o : %.cpp)) $(goal) ; \ + done + +build: $(goals) ; + #$(CC) $(goals) -o ./bin/simulator $(LINK) + $(goals) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200513124624 b/.history/Makefile_20200513124624 new file mode 100644 index 0000000..73e5635 --- /dev/null +++ b/.history/Makefile_20200513124624 @@ -0,0 +1,39 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +#bin/main.o: src/main.cpp +# $(pro) +#bin/Cube.o: src/Cube.cpp +# $(pro) +#bin/Color.o: src/Color.cpp +# $(pro) +#bin/Quad.o: src/Quad.cpp +# $(pro) +#bin/Vertex.o: src/Vertex.cpp +# $(pro) +targets = $(substr bin/*.o,src/*.cpp,$(goals)) +$(goals): $(targets) + for goal in $(goals) ; do\ + $(CC) $(subst bin/,src/,$($$goal: %.o : %.cpp)) $$goal ; \ + done + +build: $(goals) ; + #$(CC) $(goals) -o ./bin/simulator $(LINK) + $(goals) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200513125013 b/.history/Makefile_20200513125013 new file mode 100644 index 0000000..004bff5 --- /dev/null +++ b/.history/Makefile_20200513125013 @@ -0,0 +1,40 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +#bin/main.o: src/main.cpp +# $(pro) +#bin/Cube.o: src/Cube.cpp +# $(pro) +#bin/Color.o: src/Color.cpp +# $(pro) +#bin/Quad.o: src/Quad.cpp +# $(pro) +#bin/Vertex.o: src/Vertex.cpp +# $(pro) +targets = $(substr bin/*.o,src/*.cpp,$(goals)) +$(goals): $(targets) + echo $(targets) + for goal in $(goals) ; do\ + $(CC) $(subst bin/,src/,$($$goal: %.o : %.cpp)) $$goal ; \ + done + +build: $(goals) ; + #$(CC) $(goals) -o ./bin/simulator $(LINK) + $(goals) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200513125052 b/.history/Makefile_20200513125052 new file mode 100644 index 0000000..a5fdab0 --- /dev/null +++ b/.history/Makefile_20200513125052 @@ -0,0 +1,40 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +#bin/main.o: src/main.cpp +# $(pro) +#bin/Cube.o: src/Cube.cpp +# $(pro) +#bin/Color.o: src/Color.cpp +# $(pro) +#bin/Quad.o: src/Quad.cpp +# $(pro) +#bin/Vertex.o: src/Vertex.cpp +# $(pro) +targets = $(substr bin/%.o,src/%.cpp,$(goals)) +$(goals): $(targets) + echo $(targets) + for goal in $(goals) ; do\ + $(CC) $(subst bin/,src/,$($$goal: %.o : %.cpp)) $$goal ; \ + done + +build: $(goals) ; + #$(CC) $(goals) -o ./bin/simulator $(LINK) + $(goals) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200513125126 b/.history/Makefile_20200513125126 new file mode 100644 index 0000000..fc8497c --- /dev/null +++ b/.history/Makefile_20200513125126 @@ -0,0 +1,40 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +#bin/main.o: src/main.cpp +# $(pro) +#bin/Cube.o: src/Cube.cpp +# $(pro) +#bin/Color.o: src/Color.cpp +# $(pro) +#bin/Quad.o: src/Quad.cpp +# $(pro) +#bin/Vertex.o: src/Vertex.cpp +# $(pro) +targets = $(patsubst bin/%.o,src/%.cpp,$(goals)) +$(goals): $(targets) + echo $(targets) + for goal in $(goals) ; do\ + $(CC) $(subst bin/,src/,$($$goal: %.o : %.cpp)) $$goal ; \ + done + +build: $(goals) ; + #$(CC) $(goals) -o ./bin/simulator $(LINK) + $(goals) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200513125143 b/.history/Makefile_20200513125143 new file mode 100644 index 0000000..cd5de7f --- /dev/null +++ b/.history/Makefile_20200513125143 @@ -0,0 +1,40 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +#bin/main.o: src/main.cpp +# $(pro) +#bin/Cube.o: src/Cube.cpp +# $(pro) +#bin/Color.o: src/Color.cpp +# $(pro) +#bin/Quad.o: src/Quad.cpp +# $(pro) +#bin/Vertex.o: src/Vertex.cpp +# $(pro) +targets = $(patsubst bin/%.o,src/%.cpp,$(goals)) +$(goals): $(targets) + echo $(targets) + for goal in $(goals) ; do\ + $(CC) $(patsubst bin/,src/,$($$goal: %.o : %.cpp)) $$goal ; \ + done + +build: $(goals) ; + #$(CC) $(goals) -o ./bin/simulator $(LINK) + $(goals) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200513125206 b/.history/Makefile_20200513125206 new file mode 100644 index 0000000..18fd37c --- /dev/null +++ b/.history/Makefile_20200513125206 @@ -0,0 +1,40 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +#bin/main.o: src/main.cpp +# $(pro) +#bin/Cube.o: src/Cube.cpp +# $(pro) +#bin/Color.o: src/Color.cpp +# $(pro) +#bin/Quad.o: src/Quad.cpp +# $(pro) +#bin/Vertex.o: src/Vertex.cpp +# $(pro) +targets = $(patsubst bin/%.o,src/%.cpp,$(goals)) +$(goals): $(targets) + echo $(targets) + for goal in $(goals) ; do\ + $(CC) $(patsubst bin/%.o,src/%.cpp,$$goal) ; \ + done + +build: $(goals) ; + #$(CC) $(goals) -o ./bin/simulator $(LINK) + $(goals) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200513125218 b/.history/Makefile_20200513125218 new file mode 100644 index 0000000..0e0e951 --- /dev/null +++ b/.history/Makefile_20200513125218 @@ -0,0 +1,39 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +#bin/main.o: src/main.cpp +# $(pro) +#bin/Cube.o: src/Cube.cpp +# $(pro) +#bin/Color.o: src/Color.cpp +# $(pro) +#bin/Quad.o: src/Quad.cpp +# $(pro) +#bin/Vertex.o: src/Vertex.cpp +# $(pro) +targets = $(patsubst bin/%.o,src/%.cpp,$(goals)) +$(goals): $(targets) + for goal in $(goals) ; do\ + $(CC) $(patsubst bin/%.o,src/%.cpp,$$goal) ; \ + done + +build: $(goals) ; + #$(CC) $(goals) -o ./bin/simulator $(LINK) + $(goals) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200513125946 b/.history/Makefile_20200513125946 new file mode 100644 index 0000000..637b92f --- /dev/null +++ b/.history/Makefile_20200513125946 @@ -0,0 +1,40 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +#bin/main.o: src/main.cpp +# $(pro) +#bin/Cube.o: src/Cube.cpp +# $(pro) +#bin/Color.o: src/Color.cpp +# $(pro) +#bin/Quad.o: src/Quad.cpp +# $(pro) +#bin/Vertex.o: src/Vertex.cpp +# $(pro) +targets = $(patsubst bin/%.o,src/%.cpp,$(goals)) +$(goals): $(targets) + $(foreach goal,$(goals),$($(CC) $(patsubst bin/%.o, src/%.cpp, $(goal)))) + for goal in $(goals) ; do\ + $(CC) $(patsubst bin/%.o,src/%.cpp,$$goal) ; \ + done + +build: $(goals) ; + #$(CC) $(goals) -o ./bin/simulator $(LINK) + $(goals) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200513130104 b/.history/Makefile_20200513130104 new file mode 100644 index 0000000..a5dd87b --- /dev/null +++ b/.history/Makefile_20200513130104 @@ -0,0 +1,42 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +#bin/main.o: src/main.cpp +# $(pro) +#bin/Cube.o: src/Cube.cpp +# $(pro) +#bin/Color.o: src/Color.cpp +# $(pro) +#bin/Quad.o: src/Quad.cpp +# $(pro) +#bin/Vertex.o: src/Vertex.cpp +# $(pro) +targets = $(patsubst bin/%.o,src/%.cpp,$(goals)) +$(goals): $(targets) + $(foreach goal,$(goals),$( \ + $(CC) $(patsubst bin/%.o, src/%.cpp, $(goal)) \ + ) + for goal in $(goals) ; do\ + $(CC) $(patsubst bin/%.o,src/%.cpp,$$goal) ; \ + done + +build: $(goals) ; + #$(CC) $(goals) -o ./bin/simulator $(LINK) + $(goals) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200513130117 b/.history/Makefile_20200513130117 new file mode 100644 index 0000000..61e736b --- /dev/null +++ b/.history/Makefile_20200513130117 @@ -0,0 +1,42 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +#bin/main.o: src/main.cpp +# $(pro) +#bin/Cube.o: src/Cube.cpp +# $(pro) +#bin/Color.o: src/Color.cpp +# $(pro) +#bin/Quad.o: src/Quad.cpp +# $(pro) +#bin/Vertex.o: src/Vertex.cpp +# $(pro) +targets = $(patsubst bin/%.o,src/%.cpp,$(goals)) +$(goals): $(targets) + $(foreach goal,$(goals),$( \ + $(CC) $(patsubst bin/%.o, src/%.cpp, $(goal)) \ + )) + for goal in $(goals) ; do\ + $(CC) $(patsubst bin/%.o,src/%.cpp,$$goal) ; \ + done + +build: $(goals) ; + #$(CC) $(goals) -o ./bin/simulator $(LINK) + $(goals) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200513130353 b/.history/Makefile_20200513130353 new file mode 100644 index 0000000..18fd13d --- /dev/null +++ b/.history/Makefile_20200513130353 @@ -0,0 +1,42 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +#bin/main.o: src/main.cpp +# $(pro) +#bin/Cube.o: src/Cube.cpp +# $(pro) +#bin/Color.o: src/Color.cpp +# $(pro) +#bin/Quad.o: src/Quad.cpp +# $(pro) +#bin/Vertex.o: src/Vertex.cpp +# $(pro) +targets = $(patsubst bin/%.o,src/%.cpp,$(goals)) +$(goals): $(targets) + $(foreach goal,$(goals),$( \ + $(CC) $(patsubst bin/%.o, src/%.cpp, $(goal)) \ + )) + #for goal in $(goals) ; do\ + # $(CC) $(patsubst bin/%.o,src/%.cpp,$$goal) ; \ + #done + +build: $(goals) ; + #$(CC) $(goals) -o ./bin/simulator $(LINK) + $(goals) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200513130432 b/.history/Makefile_20200513130432 new file mode 100644 index 0000000..14c45bb --- /dev/null +++ b/.history/Makefile_20200513130432 @@ -0,0 +1,39 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +#bin/main.o: src/main.cpp +# $(pro) +#bin/Cube.o: src/Cube.cpp +# $(pro) +#bin/Color.o: src/Color.cpp +# $(pro) +#bin/Quad.o: src/Quad.cpp +# $(pro) +#bin/Vertex.o: src/Vertex.cpp +# $(pro) +targets = $(patsubst bin/%.o,src/%.cpp,$(goals)) +$(goals): $(targets) + $(foreach goal,$(goals),$( \ + $(CC) $(patsubst bin/%.o, src/%.cpp, $(goal)) \ + )) + +build: $(goals) ; + #$(CC) $(goals) -o ./bin/simulator $(LINK) + $(goals) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200513130456 b/.history/Makefile_20200513130456 new file mode 100644 index 0000000..cc958f4 --- /dev/null +++ b/.history/Makefile_20200513130456 @@ -0,0 +1,40 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +#bin/main.o: src/main.cpp +# $(pro) +#bin/Cube.o: src/Cube.cpp +# $(pro) +#bin/Color.o: src/Color.cpp +# $(pro) +#bin/Quad.o: src/Quad.cpp +# $(pro) +#bin/Vertex.o: src/Vertex.cpp +# $(pro) +targets = $(patsubst bin/%.o,src/%.cpp,$(goals)) +$(goals): $(targets) + $(foreach goal,$(goals),$( \ + $(CC) $(patsubst bin/%.o, src/%.cpp, $(goal)) \ + echo $(goal) + )) + +build: $(goals) ; + #$(CC) $(goals) -o ./bin/simulator $(LINK) + $(goals) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200513130508 b/.history/Makefile_20200513130508 new file mode 100644 index 0000000..7ce87e3 --- /dev/null +++ b/.history/Makefile_20200513130508 @@ -0,0 +1,40 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +#bin/main.o: src/main.cpp +# $(pro) +#bin/Cube.o: src/Cube.cpp +# $(pro) +#bin/Color.o: src/Color.cpp +# $(pro) +#bin/Quad.o: src/Quad.cpp +# $(pro) +#bin/Vertex.o: src/Vertex.cpp +# $(pro) +targets = $(patsubst bin/%.o,src/%.cpp,$(goals)) +$(goals): $(targets) + $(foreach goal,$(goals),$( \ + $(CC) $(patsubst bin/%.o, src/%.cpp, $(goal)) \ + echo $(goal) \ + )) + +build: $(goals) ; + #$(CC) $(goals) -o ./bin/simulator $(LINK) + $(goals) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200513130809 b/.history/Makefile_20200513130809 new file mode 100644 index 0000000..7ce87e3 --- /dev/null +++ b/.history/Makefile_20200513130809 @@ -0,0 +1,40 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +#bin/main.o: src/main.cpp +# $(pro) +#bin/Cube.o: src/Cube.cpp +# $(pro) +#bin/Color.o: src/Color.cpp +# $(pro) +#bin/Quad.o: src/Quad.cpp +# $(pro) +#bin/Vertex.o: src/Vertex.cpp +# $(pro) +targets = $(patsubst bin/%.o,src/%.cpp,$(goals)) +$(goals): $(targets) + $(foreach goal,$(goals),$( \ + $(CC) $(patsubst bin/%.o, src/%.cpp, $(goal)) \ + echo $(goal) \ + )) + +build: $(goals) ; + #$(CC) $(goals) -o ./bin/simulator $(LINK) + $(goals) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200513130839 b/.history/Makefile_20200513130839 new file mode 100644 index 0000000..e50c590 --- /dev/null +++ b/.history/Makefile_20200513130839 @@ -0,0 +1,40 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +#bin/main.o: src/main.cpp +# $(pro) +#bin/Cube.o: src/Cube.cpp +# $(pro) +#bin/Color.o: src/Color.cpp +# $(pro) +#bin/Quad.o: src/Quad.cpp +# $(pro) +#bin/Vertex.o: src/Vertex.cpp +# $(pro) +targets = $(patsubst bin/%.o,src/%.cpp,$(goals)) +$(goals): $(targets) + $(foreach goal,$(goals),$( \ + $(CC) $(patsubst bin/%.o, src/%.cpp, $(goal)) \ + echo $(goal) \ + )) + +build: $(goals) ; + #$(CC) $(goals) -o ./bin/simulator $(LINK) + goals + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200513130844 b/.history/Makefile_20200513130844 new file mode 100644 index 0000000..59b7a95 --- /dev/null +++ b/.history/Makefile_20200513130844 @@ -0,0 +1,39 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +#bin/main.o: src/main.cpp +# $(pro) +#bin/Cube.o: src/Cube.cpp +# $(pro) +#bin/Color.o: src/Color.cpp +# $(pro) +#bin/Quad.o: src/Quad.cpp +# $(pro) +#bin/Vertex.o: src/Vertex.cpp +# $(pro) +targets = $(patsubst bin/%.o,src/%.cpp,$(goals)) +$(goals): $(targets) + $(foreach goal,$(goals),$( \ + $(CC) $(patsubst bin/%.o, src/%.cpp, $(goal)) \ + echo $(goal) \ + )) + +build: $(goals) ; + #$(CC) $(goals) -o ./bin/simulator $(LINK) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200513130854 b/.history/Makefile_20200513130854 new file mode 100644 index 0000000..6ebe964 --- /dev/null +++ b/.history/Makefile_20200513130854 @@ -0,0 +1,40 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +#bin/main.o: src/main.cpp +# $(pro) +#bin/Cube.o: src/Cube.cpp +# $(pro) +#bin/Color.o: src/Color.cpp +# $(pro) +#bin/Quad.o: src/Quad.cpp +# $(pro) +#bin/Vertex.o: src/Vertex.cpp +# $(pro) +targets = $(patsubst bin/%.o,src/%.cpp,$(goals)) +$(goals): $(targets) + $(foreach goal,$(goals),$( \ + $(CC) $(patsubst bin/%.o, src/%.cpp, $(goal)) \ + echo $(goal) \ + )) + +build: $(goals) ; + #$(CC) $(goals) -o ./bin/simulator $(LINK) + $(clean) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200513130906 b/.history/Makefile_20200513130906 new file mode 100644 index 0000000..59b7a95 --- /dev/null +++ b/.history/Makefile_20200513130906 @@ -0,0 +1,39 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +#bin/main.o: src/main.cpp +# $(pro) +#bin/Cube.o: src/Cube.cpp +# $(pro) +#bin/Color.o: src/Color.cpp +# $(pro) +#bin/Quad.o: src/Quad.cpp +# $(pro) +#bin/Vertex.o: src/Vertex.cpp +# $(pro) +targets = $(patsubst bin/%.o,src/%.cpp,$(goals)) +$(goals): $(targets) + $(foreach goal,$(goals),$( \ + $(CC) $(patsubst bin/%.o, src/%.cpp, $(goal)) \ + echo $(goal) \ + )) + +build: $(goals) ; + #$(CC) $(goals) -o ./bin/simulator $(LINK) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200513130915 b/.history/Makefile_20200513130915 new file mode 100644 index 0000000..7ce87e3 --- /dev/null +++ b/.history/Makefile_20200513130915 @@ -0,0 +1,40 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +#bin/main.o: src/main.cpp +# $(pro) +#bin/Cube.o: src/Cube.cpp +# $(pro) +#bin/Color.o: src/Color.cpp +# $(pro) +#bin/Quad.o: src/Quad.cpp +# $(pro) +#bin/Vertex.o: src/Vertex.cpp +# $(pro) +targets = $(patsubst bin/%.o,src/%.cpp,$(goals)) +$(goals): $(targets) + $(foreach goal,$(goals),$( \ + $(CC) $(patsubst bin/%.o, src/%.cpp, $(goal)) \ + echo $(goal) \ + )) + +build: $(goals) ; + #$(CC) $(goals) -o ./bin/simulator $(LINK) + $(goals) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200513130933 b/.history/Makefile_20200513130933 new file mode 100644 index 0000000..975169e --- /dev/null +++ b/.history/Makefile_20200513130933 @@ -0,0 +1,41 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +#bin/main.o: src/main.cpp +# $(pro) +#bin/Cube.o: src/Cube.cpp +# $(pro) +#bin/Color.o: src/Color.cpp +# $(pro) +#bin/Quad.o: src/Quad.cpp +# $(pro) +#bin/Vertex.o: src/Vertex.cpp +# $(pro) +targets = $(patsubst bin/%.o,src/%.cpp,$(goals)) +$(goals): $(targets) + $(foreach goal,$(goals),$( \ + $(CC) $(patsubst bin/%.o, src/%.cpp, $(goal)) \ + echo $(goal) \ + )) + +build: $(goals) ; + #$(CC) $(goals) -o ./bin/simulator $(LINK) + echo $(goals) + $(goals) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200513131004 b/.history/Makefile_20200513131004 new file mode 100644 index 0000000..d668d20 --- /dev/null +++ b/.history/Makefile_20200513131004 @@ -0,0 +1,42 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +#bin/main.o: src/main.cpp +# $(pro) +#bin/Cube.o: src/Cube.cpp +# $(pro) +#bin/Color.o: src/Color.cpp +# $(pro) +#bin/Quad.o: src/Quad.cpp +# $(pro) +#bin/Vertex.o: src/Vertex.cpp +# $(pro) +targets = $(patsubst bin/%.o,src/%.cpp,$(goals)) +$(goals): $(targets) + $(foreach goal,$(goals),$( \ + $(CC) $(patsubst bin/%.o, src/%.cpp, $(goal)) \ + echo $(goal) \ + )) + +build: $(goals) ; + #$(CC) $(goals) -o ./bin/simulator $(LINK) + echo $(goals) + $(goals) + echo $(patsubst bin/%.o,src/%.cpp,$(goals)) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200513131017 b/.history/Makefile_20200513131017 new file mode 100644 index 0000000..a81b791 --- /dev/null +++ b/.history/Makefile_20200513131017 @@ -0,0 +1,42 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +#bin/main.o: src/main.cpp +# $(pro) +#bin/Cube.o: src/Cube.cpp +# $(pro) +#bin/Color.o: src/Color.cpp +# $(pro) +#bin/Quad.o: src/Quad.cpp +# $(pro) +#bin/Vertex.o: src/Vertex.cpp +# $(pro) +targets = $(patsubst bin/%.o,src/%.cpp,$(goals)) +$(goals): $(targets) + $(foreach goal,$(goals),$( \ + $(CC) $(patsubst bin/%.o, src/%.cpp, $(goal)) \ + echo $(goal) \ + )) + +build: $(goals) ; + #$(CC) $(goals) -o ./bin/simulator $(LINK) + echo $(goals) + echo $(patsubst bin/%.o,src/%.cpp,$(goals)) + $(goals) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200513131041 b/.history/Makefile_20200513131041 new file mode 100644 index 0000000..7ce87e3 --- /dev/null +++ b/.history/Makefile_20200513131041 @@ -0,0 +1,40 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +#bin/main.o: src/main.cpp +# $(pro) +#bin/Cube.o: src/Cube.cpp +# $(pro) +#bin/Color.o: src/Color.cpp +# $(pro) +#bin/Quad.o: src/Quad.cpp +# $(pro) +#bin/Vertex.o: src/Vertex.cpp +# $(pro) +targets = $(patsubst bin/%.o,src/%.cpp,$(goals)) +$(goals): $(targets) + $(foreach goal,$(goals),$( \ + $(CC) $(patsubst bin/%.o, src/%.cpp, $(goal)) \ + echo $(goal) \ + )) + +build: $(goals) ; + #$(CC) $(goals) -o ./bin/simulator $(LINK) + $(goals) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200513131048 b/.history/Makefile_20200513131048 new file mode 100644 index 0000000..3dec8a8 --- /dev/null +++ b/.history/Makefile_20200513131048 @@ -0,0 +1,40 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +#bin/main.o: src/main.cpp +# $(pro) +#bin/Cube.o: src/Cube.cpp +# $(pro) +#bin/Color.o: src/Color.cpp +# $(pro) +#bin/Quad.o: src/Quad.cpp +# $(pro) +#bin/Vertex.o: src/Vertex.cpp +# $(pro) +targets = $(patsubst bin/%.o,src/%.cpp,$(goals)) +$(goals): $(targets) ; + $(foreach goal,$(goals),$( \ + $(CC) $(patsubst bin/%.o, src/%.cpp, $(goal)) \ + echo $(goal) \ + )) + +build: $(goals) ; + #$(CC) $(goals) -o ./bin/simulator $(LINK) + $(goals) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200513131123 b/.history/Makefile_20200513131123 new file mode 100644 index 0000000..a01e1c1 --- /dev/null +++ b/.history/Makefile_20200513131123 @@ -0,0 +1,40 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +bin/main.o: src/main.cpp +# $(pro) +#bin/Cube.o: src/Cube.cpp +# $(pro) +#bin/Color.o: src/Color.cpp +# $(pro) +#bin/Quad.o: src/Quad.cpp +# $(pro) +#bin/Vertex.o: src/Vertex.cpp +# $(pro) +targets = $(patsubst bin/%.o,src/%.cpp,$(goals)) +$(goals): $(targets) ; + $(foreach goal,$(goals),$( \ + $(CC) $(patsubst bin/%.o, src/%.cpp, $(goal)) \ + echo $(goal) \ + )) + +build: $(goals) ; + #$(CC) $(goals) -o ./bin/simulator $(LINK) + $(goals) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200513131132 b/.history/Makefile_20200513131132 new file mode 100644 index 0000000..d31c481 --- /dev/null +++ b/.history/Makefile_20200513131132 @@ -0,0 +1,40 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +bin/main.o: src/main.cpp + $(pro) +#bin/Cube.o: src/Cube.cpp +# $(pro) +#bin/Color.o: src/Color.cpp +# $(pro) +#bin/Quad.o: src/Quad.cpp +# $(pro) +#bin/Vertex.o: src/Vertex.cpp +# $(pro) +targets = $(patsubst bin/%.o,src/%.cpp,$(goals)) +$(goals): $(targets) ; + $(foreach goal,$(goals),$( \ + $(CC) $(patsubst bin/%.o, src/%.cpp, $(goal)) \ + echo $(goal) \ + )) + +build: $(goals) ; + #$(CC) $(goals) -o ./bin/simulator $(LINK) + $(goals) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200513131146 b/.history/Makefile_20200513131146 new file mode 100644 index 0000000..3dec8a8 --- /dev/null +++ b/.history/Makefile_20200513131146 @@ -0,0 +1,40 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +#bin/main.o: src/main.cpp +# $(pro) +#bin/Cube.o: src/Cube.cpp +# $(pro) +#bin/Color.o: src/Color.cpp +# $(pro) +#bin/Quad.o: src/Quad.cpp +# $(pro) +#bin/Vertex.o: src/Vertex.cpp +# $(pro) +targets = $(patsubst bin/%.o,src/%.cpp,$(goals)) +$(goals): $(targets) ; + $(foreach goal,$(goals),$( \ + $(CC) $(patsubst bin/%.o, src/%.cpp, $(goal)) \ + echo $(goal) \ + )) + +build: $(goals) ; + #$(CC) $(goals) -o ./bin/simulator $(LINK) + $(goals) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200513131336 b/.history/Makefile_20200513131336 new file mode 100644 index 0000000..41bcb85 --- /dev/null +++ b/.history/Makefile_20200513131336 @@ -0,0 +1,40 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +#bin/main.o: src/main.cpp +# $(pro) +#bin/Cube.o: src/Cube.cpp +# $(pro) +#bin/Color.o: src/Color.cpp +# $(pro) +#bin/Quad.o: src/Quad.cpp +# $(pro) +#bin/Vertex.o: src/Vertex.cpp +# $(pro) +targets = $(patsubst bin/%.o,src/%.cpp,$(goals)) +$(goals): $(targets) ; + $(foreach goal,$(goals),$( \ + $(CC) $(patsubst bin/%.o, src/%.cpp, $(goal)) \ + echo $(goal) \ + )) + +build: $(targets) ; + #$(CC) $(goals) -o ./bin/simulator $(LINK) + $(goals) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200513131344 b/.history/Makefile_20200513131344 new file mode 100644 index 0000000..41bcb85 --- /dev/null +++ b/.history/Makefile_20200513131344 @@ -0,0 +1,40 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +#bin/main.o: src/main.cpp +# $(pro) +#bin/Cube.o: src/Cube.cpp +# $(pro) +#bin/Color.o: src/Color.cpp +# $(pro) +#bin/Quad.o: src/Quad.cpp +# $(pro) +#bin/Vertex.o: src/Vertex.cpp +# $(pro) +targets = $(patsubst bin/%.o,src/%.cpp,$(goals)) +$(goals): $(targets) ; + $(foreach goal,$(goals),$( \ + $(CC) $(patsubst bin/%.o, src/%.cpp, $(goal)) \ + echo $(goal) \ + )) + +build: $(targets) ; + #$(CC) $(goals) -o ./bin/simulator $(LINK) + $(goals) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200513131602 b/.history/Makefile_20200513131602 new file mode 100644 index 0000000..2d30709 --- /dev/null +++ b/.history/Makefile_20200513131602 @@ -0,0 +1,42 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +#bin/main.o: src/main.cpp +# $(pro) +#bin/Cube.o: src/Cube.cpp +# $(pro) +#bin/Color.o: src/Color.cpp +# $(pro) +#bin/Quad.o: src/Quad.cpp +# $(pro) +#bin/Vertex.o: src/Vertex.cpp +# $(pro) +targets = $(patsubst bin/%.o,src/%.cpp,$(goals)) +$(goals): $(targets) ; + $(foreach goal,$(goals),$( \ + $(CC) $(patsubst bin/%.o, src/%.cpp, $(goal)) \ + echo $(goal) \ + )) + +build: $(targets) ; + #$(CC) $(goals) -o ./bin/simulator $(LINK) + $(foreach goal,$(goals),$( \ + $(goal)\ + )) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200513131621 b/.history/Makefile_20200513131621 new file mode 100644 index 0000000..2d30709 --- /dev/null +++ b/.history/Makefile_20200513131621 @@ -0,0 +1,42 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +#bin/main.o: src/main.cpp +# $(pro) +#bin/Cube.o: src/Cube.cpp +# $(pro) +#bin/Color.o: src/Color.cpp +# $(pro) +#bin/Quad.o: src/Quad.cpp +# $(pro) +#bin/Vertex.o: src/Vertex.cpp +# $(pro) +targets = $(patsubst bin/%.o,src/%.cpp,$(goals)) +$(goals): $(targets) ; + $(foreach goal,$(goals),$( \ + $(CC) $(patsubst bin/%.o, src/%.cpp, $(goal)) \ + echo $(goal) \ + )) + +build: $(targets) ; + #$(CC) $(goals) -o ./bin/simulator $(LINK) + $(foreach goal,$(goals),$( \ + $(goal)\ + )) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200513131845 b/.history/Makefile_20200513131845 new file mode 100644 index 0000000..feb5f7d --- /dev/null +++ b/.history/Makefile_20200513131845 @@ -0,0 +1,42 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) -c + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +#bin/main.o: src/main.cpp +# $(pro) +#bin/Cube.o: src/Cube.cpp +# $(pro) +#bin/Color.o: src/Color.cpp +# $(pro) +#bin/Quad.o: src/Quad.cpp +# $(pro) +#bin/Vertex.o: src/Vertex.cpp +# $(pro) +targets = $(patsubst bin/%.o,src/%.cpp,$(goals)) +$(goals): $(targets) ; + $(foreach goal,$(goals),$( \ + $(CC) $(patsubst bin/%.o, src/%.cpp, $(goal)) \ + echo $(goal) \ + )) + +build: $(targets) ; + #$(CC) $(goals) -o ./bin/simulator $(LINK) + $(foreach goal,$(goals),$( \ + $(goal)\ + )) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200513131940 b/.history/Makefile_20200513131940 new file mode 100644 index 0000000..8c5a4a8 --- /dev/null +++ b/.history/Makefile_20200513131940 @@ -0,0 +1,42 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) -c + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +#bin/main.o: src/main.cpp +# $(pro) +#bin/Cube.o: src/Cube.cpp +# $(pro) +#bin/Color.o: src/Color.cpp +# $(pro) +#bin/Quad.o: src/Quad.cpp +# $(pro) +#bin/Vertex.o: src/Vertex.cpp +# $(pro) +targets = $(patsubst bin/%.o,src/%.cpp,$(goals)) +$(goals): $(targets) ; + $(foreach goal,$(goals),$( \ + $(CC) $(patsubst bin/%.o, src/%.cpp, $(goal)) \ + echo $(goal) \ + )) + +build: $(targets) ; + $(foreach goal,$(goals),$( \ + $(goal)\ + )) + $(CC) $(goals) -o ./bin/simulator $(LINK) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200513132006 b/.history/Makefile_20200513132006 new file mode 100644 index 0000000..e027fa5 --- /dev/null +++ b/.history/Makefile_20200513132006 @@ -0,0 +1,42 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) -c + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +#bin/main.o: src/main.cpp +# $(pro) +#bin/Cube.o: src/Cube.cpp +# $(pro) +#bin/Color.o: src/Color.cpp +# $(pro) +#bin/Quad.o: src/Quad.cpp +# $(pro) +#bin/Vertex.o: src/Vertex.cpp +# $(pro) +targets = $(patsubst bin/%.o,src/%.cpp,$(goals)) +$(goals): $(targets) ; + $($(foreach goal,$(goals),$( \ + $(CC) $(patsubst bin/%.o, src/%.cpp, $(goal)) \ + echo $(goal) \ + ))) + +build: $(targets) ; + $(foreach goal,$(goals),$( \ + $(goal)\ + )) + $(CC) $(goals) -o ./bin/simulator $(LINK) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200513132016 b/.history/Makefile_20200513132016 new file mode 100644 index 0000000..8c5a4a8 --- /dev/null +++ b/.history/Makefile_20200513132016 @@ -0,0 +1,42 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) -c + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +#bin/main.o: src/main.cpp +# $(pro) +#bin/Cube.o: src/Cube.cpp +# $(pro) +#bin/Color.o: src/Color.cpp +# $(pro) +#bin/Quad.o: src/Quad.cpp +# $(pro) +#bin/Vertex.o: src/Vertex.cpp +# $(pro) +targets = $(patsubst bin/%.o,src/%.cpp,$(goals)) +$(goals): $(targets) ; + $(foreach goal,$(goals),$( \ + $(CC) $(patsubst bin/%.o, src/%.cpp, $(goal)) \ + echo $(goal) \ + )) + +build: $(targets) ; + $(foreach goal,$(goals),$( \ + $(goal)\ + )) + $(CC) $(goals) -o ./bin/simulator $(LINK) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200513132905 b/.history/Makefile_20200513132905 new file mode 100644 index 0000000..af04727 --- /dev/null +++ b/.history/Makefile_20200513132905 @@ -0,0 +1,39 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) -c + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +#bin/main.o: src/main.cpp +# $(pro) +#bin/Cube.o: src/Cube.cpp +# $(pro) +#bin/Color.o: src/Color.cpp +# $(pro) +#bin/Quad.o: src/Quad.cpp +# $(pro) +#bin/Vertex.o: src/Vertex.cpp +# $(pro) +targets = $(patsubst bin/%.o,src/%.cpp,$(goals)) +$(goals): $(targets) ; + $(foreach goal,$(goals),$( \ + $(CC) $(patsubst bin/%.o, src/%.cpp, $(goal)) \ + echo $(goal) \ + )) + +build: $(targets) ; + $(CC) $(goals) -o ./bin/simulator $(LINK) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200513132931 b/.history/Makefile_20200513132931 new file mode 100644 index 0000000..8e45d3b --- /dev/null +++ b/.history/Makefile_20200513132931 @@ -0,0 +1,40 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) -c + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +#bin/main.o: src/main.cpp +# $(pro) +#bin/Cube.o: src/Cube.cpp +# $(pro) +#bin/Color.o: src/Color.cpp +# $(pro) +#bin/Quad.o: src/Quad.cpp +# $(pro) +#bin/Vertex.o: src/Vertex.cpp +# $(pro) +targets = $(patsubst bin/%.o,src/%.cpp,$(goals)) +$(goals): $(targets) ; + $(foreach goal,$(goals),$( \ + $(CC) $(patsubst bin/%.o, src/%.cpp, $(goal)) \ + echo $(goal) \ + )) + +build: $(targets) ; + $(GOALS) + #$(CC) $(goals) -o ./bin/simulator $(LINK) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200513132942 b/.history/Makefile_20200513132942 new file mode 100644 index 0000000..9a01692 --- /dev/null +++ b/.history/Makefile_20200513132942 @@ -0,0 +1,40 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) -c + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +#bin/main.o: src/main.cpp +# $(pro) +#bin/Cube.o: src/Cube.cpp +# $(pro) +#bin/Color.o: src/Color.cpp +# $(pro) +#bin/Quad.o: src/Quad.cpp +# $(pro) +#bin/Vertex.o: src/Vertex.cpp +# $(pro) +targets = $(patsubst bin/%.o,src/%.cpp,$(goals)) +$(goals): $(targets) ; + $(foreach goal,$(goals),$( \ + $(CC) $(patsubst bin/%.o, src/%.cpp, $(goal)) \ + echo $(goal) \ + )) + +build: $(targets) ; + $(goals) + #$(CC) $(goals) -o ./bin/simulator $(LINK) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200513134126 b/.history/Makefile_20200513134126 new file mode 100644 index 0000000..d373bdd --- /dev/null +++ b/.history/Makefile_20200513134126 @@ -0,0 +1,40 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) -c + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +#bin/main.o: src/main.cpp +# $(pro) +#bin/Cube.o: src/Cube.cpp +# $(pro) +#bin/Color.o: src/Color.cpp +# $(pro) +#bin/Quad.o: src/Quad.cpp +# $(pro) +#bin/Vertex.o: src/Vertex.cpp +# $(pro) +targets = $(patsubst bin/%.o,src/%.cpp,$(goals)) +$(goals): $(targets) ; + $(foreach goal,$(goals),$( \ + $(CC) $(patsubst bin/%.o, src/%.cpp, $(goal)) \ + echo $(goal) \ + )) + +build: $(targets) ; + + #$(CC) $(goals) -o ./bin/simulator $(LINK) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/.history/Makefile_20200513134548 b/.history/Makefile_20200513134548 new file mode 100644 index 0000000..349fd69 --- /dev/null +++ b/.history/Makefile_20200513134548 @@ -0,0 +1 @@ +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o diff --git a/.history/Makefile_20200513135257 b/.history/Makefile_20200513135257 new file mode 100644 index 0000000..aeb088a --- /dev/null +++ b/.history/Makefile_20200513135257 @@ -0,0 +1,4 @@ +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o +targets = $(patsubst bin/%.o, src/%.cpp, $(goals)) + +$(goals): $(targets) ; diff --git a/.history/generatecube_20200511164401.lua b/.history/generatecube_20200511164401.lua new file mode 100644 index 0000000..e69de29 diff --git a/.history/generatecube_20200511171029.lua b/.history/generatecube_20200511171029.lua new file mode 100644 index 0000000..cd2fe53 --- /dev/null +++ b/.history/generatecube_20200511171029.lua @@ -0,0 +1,2 @@ +local file = io.open("vertexes.txt", "w+") + diff --git a/.history/src/Color_20200511171542.h b/.history/src/Color_20200511171542.h new file mode 100644 index 0000000..fce2787 --- /dev/null +++ b/.history/src/Color_20200511171542.h @@ -0,0 +1,10 @@ +class Color { + public: + float r,g,b,a; + Color(float r,float g,float b,float a) { + this->r=r; + this->g=g; + this->b=b; + this->a=a; + } +}; \ No newline at end of file diff --git a/.history/src/Color_20200511175158.h b/.history/src/Color_20200511175158.h new file mode 100644 index 0000000..fce2787 --- /dev/null +++ b/.history/src/Color_20200511175158.h @@ -0,0 +1,10 @@ +class Color { + public: + float r,g,b,a; + Color(float r,float g,float b,float a) { + this->r=r; + this->g=g; + this->b=b; + this->a=a; + } +}; \ No newline at end of file diff --git a/.history/src/Color_20200511175840.h b/.history/src/Color_20200511175840.h new file mode 100644 index 0000000..ae208a4 --- /dev/null +++ b/.history/src/Color_20200511175840.h @@ -0,0 +1,16 @@ +class Color { + public: + float r,g,b,a; + Color() { + this->r=1.0f + this->g=1.0f; + this->b=1.0f; + this->a=1.0f; + } + Color(float r,float g,float b,float a) { + this->r=r; + this->g=g; + this->b=b; + this->a=a; + } +}; \ No newline at end of file diff --git a/.history/src/Color_20200511175845.h b/.history/src/Color_20200511175845.h new file mode 100644 index 0000000..0bb5fc5 --- /dev/null +++ b/.history/src/Color_20200511175845.h @@ -0,0 +1,16 @@ +class Color { + public: + float r,g,b,a; + Color() { + this->r=1.0f; + this->g=1.0f; + this->b=1.0f; + this->a=1.0f; + } + Color(float r,float g,float b,float a) { + this->r=r; + this->g=g; + this->b=b; + this->a=a; + } +}; \ No newline at end of file diff --git a/.history/src/Color_20200511175902.h b/.history/src/Color_20200511175902.h new file mode 100644 index 0000000..0bb5fc5 --- /dev/null +++ b/.history/src/Color_20200511175902.h @@ -0,0 +1,16 @@ +class Color { + public: + float r,g,b,a; + Color() { + this->r=1.0f; + this->g=1.0f; + this->b=1.0f; + this->a=1.0f; + } + Color(float r,float g,float b,float a) { + this->r=r; + this->g=g; + this->b=b; + this->a=a; + } +}; \ No newline at end of file diff --git a/.history/src/Color_20200511180426.h b/.history/src/Color_20200511180426.h new file mode 100644 index 0000000..e8cd044 --- /dev/null +++ b/.history/src/Color_20200511180426.h @@ -0,0 +1,19 @@ +class Color { + public: + float r,g,b,a; + Color(); + /* + Color() { + this->r=1.0f; + this->g=1.0f; + this->b=1.0f; + this->a=1.0f; + } + */ + Color(float r,float g,float b,float a) { + this->r=r; + this->g=g; + this->b=b; + this->a=a; + } +}; \ No newline at end of file diff --git a/.history/src/Color_20200511180509.h b/.history/src/Color_20200511180509.h new file mode 100644 index 0000000..e8788ff --- /dev/null +++ b/.history/src/Color_20200511180509.h @@ -0,0 +1,11 @@ +class Color { + public: + float r,g,b,a; + Color(); + Color(float r,float g,float b,float a) { + this->r=r; + this->g=g; + this->b=b; + this->a=a; + } +}; \ No newline at end of file diff --git a/.history/src/Color_20200511184059.h b/.history/src/Color_20200511184059.h new file mode 100644 index 0000000..e8788ff --- /dev/null +++ b/.history/src/Color_20200511184059.h @@ -0,0 +1,11 @@ +class Color { + public: + float r,g,b,a; + Color(); + Color(float r,float g,float b,float a) { + this->r=r; + this->g=g; + this->b=b; + this->a=a; + } +}; \ No newline at end of file diff --git a/.history/src/Color_20200511184834.h b/.history/src/Color_20200511184834.h new file mode 100644 index 0000000..3a4f456 --- /dev/null +++ b/.history/src/Color_20200511184834.h @@ -0,0 +1,11 @@ +class Color { + public: + float r,g,b,a; + Color(); + Color(float r,float g,float b,float a) { + this->r=r; + this->g=g; + this->b=b; + this->a=a; + } +}; \ No newline at end of file diff --git a/.history/src/Color_20200511184840.h b/.history/src/Color_20200511184840.h new file mode 100644 index 0000000..3a4f456 --- /dev/null +++ b/.history/src/Color_20200511184840.h @@ -0,0 +1,11 @@ +class Color { + public: + float r,g,b,a; + Color(); + Color(float r,float g,float b,float a) { + this->r=r; + this->g=g; + this->b=b; + this->a=a; + } +}; \ No newline at end of file diff --git a/.history/src/Color_20200511185132.h b/.history/src/Color_20200511185132.h new file mode 100644 index 0000000..e8788ff --- /dev/null +++ b/.history/src/Color_20200511185132.h @@ -0,0 +1,11 @@ +class Color { + public: + float r,g,b,a; + Color(); + Color(float r,float g,float b,float a) { + this->r=r; + this->g=g; + this->b=b; + this->a=a; + } +}; \ No newline at end of file diff --git a/.history/src/Color_20200511195616.h b/.history/src/Color_20200511195616.h new file mode 100644 index 0000000..7b9007c --- /dev/null +++ b/.history/src/Color_20200511195616.h @@ -0,0 +1,16 @@ +#define RED_f4 1.0f,0.0f,0.0f,1.0f +#define GREEN_f4 0.0f,1.0f,0.0f,1.0f +#define BLUE_f4 0.0f,0.0f,1.0f,1.0f +#define PURPLE_f4 1.0f,0.0f,1.0f,1.0f + +class Color { + public: + float r,g,b,a; + Color(); + Color(float r,float g,float b,float a) { + this->r=r; + this->g=g; + this->b=b; + this->a=a; + } +}; \ No newline at end of file diff --git a/.history/src/Color_20200511214107.cpp b/.history/src/Color_20200511214107.cpp new file mode 100644 index 0000000..e69de29 diff --git a/.history/src/Color_20200511214344.cpp b/.history/src/Color_20200511214344.cpp new file mode 100644 index 0000000..5728138 --- /dev/null +++ b/.history/src/Color_20200511214344.cpp @@ -0,0 +1 @@ +#include "Color.h" \ No newline at end of file diff --git a/.history/src/Color_20200511214346.cpp b/.history/src/Color_20200511214346.cpp new file mode 100644 index 0000000..b511054 --- /dev/null +++ b/.history/src/Color_20200511214346.cpp @@ -0,0 +1,8 @@ +#include "Color.h" + +Color(float r,float g,float b,float a) { + this->r=r; + this->g=g; + this->b=b; + this->a=a; + } \ No newline at end of file diff --git a/.history/src/Color_20200511214352.cpp b/.history/src/Color_20200511214352.cpp new file mode 100644 index 0000000..cc8d188 --- /dev/null +++ b/.history/src/Color_20200511214352.cpp @@ -0,0 +1,8 @@ +#include "Color.h" + +Color::Color(float r,float g,float b,float a) { + this->r=r; + this->g=g; + this->b=b; + this->a=a; + } \ No newline at end of file diff --git a/.history/src/Color_20200511214540.h b/.history/src/Color_20200511214540.h new file mode 100644 index 0000000..984cdbf --- /dev/null +++ b/.history/src/Color_20200511214540.h @@ -0,0 +1,10 @@ +#define RED_f4 1.0f,0.0f,0.0f,1.0f +#define GREEN_f4 0.0f,1.0f,0.0f,1.0f +#define BLUE_f4 0.0f,0.0f,1.0f,1.0f +#define PURPLE_f4 1.0f,0.0f,1.0f,1.0f + +class Color { + public: + float r,g,b,a; + Color(); +}; \ No newline at end of file diff --git a/.history/src/Color_20200511214543.cpp b/.history/src/Color_20200511214543.cpp new file mode 100644 index 0000000..cc8d188 --- /dev/null +++ b/.history/src/Color_20200511214543.cpp @@ -0,0 +1,8 @@ +#include "Color.h" + +Color::Color(float r,float g,float b,float a) { + this->r=r; + this->g=g; + this->b=b; + this->a=a; + } \ No newline at end of file diff --git a/.history/src/Color_20200511214549.cpp b/.history/src/Color_20200511214549.cpp new file mode 100644 index 0000000..5728138 --- /dev/null +++ b/.history/src/Color_20200511214549.cpp @@ -0,0 +1 @@ +#include "Color.h" \ No newline at end of file diff --git a/.history/src/Color_20200511214553.h b/.history/src/Color_20200511214553.h new file mode 100644 index 0000000..8003fe5 --- /dev/null +++ b/.history/src/Color_20200511214553.h @@ -0,0 +1,16 @@ +#define RED_f4 1.0f,0.0f,0.0f,1.0f +#define GREEN_f4 0.0f,1.0f,0.0f,1.0f +#define BLUE_f4 0.0f,0.0f,1.0f,1.0f +#define PURPLE_f4 1.0f,0.0f,1.0f,1.0f + +class Color { + public: + float r,g,b,a; + Color(); + Color::Color(float r,float g,float b,float a) { + this->r=r; + this->g=g; + this->b=b; + this->a=a; + } +}; \ No newline at end of file diff --git a/.history/src/Color_20200511214556.h b/.history/src/Color_20200511214556.h new file mode 100644 index 0000000..8003fe5 --- /dev/null +++ b/.history/src/Color_20200511214556.h @@ -0,0 +1,16 @@ +#define RED_f4 1.0f,0.0f,0.0f,1.0f +#define GREEN_f4 0.0f,1.0f,0.0f,1.0f +#define BLUE_f4 0.0f,0.0f,1.0f,1.0f +#define PURPLE_f4 1.0f,0.0f,1.0f,1.0f + +class Color { + public: + float r,g,b,a; + Color(); + Color::Color(float r,float g,float b,float a) { + this->r=r; + this->g=g; + this->b=b; + this->a=a; + } +}; \ No newline at end of file diff --git a/.history/src/Color_20200511214607.h b/.history/src/Color_20200511214607.h new file mode 100644 index 0000000..7b9007c --- /dev/null +++ b/.history/src/Color_20200511214607.h @@ -0,0 +1,16 @@ +#define RED_f4 1.0f,0.0f,0.0f,1.0f +#define GREEN_f4 0.0f,1.0f,0.0f,1.0f +#define BLUE_f4 0.0f,0.0f,1.0f,1.0f +#define PURPLE_f4 1.0f,0.0f,1.0f,1.0f + +class Color { + public: + float r,g,b,a; + Color(); + Color(float r,float g,float b,float a) { + this->r=r; + this->g=g; + this->b=b; + this->a=a; + } +}; \ No newline at end of file diff --git a/.history/src/Color_20200511214903.h b/.history/src/Color_20200511214903.h new file mode 100644 index 0000000..0e6ca6d --- /dev/null +++ b/.history/src/Color_20200511214903.h @@ -0,0 +1,11 @@ +#define RED_f4 1.0f,0.0f,0.0f,1.0f +#define GREEN_f4 0.0f,1.0f,0.0f,1.0f +#define BLUE_f4 0.0f,0.0f,1.0f,1.0f +#define PURPLE_f4 1.0f,0.0f,1.0f,1.0f + +class Color { + public: + float r,g,b,a; + Color(); + Color(float r,float g,float b,float a); +}; \ No newline at end of file diff --git a/.history/src/Color_20200511214929.cpp b/.history/src/Color_20200511214929.cpp new file mode 100644 index 0000000..f8df347 --- /dev/null +++ b/.history/src/Color_20200511214929.cpp @@ -0,0 +1,8 @@ +#include "Color.h" + + Color::Color(float r,float g,float b,float a){ + this->r=r; + this->g=g; + this->b=b; + this->a=a; + } \ No newline at end of file diff --git a/.history/src/Color_20200511215000.cpp b/.history/src/Color_20200511215000.cpp new file mode 100644 index 0000000..9ec2c59 --- /dev/null +++ b/.history/src/Color_20200511215000.cpp @@ -0,0 +1,8 @@ +#include "Color.h" + +Color::Color(float r,float g,float b,float a){ + this->r=r; + this->g=g; + this->b=b; + this->a=a; +} diff --git a/.history/src/Color_20200511215006.cpp b/.history/src/Color_20200511215006.cpp new file mode 100644 index 0000000..fc9c45b --- /dev/null +++ b/.history/src/Color_20200511215006.cpp @@ -0,0 +1,8 @@ +#include "Color.h" + +Color::Color(float r,float g,float b,float a) { + this->r=r; + this->g=g; + this->b=b; + this->a=a; +} diff --git a/.history/src/Color_20200511215017.cpp b/.history/src/Color_20200511215017.cpp new file mode 100644 index 0000000..0dcd545 --- /dev/null +++ b/.history/src/Color_20200511215017.cpp @@ -0,0 +1,9 @@ +#include "Color.h" + +Color::Color(float r,float g,float b,float a) { + this->r=r; + this->g=g; + this->b=b; + this->a=a; +} +Color::Color(); \ No newline at end of file diff --git a/.history/src/Color_20200511215019.cpp b/.history/src/Color_20200511215019.cpp new file mode 100644 index 0000000..ecc8c21 --- /dev/null +++ b/.history/src/Color_20200511215019.cpp @@ -0,0 +1,9 @@ +#include "Color.h" + +Color::Color(float r,float g,float b,float a) { + this->r=r; + this->g=g; + this->b=b; + this->a=a; +} +Color::Color() {}; \ No newline at end of file diff --git a/.history/src/Color_20200511215026.cpp b/.history/src/Color_20200511215026.cpp new file mode 100644 index 0000000..cb4a345 --- /dev/null +++ b/.history/src/Color_20200511215026.cpp @@ -0,0 +1,9 @@ +#include "Color.h" + +Color::Color(float r,float g,float b,float a) { + this->r=r; + this->g=g; + this->b=b; + this->a=a; +} +Color::Color() {} \ No newline at end of file diff --git a/.history/src/Color_20200511215048.cpp b/.history/src/Color_20200511215048.cpp new file mode 100644 index 0000000..cb4a345 --- /dev/null +++ b/.history/src/Color_20200511215048.cpp @@ -0,0 +1,9 @@ +#include "Color.h" + +Color::Color(float r,float g,float b,float a) { + this->r=r; + this->g=g; + this->b=b; + this->a=a; +} +Color::Color() {} \ No newline at end of file diff --git a/.history/src/Color_20200512000019.h b/.history/src/Color_20200512000019.h new file mode 100644 index 0000000..0e6ca6d --- /dev/null +++ b/.history/src/Color_20200512000019.h @@ -0,0 +1,11 @@ +#define RED_f4 1.0f,0.0f,0.0f,1.0f +#define GREEN_f4 0.0f,1.0f,0.0f,1.0f +#define BLUE_f4 0.0f,0.0f,1.0f,1.0f +#define PURPLE_f4 1.0f,0.0f,1.0f,1.0f + +class Color { + public: + float r,g,b,a; + Color(); + Color(float r,float g,float b,float a); +}; \ No newline at end of file diff --git a/.history/src/Color_20200512000031.h b/.history/src/Color_20200512000031.h new file mode 100644 index 0000000..e00c46b --- /dev/null +++ b/.history/src/Color_20200512000031.h @@ -0,0 +1,11 @@ +#define RED_f4 1.0f,0.0f,0.0f,1.0f +#define GREEN_f4 0.0f,1.0f,0.0f,1.0f +#define BLUE_f4 0.0f,0.0f,1.0f,1.0f +#define PURPLE_f4 1.0f,0.0f,1.0f,1.0f + +class myColor { + public: + float r,g,b,a; + myColor(); + myColor(float r,float g,float b,float a); +}; \ No newline at end of file diff --git a/.history/src/Color_20200512000048.cpp b/.history/src/Color_20200512000048.cpp new file mode 100644 index 0000000..b4b3a3c --- /dev/null +++ b/.history/src/Color_20200512000048.cpp @@ -0,0 +1,9 @@ +#include "Color.h" + +myColor::myColor(float r,float g,float b,float a) { + this->r=r; + this->g=g; + this->b=b; + this->a=a; +} +myColor::myColor() {} \ No newline at end of file diff --git a/.history/src/Color_20200512011729.h b/.history/src/Color_20200512011729.h new file mode 100644 index 0000000..3c755da --- /dev/null +++ b/.history/src/Color_20200512011729.h @@ -0,0 +1,13 @@ +#define RED_f4 1.0f,0.0f,0.0f,1.0f +#define GREEN_f4 0.0f,1.0f,0.0f,1.0f +#define BLUE_f4 0.0f,0.0f,1.0f,1.0f +#define PURPLE_f4 1.0f,0.0f,1.0f,1.0f +#define WHITE_f4 1.0f,1.0f,1.0f,1.0f +#define BLACK_f4 0.0f,0.0f,0.0f,1.0f; + +class myColor { + public: + float r,g,b,a; + myColor(); + myColor(float r,float g,float b,float a); +}; \ No newline at end of file diff --git a/.history/src/Color_20200512011730.h b/.history/src/Color_20200512011730.h new file mode 100644 index 0000000..481db58 --- /dev/null +++ b/.history/src/Color_20200512011730.h @@ -0,0 +1,13 @@ +#define RED_f4 1.0f,0.0f,0.0f,1.0f +#define GREEN_f4 0.0f,1.0f,0.0f,1.0f +#define BLUE_f4 0.0f,0.0f,1.0f,1.0f +#define PURPLE_f4 1.0f,0.0f,1.0f,1.0f +#define WHITE_f4 1.0f,1.0f,1.0f,1.0f +#define BLACK_f4 0.0f,0.0f,0.0f,1.0f + +class myColor { + public: + float r,g,b,a; + myColor(); + myColor(float r,float g,float b,float a); +}; \ No newline at end of file diff --git a/.history/src/Cube_20200511182530.h b/.history/src/Cube_20200511182530.h new file mode 100644 index 0000000..e69de29 diff --git a/.history/src/Cube_20200511182542.h b/.history/src/Cube_20200511182542.h new file mode 100644 index 0000000..377b8ae --- /dev/null +++ b/.history/src/Cube_20200511182542.h @@ -0,0 +1 @@ +#include \ No newline at end of file diff --git a/.history/src/Cube_20200511183329.h b/.history/src/Cube_20200511183329.h new file mode 100644 index 0000000..3a26f7e --- /dev/null +++ b/.history/src/Cube_20200511183329.h @@ -0,0 +1,6 @@ +#include + +class Cube { + public: + Quad left,top,right,bottom,back,front; +}; \ No newline at end of file diff --git a/.history/src/Cube_20200511183343.h b/.history/src/Cube_20200511183343.h new file mode 100644 index 0000000..5271b97 --- /dev/null +++ b/.history/src/Cube_20200511183343.h @@ -0,0 +1,8 @@ +#include +#include + +class Cube { + public: + Quad left,top,right,bottom,back,front; + Vertex +}; \ No newline at end of file diff --git a/.history/src/Cube_20200511183548.h b/.history/src/Cube_20200511183548.h new file mode 100644 index 0000000..2230b28 --- /dev/null +++ b/.history/src/Cube_20200511183548.h @@ -0,0 +1,8 @@ +#include +#include + +class Cube { + public: + Quad left,top,right,bottom,back,front; + Vertex btl,btr,bbr,bbl,ftl,ftr,fbr,fbl; +}; \ No newline at end of file diff --git a/.history/src/Cube_20200511184002.h b/.history/src/Cube_20200511184002.h new file mode 100644 index 0000000..5a1774b --- /dev/null +++ b/.history/src/Cube_20200511184002.h @@ -0,0 +1,26 @@ +#include +#include + +class Cube { + public: + Quad left,top,right,bottom,back,front; + Vertex btl,btr,bbr,bbl,ftl,ftr,fbr,fbl; + + Cube(Vertex backTopLeft, + Vertex backTopRight, + Vertex backBottomRight, + Vertex backBottomLeft, + Vertex frontTopLeft, + Vertex frontTopRight, + Vertex frontBottomRight, + Vertex frontBottomLeft) { + this->btl=backTopLeft; + this->btr=backTopRight; + this->bbr=backBottomRight; + this->bbl=backBottomLeft; + this->ftl=frontTopRight; + this->ftl=frontTopRight; + this->fbl=frontBottomLeft; + this->fbr=frontBottomRight; + } +}; \ No newline at end of file diff --git a/.history/src/Cube_20200511184009.h b/.history/src/Cube_20200511184009.h new file mode 100644 index 0000000..5a1774b --- /dev/null +++ b/.history/src/Cube_20200511184009.h @@ -0,0 +1,26 @@ +#include +#include + +class Cube { + public: + Quad left,top,right,bottom,back,front; + Vertex btl,btr,bbr,bbl,ftl,ftr,fbr,fbl; + + Cube(Vertex backTopLeft, + Vertex backTopRight, + Vertex backBottomRight, + Vertex backBottomLeft, + Vertex frontTopLeft, + Vertex frontTopRight, + Vertex frontBottomRight, + Vertex frontBottomLeft) { + this->btl=backTopLeft; + this->btr=backTopRight; + this->bbr=backBottomRight; + this->bbl=backBottomLeft; + this->ftl=frontTopRight; + this->ftl=frontTopRight; + this->fbl=frontBottomLeft; + this->fbr=frontBottomRight; + } +}; \ No newline at end of file diff --git a/.history/src/Cube_20200511184116.h b/.history/src/Cube_20200511184116.h new file mode 100644 index 0000000..5a1774b --- /dev/null +++ b/.history/src/Cube_20200511184116.h @@ -0,0 +1,26 @@ +#include +#include + +class Cube { + public: + Quad left,top,right,bottom,back,front; + Vertex btl,btr,bbr,bbl,ftl,ftr,fbr,fbl; + + Cube(Vertex backTopLeft, + Vertex backTopRight, + Vertex backBottomRight, + Vertex backBottomLeft, + Vertex frontTopLeft, + Vertex frontTopRight, + Vertex frontBottomRight, + Vertex frontBottomLeft) { + this->btl=backTopLeft; + this->btr=backTopRight; + this->bbr=backBottomRight; + this->bbl=backBottomLeft; + this->ftl=frontTopRight; + this->ftl=frontTopRight; + this->fbl=frontBottomLeft; + this->fbr=frontBottomRight; + } +}; \ No newline at end of file diff --git a/.history/src/Cube_20200511184202.h b/.history/src/Cube_20200511184202.h new file mode 100644 index 0000000..5119227 --- /dev/null +++ b/.history/src/Cube_20200511184202.h @@ -0,0 +1,27 @@ +#include +#include + +class Cube { + public: + Quad left,top,right,bottom,back,front; + Vertex btl,btr,bbr,bbl,ftl,ftr,fbr,fbl; + + Cube(Vertex backTopLeft, + Vertex backTopRight, + Vertex backBottomRight, + Vertex backBottomLeft, + Vertex frontTopLeft, + Vertex frontTopRight, + Vertex frontBottomRight, + Vertex frontBottomLeft + ) { + this->btl=backTopLeft; + this->btr=backTopRight; + this->bbr=backBottomRight; + this->bbl=backBottomLeft; + this->ftl=frontTopRight; + this->ftl=frontTopRight; + this->fbl=frontBottomLeft; + this->fbr=frontBottomRight; + } +}; \ No newline at end of file diff --git a/.history/src/Cube_20200511184203.h b/.history/src/Cube_20200511184203.h new file mode 100644 index 0000000..5119227 --- /dev/null +++ b/.history/src/Cube_20200511184203.h @@ -0,0 +1,27 @@ +#include +#include + +class Cube { + public: + Quad left,top,right,bottom,back,front; + Vertex btl,btr,bbr,bbl,ftl,ftr,fbr,fbl; + + Cube(Vertex backTopLeft, + Vertex backTopRight, + Vertex backBottomRight, + Vertex backBottomLeft, + Vertex frontTopLeft, + Vertex frontTopRight, + Vertex frontBottomRight, + Vertex frontBottomLeft + ) { + this->btl=backTopLeft; + this->btr=backTopRight; + this->bbr=backBottomRight; + this->bbl=backBottomLeft; + this->ftl=frontTopRight; + this->ftl=frontTopRight; + this->fbl=frontBottomLeft; + this->fbr=frontBottomRight; + } +}; \ No newline at end of file diff --git a/.history/src/Cube_20200511184209.h b/.history/src/Cube_20200511184209.h new file mode 100644 index 0000000..34fd9c3 --- /dev/null +++ b/.history/src/Cube_20200511184209.h @@ -0,0 +1,28 @@ +#include +#include + +class Cube { + public: + Quad left,top,right,bottom,back,front; + Vertex btl,btr,bbr,bbl,ftl,ftr,fbr,fbl; + + Cube( + Vertex backTopLeft, + Vertex backTopRight, + Vertex backBottomRight, + Vertex backBottomLeft, + Vertex frontTopLeft, + Vertex frontTopRight, + Vertex frontBottomRight, + Vertex frontBottomLeft + ) { + this->btl=backTopLeft; + this->btr=backTopRight; + this->bbr=backBottomRight; + this->bbl=backBottomLeft; + this->ftl=frontTopRight; + this->ftl=frontTopRight; + this->fbl=frontBottomLeft; + this->fbr=frontBottomRight; + } +}; \ No newline at end of file diff --git a/.history/src/Cube_20200511184212.h b/.history/src/Cube_20200511184212.h new file mode 100644 index 0000000..5119227 --- /dev/null +++ b/.history/src/Cube_20200511184212.h @@ -0,0 +1,27 @@ +#include +#include + +class Cube { + public: + Quad left,top,right,bottom,back,front; + Vertex btl,btr,bbr,bbl,ftl,ftr,fbr,fbl; + + Cube(Vertex backTopLeft, + Vertex backTopRight, + Vertex backBottomRight, + Vertex backBottomLeft, + Vertex frontTopLeft, + Vertex frontTopRight, + Vertex frontBottomRight, + Vertex frontBottomLeft + ) { + this->btl=backTopLeft; + this->btr=backTopRight; + this->bbr=backBottomRight; + this->bbl=backBottomLeft; + this->ftl=frontTopRight; + this->ftl=frontTopRight; + this->fbl=frontBottomLeft; + this->fbr=frontBottomRight; + } +}; \ No newline at end of file diff --git a/.history/src/Cube_20200511184523.h b/.history/src/Cube_20200511184523.h new file mode 100644 index 0000000..989e03d --- /dev/null +++ b/.history/src/Cube_20200511184523.h @@ -0,0 +1,41 @@ +#include +#include + +class Cube { + public: + Quad left,top,right,bottom,back,front; + Vertex btl,btr,bbr,bbl,ftl,ftr,fbr,fbl; + + Cube(Vertex backTopLeft, + Vertex backTopRight, + Vertex backBottomRight, + Vertex backBottomLeft, + Vertex frontTopLeft, + Vertex frontTopRight, + Vertex frontBottomRight, + Vertex frontBottomLeft + ) { + this->btl=backTopLeft; + this->btr=backTopRight; + this->bbr=backBottomRight; + this->bbl=backBottomLeft; + this->ftl=frontTopRight; + this->ftl=frontTopRight; + this->fbl=frontBottomLeft; + this->fbr=frontBottomRight; + } + Cube(Quad left, + Quad top, + Quad right, + Quad bottom, + Quad front, + Quad back + ) { + this->left=left; + this->top=top; + this->right=right; + this->bottom=bottom; + this->front=front; + this->back=back; + } +}; \ No newline at end of file diff --git a/.history/src/Cube_20200511184555.h b/.history/src/Cube_20200511184555.h new file mode 100644 index 0000000..7670012 --- /dev/null +++ b/.history/src/Cube_20200511184555.h @@ -0,0 +1,41 @@ +#include +#include + +class Cube { + public: + Quad left,top,right,bottom,back,front; + Vertex btl,btr,bbr,bbl,ftl,ftr,fbr,fbl; + + Cube(Vertex backTopLeft, + Vertex backTopRight, + Vertex backBottomRight, + Vertex backBottomLeft, + Vertex frontTopLeft, + Vertex frontTopRight, + Vertex frontBottomRight, + Vertex frontBottomLeft + ) { + this->btl=backTopLeft; + this->btr=backTopRight; + this->bbr=backBottomRight; + this->bbl=backBottomLeft; + this->ftl=frontTopRight; + this->ftl=frontTopRight; + this->fbl=frontBottomLeft; + this->fbr=frontBottomRight; + } + Cube(Quad left, + Quad top, + Quad right, + Quad bottom, + Quad front, + Quad back + ) { + this->left=left; + this->top=top; + this->right=right; + this->bottom=bottom; + this->front=front; + this->back=back; + } +}; \ No newline at end of file diff --git a/.history/src/Cube_20200511184633.h b/.history/src/Cube_20200511184633.h new file mode 100644 index 0000000..8da9bd4 --- /dev/null +++ b/.history/src/Cube_20200511184633.h @@ -0,0 +1,45 @@ +#include +#include + +class Cube { + public: + Quad left,top,right,bottom,back,front; + Vertex btl,btr,bbr,bbl,ftl,ftr,fbr,fbl; + + Cube(Vertex backTopLeft, + Vertex backTopRight, + Vertex backBottomRight, + Vertex backBottomLeft, + Vertex frontTopLeft, + Vertex frontTopRight, + Vertex frontBottomRight, + Vertex frontBottomLeft + ) { + this->btl=backTopLeft; + this->btr=backTopRight; + this->bbr=backBottomRight; + this->bbl=backBottomLeft; + this->ftl=frontTopRight; + this->ftl=frontTopRight; + this->fbl=frontBottomLeft; + this->fbr=frontBottomRight; + } + Cube(Quad left, + Quad top, + Quad right, + Quad bottom, + Quad front, + Quad back + ) { + this->left=left; + this->top=top; + this->right=right; + this->bottom=bottom; + this->front=front; + this->back=back; + } +}; + +void Cube::setColor() { + +} \ No newline at end of file diff --git a/.history/src/Cube_20200511184644.h b/.history/src/Cube_20200511184644.h new file mode 100644 index 0000000..52e18d9 --- /dev/null +++ b/.history/src/Cube_20200511184644.h @@ -0,0 +1,46 @@ +#include +#include + +class Cube { + public: + Quad left,top,right,bottom,back,front; + Vertex btl,btr,bbr,bbl,ftl,ftr,fbr,fbl; + + Cube(Vertex backTopLeft, + Vertex backTopRight, + Vertex backBottomRight, + Vertex backBottomLeft, + Vertex frontTopLeft, + Vertex frontTopRight, + Vertex frontBottomRight, + Vertex frontBottomLeft + ) { + this->btl=backTopLeft; + this->btr=backTopRight; + this->bbr=backBottomRight; + this->bbl=backBottomLeft; + this->ftl=frontTopRight; + this->ftl=frontTopRight; + this->fbl=frontBottomLeft; + this->fbr=frontBottomRight; + } + Cube(Quad left, + Quad top, + Quad right, + Quad bottom, + Quad front, + Quad back + ) { + this->left=left; + this->top=top; + this->right=right; + this->bottom=bottom; + this->front=front; + this->back=back; + } + void setColor(); +}; + +void Cube::setColor() { + +} \ No newline at end of file diff --git a/.history/src/Cube_20200511185025.h b/.history/src/Cube_20200511185025.h new file mode 100644 index 0000000..083f08f --- /dev/null +++ b/.history/src/Cube_20200511185025.h @@ -0,0 +1,46 @@ +#include +#include + +class Cube { + public: + Quad left,top,right,bottom,back,front; + Vertex btl,btr,bbr,bbl,ftl,ftr,fbr,fbl; + + Cube(Vertex backTopLeft, + Vertex backTopRight, + Vertex backBottomRight, + Vertex backBottomLeft, + Vertex frontTopLeft, + Vertex frontTopRight, + Vertex frontBottomRight, + Vertex frontBottomLeft + ) { + this->btl=backTopLeft; + this->btr=backTopRight; + this->bbr=backBottomRight; + this->bbl=backBottomLeft; + this->ftl=frontTopRight; + this->ftl=frontTopRight; + this->fbl=frontBottomLeft; + this->fbr=frontBottomRight; + } + Cube(Quad left, + Quad top, + Quad right, + Quad bottom, + Quad front, + Quad back + ) { + this->left=left; + this->top=top; + this->right=right; + this->bottom=bottom; + this->front=front; + this->back=back; + } + void setColor(); +}; + +void Cube::setColor() { + +} \ No newline at end of file diff --git a/.history/src/Cube_20200511200128.h b/.history/src/Cube_20200511200128.h new file mode 100644 index 0000000..9b3bced --- /dev/null +++ b/.history/src/Cube_20200511200128.h @@ -0,0 +1,46 @@ +#include "Quad.h" +#include "Vertex.h" + +class Cube { + public: + Quad left,top,right,bottom,back,front; + Vertex btl,btr,bbr,bbl,ftl,ftr,fbr,fbl; + + Cube(Vertex backTopLeft, + Vertex backTopRight, + Vertex backBottomRight, + Vertex backBottomLeft, + Vertex frontTopLeft, + Vertex frontTopRight, + Vertex frontBottomRight, + Vertex frontBottomLeft + ) { + this->btl=backTopLeft; + this->btr=backTopRight; + this->bbr=backBottomRight; + this->bbl=backBottomLeft; + this->ftl=frontTopRight; + this->ftl=frontTopRight; + this->fbl=frontBottomLeft; + this->fbr=frontBottomRight; + } + Cube(Quad left, + Quad top, + Quad right, + Quad bottom, + Quad front, + Quad back + ) { + this->left=left; + this->top=top; + this->right=right; + this->bottom=bottom; + this->front=front; + this->back=back; + } + void setColor(); +}; + +void Cube::setColor() { + +} \ No newline at end of file diff --git a/.history/src/Cube_20200511215053.cpp b/.history/src/Cube_20200511215053.cpp new file mode 100644 index 0000000..e69de29 diff --git a/.history/src/Cube_20200511215349.cpp b/.history/src/Cube_20200511215349.cpp new file mode 100644 index 0000000..c10fb9b --- /dev/null +++ b/.history/src/Cube_20200511215349.cpp @@ -0,0 +1,13 @@ +#include "Cube.h" + +Cube(Vertex backTopLeft, + Vertex backTopRight, + Vertex backBottomRight, + Vertex backBottomLeft, + Vertex frontTopLeft, + Vertex frontTopRight, + Vertex frontBottomRight, + Vertex frontBottomLeft +) { + +} \ No newline at end of file diff --git a/.history/src/Cube_20200511215400.cpp b/.history/src/Cube_20200511215400.cpp new file mode 100644 index 0000000..aeadd99 --- /dev/null +++ b/.history/src/Cube_20200511215400.cpp @@ -0,0 +1,13 @@ +#include "Cube.h" + +Cube::Cube(Vertex backTopLeft, + Vertex backTopRight, + Vertex backBottomRight, + Vertex backBottomLeft, + Vertex frontTopLeft, + Vertex frontTopRight, + Vertex frontBottomRight, + Vertex frontBottomLeft +) { + +} \ No newline at end of file diff --git a/.history/src/Cube_20200511215430.cpp b/.history/src/Cube_20200511215430.cpp new file mode 100644 index 0000000..0af8299 --- /dev/null +++ b/.history/src/Cube_20200511215430.cpp @@ -0,0 +1,20 @@ +#include "Cube.h" + +Cube::Cube(Vertex backTopLeft, + Vertex backTopRight, + Vertex backBottomRight, + Vertex backBottomLeft, + Vertex frontTopLeft, + Vertex frontTopRight, + Vertex frontBottomRight, + Vertex frontBottomLeft +) { + this->btl=backTopLeft; + this->btr=backTopRight; + this->bbr=backBottomRight; + this->bbl=backBottomLeft; + this->ftl=frontTopRight; + this->ftl=frontTopRight; + this->fbl=frontBottomLeft; + this->fbr=frontBottomRight; +} \ No newline at end of file diff --git a/.history/src/Cube_20200511215539.cpp b/.history/src/Cube_20200511215539.cpp new file mode 100644 index 0000000..87f5078 --- /dev/null +++ b/.history/src/Cube_20200511215539.cpp @@ -0,0 +1,35 @@ +#include "Cube.h" + +Cube::Cube(Vertex backTopLeft, + Vertex backTopRight, + Vertex backBottomRight, + Vertex backBottomLeft, + Vertex frontTopLeft, + Vertex frontTopRight, + Vertex frontBottomRight, + Vertex frontBottomLeft +) { + this->btl=backTopLeft; + this->btr=backTopRight; + this->bbr=backBottomRight; + this->bbl=backBottomLeft; + this->ftl=frontTopRight; + this->ftl=frontTopRight; + this->fbl=frontBottomLeft; + this->fbr=frontBottomRight; +} +Cube::Cube( + Quad left, + Quad top, + Quad right, + Quad bottom, + Quad front, + Quad back +) { + this->left=left; + this->top=top; + this->right=right; + this->bottom=bottom; + this->front=front; + this->back=back; +} \ No newline at end of file diff --git a/.history/src/Cube_20200511215544.cpp b/.history/src/Cube_20200511215544.cpp new file mode 100644 index 0000000..87f5078 --- /dev/null +++ b/.history/src/Cube_20200511215544.cpp @@ -0,0 +1,35 @@ +#include "Cube.h" + +Cube::Cube(Vertex backTopLeft, + Vertex backTopRight, + Vertex backBottomRight, + Vertex backBottomLeft, + Vertex frontTopLeft, + Vertex frontTopRight, + Vertex frontBottomRight, + Vertex frontBottomLeft +) { + this->btl=backTopLeft; + this->btr=backTopRight; + this->bbr=backBottomRight; + this->bbl=backBottomLeft; + this->ftl=frontTopRight; + this->ftl=frontTopRight; + this->fbl=frontBottomLeft; + this->fbr=frontBottomRight; +} +Cube::Cube( + Quad left, + Quad top, + Quad right, + Quad bottom, + Quad front, + Quad back +) { + this->left=left; + this->top=top; + this->right=right; + this->bottom=bottom; + this->front=front; + this->back=back; +} \ No newline at end of file diff --git a/.history/src/Cube_20200511215553.h b/.history/src/Cube_20200511215553.h new file mode 100644 index 0000000..e66583c --- /dev/null +++ b/.history/src/Cube_20200511215553.h @@ -0,0 +1,30 @@ +#include "Quad.h" +#include "Vertex.h" + +class Cube { + public: + Quad left,top,right,bottom,back,front; + Vertex btl,btr,bbr,bbl,ftl,ftr,fbr,fbl; + + Cube(Vertex backTopLeft, + Vertex backTopRight, + Vertex backBottomRight, + Vertex backBottomLeft, + Vertex frontTopLeft, + Vertex frontTopRight, + Vertex frontBottomRight, + Vertex frontBottomLeft + ) + Cube(Quad left, + Quad top, + Quad right, + Quad bottom, + Quad front, + Quad back + ) + void setColor(); +}; + +void Cube::setColor() { + +} \ No newline at end of file diff --git a/.history/src/Cube_20200511215555.h b/.history/src/Cube_20200511215555.h new file mode 100644 index 0000000..62bc434 --- /dev/null +++ b/.history/src/Cube_20200511215555.h @@ -0,0 +1,30 @@ +#include "Quad.h" +#include "Vertex.h" + +class Cube { + public: + Quad left,top,right,bottom,back,front; + Vertex btl,btr,bbr,bbl,ftl,ftr,fbr,fbl; + + Cube(Vertex backTopLeft, + Vertex backTopRight, + Vertex backBottomRight, + Vertex backBottomLeft, + Vertex frontTopLeft, + Vertex frontTopRight, + Vertex frontBottomRight, + Vertex frontBottomLeft + ) + Cube(Quad left, + Quad top, + Quad right, + Quad bottom, + Quad front, + Quad back + ); + void setColor(); +}; + +void Cube::setColor() { + +} \ No newline at end of file diff --git a/.history/src/Cube_20200511215557.h b/.history/src/Cube_20200511215557.h new file mode 100644 index 0000000..62bc434 --- /dev/null +++ b/.history/src/Cube_20200511215557.h @@ -0,0 +1,30 @@ +#include "Quad.h" +#include "Vertex.h" + +class Cube { + public: + Quad left,top,right,bottom,back,front; + Vertex btl,btr,bbr,bbl,ftl,ftr,fbr,fbl; + + Cube(Vertex backTopLeft, + Vertex backTopRight, + Vertex backBottomRight, + Vertex backBottomLeft, + Vertex frontTopLeft, + Vertex frontTopRight, + Vertex frontBottomRight, + Vertex frontBottomLeft + ) + Cube(Quad left, + Quad top, + Quad right, + Quad bottom, + Quad front, + Quad back + ); + void setColor(); +}; + +void Cube::setColor() { + +} \ No newline at end of file diff --git a/.history/src/Cube_20200511215604.h b/.history/src/Cube_20200511215604.h new file mode 100644 index 0000000..e66583c --- /dev/null +++ b/.history/src/Cube_20200511215604.h @@ -0,0 +1,30 @@ +#include "Quad.h" +#include "Vertex.h" + +class Cube { + public: + Quad left,top,right,bottom,back,front; + Vertex btl,btr,bbr,bbl,ftl,ftr,fbr,fbl; + + Cube(Vertex backTopLeft, + Vertex backTopRight, + Vertex backBottomRight, + Vertex backBottomLeft, + Vertex frontTopLeft, + Vertex frontTopRight, + Vertex frontBottomRight, + Vertex frontBottomLeft + ) + Cube(Quad left, + Quad top, + Quad right, + Quad bottom, + Quad front, + Quad back + ) + void setColor(); +}; + +void Cube::setColor() { + +} \ No newline at end of file diff --git a/.history/src/Cube_20200511215610.h b/.history/src/Cube_20200511215610.h new file mode 100644 index 0000000..2583ccb --- /dev/null +++ b/.history/src/Cube_20200511215610.h @@ -0,0 +1,30 @@ +#include "Quad.h" +#include "Vertex.h" + +class Cube { + public: + Quad left,top,right,bottom,back,front; + Vertex btl,btr,bbr,bbl,ftl,ftr,fbr,fbl; + + Cube(Vertex backTopLeft, + Vertex backTopRight, + Vertex backBottomRight, + Vertex backBottomLeft, + Vertex frontTopLeft, + Vertex frontTopRight, + Vertex frontBottomRight, + Vertex frontBottomLeft + ); + Cube(Quad left, + Quad top, + Quad right, + Quad bottom, + Quad front, + Quad back + ); + void setColor(); +}; + +void Cube::setColor() { + +} \ No newline at end of file diff --git a/.history/src/Cube_20200511215619.h b/.history/src/Cube_20200511215619.h new file mode 100644 index 0000000..5ae6ad8 --- /dev/null +++ b/.history/src/Cube_20200511215619.h @@ -0,0 +1,26 @@ +#include "Quad.h" +#include "Vertex.h" + +class Cube { + public: + Quad left,top,right,bottom,back,front; + Vertex btl,btr,bbr,bbl,ftl,ftr,fbr,fbl; + + Cube(Vertex backTopLeft, + Vertex backTopRight, + Vertex backBottomRight, + Vertex backBottomLeft, + Vertex frontTopLeft, + Vertex frontTopRight, + Vertex frontBottomRight, + Vertex frontBottomLeft + ); + Cube(Quad left, + Quad top, + Quad right, + Quad bottom, + Quad front, + Quad back + ); + void setColor(); +}; \ No newline at end of file diff --git a/.history/src/Cube_20200511215638.cpp b/.history/src/Cube_20200511215638.cpp new file mode 100644 index 0000000..f635b00 --- /dev/null +++ b/.history/src/Cube_20200511215638.cpp @@ -0,0 +1,40 @@ +#include "Cube.h" + +Cube::Cube(Vertex backTopLeft, + Vertex backTopRight, + Vertex backBottomRight, + Vertex backBottomLeft, + Vertex frontTopLeft, + Vertex frontTopRight, + Vertex frontBottomRight, + Vertex frontBottomLeft +) { + this->btl=backTopLeft; + this->btr=backTopRight; + this->bbr=backBottomRight; + this->bbl=backBottomLeft; + this->ftl=frontTopRight; + this->ftl=frontTopRight; + this->fbl=frontBottomLeft; + this->fbr=frontBottomRight; +} + +Cube::Cube( + Quad left, + Quad top, + Quad right, + Quad bottom, + Quad front, + Quad back +) { + this->left=left; + this->top=top; + this->right=right; + this->bottom=bottom; + this->front=front; + this->back=back; +} + +void Cube::setColor(Color c) { + +} \ No newline at end of file diff --git a/.history/src/Cube_20200511215641.cpp b/.history/src/Cube_20200511215641.cpp new file mode 100644 index 0000000..1cb7319 --- /dev/null +++ b/.history/src/Cube_20200511215641.cpp @@ -0,0 +1,40 @@ +#include "Cube.h" + +Cube::Cube(Vertex backTopLeft, + Vertex backTopRight, + Vertex backBottomRight, + Vertex backBottomLeft, + Vertex frontTopLeft, + Vertex frontTopRight, + Vertex frontBottomRight, + Vertex frontBottomLeft +) { + this->btl=backTopLeft; + this->btr=backTopRight; + this->bbr=backBottomRight; + this->bbl=backBottomLeft; + this->ftl=frontTopRight; + this->ftl=frontTopRight; + this->fbl=frontBottomLeft; + this->fbr=frontBottomRight; +} + +Cube::Cube( + Quad left, + Quad top, + Quad right, + Quad bottom, + Quad front, + Quad back +) { + this->left=left; + this->top=top; + this->right=right; + this->bottom=bottom; + this->front=front; + this->back=back; +} + +void Cube::setColor(Color c) { + +} \ No newline at end of file diff --git a/.history/src/Cube_20200511215657.h b/.history/src/Cube_20200511215657.h new file mode 100644 index 0000000..391c7f2 --- /dev/null +++ b/.history/src/Cube_20200511215657.h @@ -0,0 +1,26 @@ +#include "Quad.h" +#include "Vertex.h" + +class Cube { + public: + Quad left,top,right,bottom,back,front; + Vertex btl,btr,bbr,bbl,ftl,ftr,fbr,fbl; + + Cube(Vertex backTopLeft, + Vertex backTopRight, + Vertex backBottomRight, + Vertex backBottomLeft, + Vertex frontTopLeft, + Vertex frontTopRight, + Vertex frontBottomRight, + Vertex frontBottomLeft + ); + Cube(Quad left, + Quad top, + Quad right, + Quad bottom, + Quad front, + Quad back + ); + void setColor(Color c); +}; \ No newline at end of file diff --git a/.history/src/Cube_20200511215708.h b/.history/src/Cube_20200511215708.h new file mode 100644 index 0000000..661cfbb --- /dev/null +++ b/.history/src/Cube_20200511215708.h @@ -0,0 +1,27 @@ +#include "Quad.h" +#include "Vertex.h" + +class Cube { + public: + Color color; + Quad left,top,right,bottom,back,front; + Vertex btl,btr,bbr,bbl,ftl,ftr,fbr,fbl; + + Cube(Vertex backTopLeft, + Vertex backTopRight, + Vertex backBottomRight, + Vertex backBottomLeft, + Vertex frontTopLeft, + Vertex frontTopRight, + Vertex frontBottomRight, + Vertex frontBottomLeft + ); + Cube(Quad left, + Quad top, + Quad right, + Quad bottom, + Quad front, + Quad back + ); + void setColor(Color c); +}; \ No newline at end of file diff --git a/.history/src/Cube_20200511215722.cpp b/.history/src/Cube_20200511215722.cpp new file mode 100644 index 0000000..ef15256 --- /dev/null +++ b/.history/src/Cube_20200511215722.cpp @@ -0,0 +1,40 @@ +#include "Cube.h" + +Cube::Cube(Vertex backTopLeft, + Vertex backTopRight, + Vertex backBottomRight, + Vertex backBottomLeft, + Vertex frontTopLeft, + Vertex frontTopRight, + Vertex frontBottomRight, + Vertex frontBottomLeft +) { + this->btl=backTopLeft; + this->btr=backTopRight; + this->bbr=backBottomRight; + this->bbl=backBottomLeft; + this->ftl=frontTopRight; + this->ftl=frontTopRight; + this->fbl=frontBottomLeft; + this->fbr=frontBottomRight; +} + +Cube::Cube( + Quad left, + Quad top, + Quad right, + Quad bottom, + Quad front, + Quad back +) { + this->left=left; + this->top=top; + this->right=right; + this->bottom=bottom; + this->front=front; + this->back=back; +} + +void Cube::setColor(Color c) { + this->color=c; +} \ No newline at end of file diff --git a/.history/src/Cube_20200512000150.h b/.history/src/Cube_20200512000150.h new file mode 100644 index 0000000..d1b5c3c --- /dev/null +++ b/.history/src/Cube_20200512000150.h @@ -0,0 +1,27 @@ +#include "Quad.h" +#include "Vertex.h" + +class Cube { + public: + Color color; + Quad left,top,right,bottom,back,front; + Vertex btl,btr,bbr,bbl,ftl,ftr,fbr,fbl; + + Cube(Vertex backTopLeft, + Vertex backTopRight, + Vertex backBottomRight, + Vertex backBottomLeft, + Vertex frontTopLeft, + Vertex frontTopRight, + Vertex frontBottomRight, + Vertex frontBottomLeft + ); + Cube(Quad left, + Quad top, + Quad right, + Quad bottom, + Quad front, + Quad back + ); + void setColor(myColor c); +}; \ No newline at end of file diff --git a/.history/src/Cube_20200512000152.h b/.history/src/Cube_20200512000152.h new file mode 100644 index 0000000..13d985a --- /dev/null +++ b/.history/src/Cube_20200512000152.h @@ -0,0 +1,27 @@ +#include "Quad.h" +#include "Vertex.h" + +class Cube { + public: + myColor color; + Quad left,top,right,bottom,back,front; + Vertex btl,btr,bbr,bbl,ftl,ftr,fbr,fbl; + + Cube(Vertex backTopLeft, + Vertex backTopRight, + Vertex backBottomRight, + Vertex backBottomLeft, + Vertex frontTopLeft, + Vertex frontTopRight, + Vertex frontBottomRight, + Vertex frontBottomLeft + ); + Cube(Quad left, + Quad top, + Quad right, + Quad bottom, + Quad front, + Quad back + ); + void setColor(myColor c); +}; \ No newline at end of file diff --git a/.history/src/Cube_20200512000204.cpp b/.history/src/Cube_20200512000204.cpp new file mode 100644 index 0000000..f65b20c --- /dev/null +++ b/.history/src/Cube_20200512000204.cpp @@ -0,0 +1,40 @@ +#include "Cube.h" + +Cube::Cube(Vertex backTopLeft, + Vertex backTopRight, + Vertex backBottomRight, + Vertex backBottomLeft, + Vertex frontTopLeft, + Vertex frontTopRight, + Vertex frontBottomRight, + Vertex frontBottomLeft +) { + this->btl=backTopLeft; + this->btr=backTopRight; + this->bbr=backBottomRight; + this->bbl=backBottomLeft; + this->ftl=frontTopRight; + this->ftl=frontTopRight; + this->fbl=frontBottomLeft; + this->fbr=frontBottomRight; +} + +Cube::Cube( + Quad left, + Quad top, + Quad right, + Quad bottom, + Quad front, + Quad back +) { + this->left=left; + this->top=top; + this->right=right; + this->bottom=bottom; + this->front=front; + this->back=back; +} + +void Cube::setColor(myColor c) { + this->color=c; +} \ No newline at end of file diff --git a/.history/src/Cube_20200512005406.h b/.history/src/Cube_20200512005406.h new file mode 100644 index 0000000..90a7d6f --- /dev/null +++ b/.history/src/Cube_20200512005406.h @@ -0,0 +1,26 @@ +#include "Vertex.h" + +class Cube { + public: + myColor color; + Quad left,top,right,bottom,back,front; + Vertex btl,btr,bbr,bbl,ftl,ftr,fbr,fbl; + + Cube(Vertex backTopLeft, + Vertex backTopRight, + Vertex backBottomRight, + Vertex backBottomLeft, + Vertex frontTopLeft, + Vertex frontTopRight, + Vertex frontBottomRight, + Vertex frontBottomLeft + ); + Cube(Quad left, + Quad top, + Quad right, + Quad bottom, + Quad front, + Quad back + ); + void setColor(myColor c); +}; \ No newline at end of file diff --git a/.history/src/Cube_20200512005416.h b/.history/src/Cube_20200512005416.h new file mode 100644 index 0000000..9ab9c7b --- /dev/null +++ b/.history/src/Cube_20200512005416.h @@ -0,0 +1,26 @@ +#include "Quad.h" + +class Cube { + public: + myColor color; + Quad left,top,right,bottom,back,front; + Vertex btl,btr,bbr,bbl,ftl,ftr,fbr,fbl; + + Cube(Vertex backTopLeft, + Vertex backTopRight, + Vertex backBottomRight, + Vertex backBottomLeft, + Vertex frontTopLeft, + Vertex frontTopRight, + Vertex frontBottomRight, + Vertex frontBottomLeft + ); + Cube(Quad left, + Quad top, + Quad right, + Quad bottom, + Quad front, + Quad back + ); + void setColor(myColor c); +}; \ No newline at end of file diff --git a/.history/src/Quad_20200511171624.h b/.history/src/Quad_20200511171624.h new file mode 100644 index 0000000..e69de29 diff --git a/.history/src/Quad_20200511171639.h b/.history/src/Quad_20200511171639.h new file mode 100644 index 0000000..29a87ad --- /dev/null +++ b/.history/src/Quad_20200511171639.h @@ -0,0 +1,19 @@ +class Quad { + public: + Color color; + Vertex topL,topR,botR,botL; + void setColor(Color color); + void render(); +}; + +void Quad::setColor(Color c) { + color = c; +} + +void Quad::render() { + glColor4f(color.r,color.g,color.b,color.a); + glVertex3f(topL.x,topL.y,topL.z); + glVertex3f(topR.x,topR.y,topR.z); + glVertex3f(botR.x,botR.y,botR.z); + glVertex3f(botL.x,botL.y,botL.z); +} \ No newline at end of file diff --git a/.history/src/Quad_20200511171657.h b/.history/src/Quad_20200511171657.h new file mode 100644 index 0000000..4bc4ef5 --- /dev/null +++ b/.history/src/Quad_20200511171657.h @@ -0,0 +1,22 @@ +#include +#include + +class Quad { + public: + Color color; + Vertex topL,topR,botR,botL; + void setColor(Color color); + void render(); +}; + +void Quad::setColor(Color c) { + color = c; +} + +void Quad::render() { + glColor4f(color.r,color.g,color.b,color.a); + glVertex3f(topL.x,topL.y,topL.z); + glVertex3f(topR.x,topR.y,topR.z); + glVertex3f(botR.x,botR.y,botR.z); + glVertex3f(botL.x,botL.y,botL.z); +} \ No newline at end of file diff --git a/.history/src/Quad_20200511171706.h b/.history/src/Quad_20200511171706.h new file mode 100644 index 0000000..c1d364b --- /dev/null +++ b/.history/src/Quad_20200511171706.h @@ -0,0 +1,23 @@ +#include +#include +#include + +class Quad { + public: + Color color; + Vertex topL,topR,botR,botL; + void setColor(Color color); + void render(); +}; + +void Quad::setColor(Color c) { + color = c; +} + +void Quad::render() { + glColor4f(color.r,color.g,color.b,color.a); + glVertex3f(topL.x,topL.y,topL.z); + glVertex3f(topR.x,topR.y,topR.z); + glVertex3f(botR.x,botR.y,botR.z); + glVertex3f(botL.x,botL.y,botL.z); +} \ No newline at end of file diff --git a/.history/src/Quad_20200511171710.h b/.history/src/Quad_20200511171710.h new file mode 100644 index 0000000..78b780b --- /dev/null +++ b/.history/src/Quad_20200511171710.h @@ -0,0 +1,23 @@ +#include +#include +#include + +class Quad { + public: + Color color; + Vertex topL,topR,botR,botL; + void setColor(Color color); + void render(); +}; + +void Quad::setColor(Color c) { + color = c; +} + +void Quad::render() { + glColor4f(color.r,color.g,color.b,color.a); + glVertex3f(topL.x,topL.y,topL.z); + glVertex3f(topR.x,topR.y,topR.z); + glVertex3f(botR.x,botR.y,botR.z); + glVertex3f(botL.x,botL.y,botL.z); +} \ No newline at end of file diff --git a/.history/src/Quad_20200511171713.h b/.history/src/Quad_20200511171713.h new file mode 100644 index 0000000..78b780b --- /dev/null +++ b/.history/src/Quad_20200511171713.h @@ -0,0 +1,23 @@ +#include +#include +#include + +class Quad { + public: + Color color; + Vertex topL,topR,botR,botL; + void setColor(Color color); + void render(); +}; + +void Quad::setColor(Color c) { + color = c; +} + +void Quad::render() { + glColor4f(color.r,color.g,color.b,color.a); + glVertex3f(topL.x,topL.y,topL.z); + glVertex3f(topR.x,topR.y,topR.z); + glVertex3f(botR.x,botR.y,botR.z); + glVertex3f(botL.x,botL.y,botL.z); +} \ No newline at end of file diff --git a/.history/src/Quad_20200511171740.h b/.history/src/Quad_20200511171740.h new file mode 100644 index 0000000..3d2d840 --- /dev/null +++ b/.history/src/Quad_20200511171740.h @@ -0,0 +1,23 @@ +#include +#include +#include + +class Quad { + public: + Color color; + Vertex topL,topR,botR,botL; + void setColor(Color color); + void render(); +}; + +void Quad::setColor(Color c) { + color = c; +} + +void Quad::render() { + glColor4f(color.r,color.g,color.b,color.a); + glVertex3f(topL.x,topL.y,topL.z); + glVertex3f(topR.x,topR.y,topR.z); + glVertex3f(botR.x,botR.y,botR.z); + glVertex3f(botL.x,botL.y,botL.z); +} \ No newline at end of file diff --git a/.history/src/Quad_20200511175511.h b/.history/src/Quad_20200511175511.h new file mode 100644 index 0000000..60e01e0 --- /dev/null +++ b/.history/src/Quad_20200511175511.h @@ -0,0 +1,27 @@ +#include +#include +#include + +class Quad { + public: + Color color; + Vertex topL,topR,botR,botL; + void setColor(Color color); + void render(); + Quad(Vertex topL, Vertex topR, Vertex botR, Vertex botL) { + this->topL=topL; + this->topR=topR; + } +}; + +void Quad::setColor(Color c) { + color = c; +} + +void Quad::render() { + glColor4f(color.r,color.g,color.b,color.a); + glVertex3f(topL.x,topL.y,topL.z); + glVertex3f(topR.x,topR.y,topR.z); + glVertex3f(botR.x,botR.y,botR.z); + glVertex3f(botL.x,botL.y,botL.z); +} \ No newline at end of file diff --git a/.history/src/Quad_20200511175543.h b/.history/src/Quad_20200511175543.h new file mode 100644 index 0000000..ac88536 --- /dev/null +++ b/.history/src/Quad_20200511175543.h @@ -0,0 +1,29 @@ +#include +#include +#include + +class Quad { + public: + Color color; + Vertex topL,topR,botR,botL; + void setColor(Color color); + void render(); + Quad(Vertex topL, Vertex topR, Vertex botR, Vertex botL) { + this->topL=topL; + this->topR=topR; + this->botR=botR; + this->botL=botL; + } +}; + +void Quad::setColor(Color c) { + color = c; +} + +void Quad::render() { + glColor4f(color.r,color.g,color.b,color.a); + glVertex3f(topL.x,topL.y,topL.z); + glVertex3f(topR.x,topR.y,topR.z); + glVertex3f(botR.x,botR.y,botR.z); + glVertex3f(botL.x,botL.y,botL.z); +} \ No newline at end of file diff --git a/.history/src/Quad_20200511175550.h b/.history/src/Quad_20200511175550.h new file mode 100644 index 0000000..ac88536 --- /dev/null +++ b/.history/src/Quad_20200511175550.h @@ -0,0 +1,29 @@ +#include +#include +#include + +class Quad { + public: + Color color; + Vertex topL,topR,botR,botL; + void setColor(Color color); + void render(); + Quad(Vertex topL, Vertex topR, Vertex botR, Vertex botL) { + this->topL=topL; + this->topR=topR; + this->botR=botR; + this->botL=botL; + } +}; + +void Quad::setColor(Color c) { + color = c; +} + +void Quad::render() { + glColor4f(color.r,color.g,color.b,color.a); + glVertex3f(topL.x,topL.y,topL.z); + glVertex3f(topR.x,topR.y,topR.z); + glVertex3f(botR.x,botR.y,botR.z); + glVertex3f(botL.x,botL.y,botL.z); +} \ No newline at end of file diff --git a/.history/src/Quad_20200511175556.h b/.history/src/Quad_20200511175556.h new file mode 100644 index 0000000..d951649 --- /dev/null +++ b/.history/src/Quad_20200511175556.h @@ -0,0 +1,29 @@ +#include +#include +#include + +class Quad { + public: + Color color; + Vertex topL,topR,botR,botL; + void setColor(Color color); + void render(); + Quad(Vertex topL, Vertex topR, Vertex botR, Vertex botL) { + this->topL=topL; + this->topR=topR; + this->botR=botR; + this->botL=botL; + }; +}; + +void Quad::setColor(Color c) { + color = c; +} + +void Quad::render() { + glColor4f(color.r,color.g,color.b,color.a); + glVertex3f(topL.x,topL.y,topL.z); + glVertex3f(topR.x,topR.y,topR.z); + glVertex3f(botR.x,botR.y,botR.z); + glVertex3f(botL.x,botL.y,botL.z); +} \ No newline at end of file diff --git a/.history/src/Quad_20200511175559.h b/.history/src/Quad_20200511175559.h new file mode 100644 index 0000000..ac88536 --- /dev/null +++ b/.history/src/Quad_20200511175559.h @@ -0,0 +1,29 @@ +#include +#include +#include + +class Quad { + public: + Color color; + Vertex topL,topR,botR,botL; + void setColor(Color color); + void render(); + Quad(Vertex topL, Vertex topR, Vertex botR, Vertex botL) { + this->topL=topL; + this->topR=topR; + this->botR=botR; + this->botL=botL; + } +}; + +void Quad::setColor(Color c) { + color = c; +} + +void Quad::render() { + glColor4f(color.r,color.g,color.b,color.a); + glVertex3f(topL.x,topL.y,topL.z); + glVertex3f(topR.x,topR.y,topR.z); + glVertex3f(botR.x,botR.y,botR.z); + glVertex3f(botL.x,botL.y,botL.z); +} \ No newline at end of file diff --git a/.history/src/Quad_20200511175623.h b/.history/src/Quad_20200511175623.h new file mode 100644 index 0000000..c3e9dc3 --- /dev/null +++ b/.history/src/Quad_20200511175623.h @@ -0,0 +1,29 @@ +#include +#include +#include + +class Quad { + public: + Color color; + Vertex topL,topR,botR,botL; + Quad(Vertex topL, Vertex topR, Vertex botR, Vertex botL) { + this->topL=topL; + this->topR=topR; + this->botR=botR; + this->botL=botL; + } + void setColor(Color color); + void render(); +}; + +void Quad::setColor(Color c) { + color = c; +} + +void Quad::render() { + glColor4f(color.r,color.g,color.b,color.a); + glVertex3f(topL.x,topL.y,topL.z); + glVertex3f(topR.x,topR.y,topR.z); + glVertex3f(botR.x,botR.y,botR.z); + glVertex3f(botL.x,botL.y,botL.z); +} \ No newline at end of file diff --git a/.history/src/Quad_20200511175926.h b/.history/src/Quad_20200511175926.h new file mode 100644 index 0000000..f04fc1c --- /dev/null +++ b/.history/src/Quad_20200511175926.h @@ -0,0 +1,29 @@ +#include +#include +#include + +class Quad { + public: + Color color(); + Vertex topL,topR,botR,botL; + Quad(Vertex topL, Vertex topR, Vertex botR, Vertex botL) { + this->topL=topL; + this->topR=topR; + this->botR=botR; + this->botL=botL; + } + void setColor(Color color); + void render(); +}; + +void Quad::setColor(Color c) { + color = c; +} + +void Quad::render() { + glColor4f(color.r,color.g,color.b,color.a); + glVertex3f(topL.x,topL.y,topL.z); + glVertex3f(topR.x,topR.y,topR.z); + glVertex3f(botR.x,botR.y,botR.z); + glVertex3f(botL.x,botL.y,botL.z); +} \ No newline at end of file diff --git a/.history/src/Quad_20200511175932.h b/.history/src/Quad_20200511175932.h new file mode 100644 index 0000000..c3e9dc3 --- /dev/null +++ b/.history/src/Quad_20200511175932.h @@ -0,0 +1,29 @@ +#include +#include +#include + +class Quad { + public: + Color color; + Vertex topL,topR,botR,botL; + Quad(Vertex topL, Vertex topR, Vertex botR, Vertex botL) { + this->topL=topL; + this->topR=topR; + this->botR=botR; + this->botL=botL; + } + void setColor(Color color); + void render(); +}; + +void Quad::setColor(Color c) { + color = c; +} + +void Quad::render() { + glColor4f(color.r,color.g,color.b,color.a); + glVertex3f(topL.x,topL.y,topL.z); + glVertex3f(topR.x,topR.y,topR.z); + glVertex3f(botR.x,botR.y,botR.z); + glVertex3f(botL.x,botL.y,botL.z); +} \ No newline at end of file diff --git a/.history/src/Quad_20200511184026.h b/.history/src/Quad_20200511184026.h new file mode 100644 index 0000000..687f013 --- /dev/null +++ b/.history/src/Quad_20200511184026.h @@ -0,0 +1,30 @@ +#include +#include +#include + +class Quad { + public: + Color color; + Vertex topL,topR,botR,botL; + Quad(); + Quad(Vertex topL, Vertex topR, Vertex botR, Vertex botL) { + this->topL=topL; + this->topR=topR; + this->botR=botR; + this->botL=botL; + } + void setColor(Color color); + void render(); +}; + +void Quad::setColor(Color c) { + color = c; +} + +void Quad::render() { + glColor4f(color.r,color.g,color.b,color.a); + glVertex3f(topL.x,topL.y,topL.z); + glVertex3f(topR.x,topR.y,topR.z); + glVertex3f(botR.x,botR.y,botR.z); + glVertex3f(botL.x,botL.y,botL.z); +} \ No newline at end of file diff --git a/.history/src/Quad_20200511184038.h b/.history/src/Quad_20200511184038.h new file mode 100644 index 0000000..687f013 --- /dev/null +++ b/.history/src/Quad_20200511184038.h @@ -0,0 +1,30 @@ +#include +#include +#include + +class Quad { + public: + Color color; + Vertex topL,topR,botR,botL; + Quad(); + Quad(Vertex topL, Vertex topR, Vertex botR, Vertex botL) { + this->topL=topL; + this->topR=topR; + this->botR=botR; + this->botL=botL; + } + void setColor(Color color); + void render(); +}; + +void Quad::setColor(Color c) { + color = c; +} + +void Quad::render() { + glColor4f(color.r,color.g,color.b,color.a); + glVertex3f(topL.x,topL.y,topL.z); + glVertex3f(topR.x,topR.y,topR.z); + glVertex3f(botR.x,botR.y,botR.z); + glVertex3f(botL.x,botL.y,botL.z); +} \ No newline at end of file diff --git a/.history/src/Quad_20200511184041.h b/.history/src/Quad_20200511184041.h new file mode 100644 index 0000000..687f013 --- /dev/null +++ b/.history/src/Quad_20200511184041.h @@ -0,0 +1,30 @@ +#include +#include +#include + +class Quad { + public: + Color color; + Vertex topL,topR,botR,botL; + Quad(); + Quad(Vertex topL, Vertex topR, Vertex botR, Vertex botL) { + this->topL=topL; + this->topR=topR; + this->botR=botR; + this->botL=botL; + } + void setColor(Color color); + void render(); +}; + +void Quad::setColor(Color c) { + color = c; +} + +void Quad::render() { + glColor4f(color.r,color.g,color.b,color.a); + glVertex3f(topL.x,topL.y,topL.z); + glVertex3f(topR.x,topR.y,topR.z); + glVertex3f(botR.x,botR.y,botR.z); + glVertex3f(botL.x,botL.y,botL.z); +} \ No newline at end of file diff --git a/.history/src/Quad_20200511184044.h b/.history/src/Quad_20200511184044.h new file mode 100644 index 0000000..c3e9dc3 --- /dev/null +++ b/.history/src/Quad_20200511184044.h @@ -0,0 +1,29 @@ +#include +#include +#include + +class Quad { + public: + Color color; + Vertex topL,topR,botR,botL; + Quad(Vertex topL, Vertex topR, Vertex botR, Vertex botL) { + this->topL=topL; + this->topR=topR; + this->botR=botR; + this->botL=botL; + } + void setColor(Color color); + void render(); +}; + +void Quad::setColor(Color c) { + color = c; +} + +void Quad::render() { + glColor4f(color.r,color.g,color.b,color.a); + glVertex3f(topL.x,topL.y,topL.z); + glVertex3f(topR.x,topR.y,topR.z); + glVertex3f(botR.x,botR.y,botR.z); + glVertex3f(botL.x,botL.y,botL.z); +} \ No newline at end of file diff --git a/.history/src/Quad_20200511184053.h b/.history/src/Quad_20200511184053.h new file mode 100644 index 0000000..fdf6081 --- /dev/null +++ b/.history/src/Quad_20200511184053.h @@ -0,0 +1,30 @@ +#include +#include +#include + +class Quad { + public: + Color color; + Vertex topL,topR,botR,botL; + Quad(Vertex topL, Vertex topR, Vertex botR, Vertex botL) { + this->topL=topL; + this->topR=topR; + this->botR=botR; + this->botL=botL; + } + Quad(); + void setColor(Color color); + void render(); +}; + +void Quad::setColor(Color c) { + color = c; +} + +void Quad::render() { + glColor4f(color.r,color.g,color.b,color.a); + glVertex3f(topL.x,topL.y,topL.z); + glVertex3f(topR.x,topR.y,topR.z); + glVertex3f(botR.x,botR.y,botR.z); + glVertex3f(botL.x,botL.y,botL.z); +} \ No newline at end of file diff --git a/.history/src/Quad_20200511184056.h b/.history/src/Quad_20200511184056.h new file mode 100644 index 0000000..fdf6081 --- /dev/null +++ b/.history/src/Quad_20200511184056.h @@ -0,0 +1,30 @@ +#include +#include +#include + +class Quad { + public: + Color color; + Vertex topL,topR,botR,botL; + Quad(Vertex topL, Vertex topR, Vertex botR, Vertex botL) { + this->topL=topL; + this->topR=topR; + this->botR=botR; + this->botL=botL; + } + Quad(); + void setColor(Color color); + void render(); +}; + +void Quad::setColor(Color c) { + color = c; +} + +void Quad::render() { + glColor4f(color.r,color.g,color.b,color.a); + glVertex3f(topL.x,topL.y,topL.z); + glVertex3f(topR.x,topR.y,topR.z); + glVertex3f(botR.x,botR.y,botR.z); + glVertex3f(botL.x,botL.y,botL.z); +} \ No newline at end of file diff --git a/.history/src/Quad_20200511184723.h b/.history/src/Quad_20200511184723.h new file mode 100644 index 0000000..fdf6081 --- /dev/null +++ b/.history/src/Quad_20200511184723.h @@ -0,0 +1,30 @@ +#include +#include +#include + +class Quad { + public: + Color color; + Vertex topL,topR,botR,botL; + Quad(Vertex topL, Vertex topR, Vertex botR, Vertex botL) { + this->topL=topL; + this->topR=topR; + this->botR=botR; + this->botL=botL; + } + Quad(); + void setColor(Color color); + void render(); +}; + +void Quad::setColor(Color c) { + color = c; +} + +void Quad::render() { + glColor4f(color.r,color.g,color.b,color.a); + glVertex3f(topL.x,topL.y,topL.z); + glVertex3f(topR.x,topR.y,topR.z); + glVertex3f(botR.x,botR.y,botR.z); + glVertex3f(botL.x,botL.y,botL.z); +} \ No newline at end of file diff --git a/.history/src/Quad_20200511184816.h b/.history/src/Quad_20200511184816.h new file mode 100644 index 0000000..a9dfb14 --- /dev/null +++ b/.history/src/Quad_20200511184816.h @@ -0,0 +1,30 @@ +#include +#include +#include + +class Quad { + public: + Color color; + Vertex topL,topR,botR,botL; + Quad(Vertex topL, Vertex topR, Vertex botR, Vertex botL) { + this->topL=topL; + this->topR=topR; + this->botR=botR; + this->botL=botL; + } + Quad(); + void setColor(Color color); + void render(); +}; + +void Quad::setColor(Color c) { + color = c; +} + +void Quad::render() { + glColor4f(color.r,color.g,color.b,color.a); + glVertex3f(topL.x,topL.y,topL.z); + glVertex3f(topR.x,topR.y,topR.z); + glVertex3f(botR.x,botR.y,botR.z); + glVertex3f(botL.x,botL.y,botL.z); +} \ No newline at end of file diff --git a/.history/src/Quad_20200511185058.h b/.history/src/Quad_20200511185058.h new file mode 100644 index 0000000..fdf6081 --- /dev/null +++ b/.history/src/Quad_20200511185058.h @@ -0,0 +1,30 @@ +#include +#include +#include + +class Quad { + public: + Color color; + Vertex topL,topR,botR,botL; + Quad(Vertex topL, Vertex topR, Vertex botR, Vertex botL) { + this->topL=topL; + this->topR=topR; + this->botR=botR; + this->botL=botL; + } + Quad(); + void setColor(Color color); + void render(); +}; + +void Quad::setColor(Color c) { + color = c; +} + +void Quad::render() { + glColor4f(color.r,color.g,color.b,color.a); + glVertex3f(topL.x,topL.y,topL.z); + glVertex3f(topR.x,topR.y,topR.z); + glVertex3f(botR.x,botR.y,botR.z); + glVertex3f(botL.x,botL.y,botL.z); +} \ No newline at end of file diff --git a/.history/src/Quad_20200511200147.h b/.history/src/Quad_20200511200147.h new file mode 100644 index 0000000..4ae1441 --- /dev/null +++ b/.history/src/Quad_20200511200147.h @@ -0,0 +1,30 @@ +#include "Color.h" +#include "Vertex.h" +#include + +class Quad { + public: + Color color; + Vertex topL,topR,botR,botL; + Quad(Vertex topL, Vertex topR, Vertex botR, Vertex botL) { + this->topL=topL; + this->topR=topR; + this->botR=botR; + this->botL=botL; + } + Quad(); + void setColor(Color color); + void render(); +}; + +void Quad::setColor(Color c) { + color = c; +} + +void Quad::render() { + glColor4f(color.r,color.g,color.b,color.a); + glVertex3f(topL.x,topL.y,topL.z); + glVertex3f(topR.x,topR.y,topR.z); + glVertex3f(botR.x,botR.y,botR.z); + glVertex3f(botL.x,botL.y,botL.z); +} \ No newline at end of file diff --git a/.history/src/Quad_20200511215736.cpp b/.history/src/Quad_20200511215736.cpp new file mode 100644 index 0000000..e69de29 diff --git a/.history/src/Quad_20200511215936.cpp b/.history/src/Quad_20200511215936.cpp new file mode 100644 index 0000000..511a71a --- /dev/null +++ b/.history/src/Quad_20200511215936.cpp @@ -0,0 +1,8 @@ +#include "Quad.h" + +Quad::Quad(Vertex topL, Vertex topR, Vertex botR, Vertex botL) { + this->topL=topL; + this->topR=topR; + this->botR=botR; + this->botL=botL; + } \ No newline at end of file diff --git a/.history/src/Quad_20200511220007.cpp b/.history/src/Quad_20200511220007.cpp new file mode 100644 index 0000000..c14d01b --- /dev/null +++ b/.history/src/Quad_20200511220007.cpp @@ -0,0 +1,8 @@ +#include "Quad.h" + +Quad::Quad(Vertex topL, Vertex topR, Vertex botR, Vertex botL) { + this->topL=topL; + this->topR=topR; + this->botR=botR; + this->botL=botL; +} \ No newline at end of file diff --git a/.history/src/Quad_20200511220027.h b/.history/src/Quad_20200511220027.h new file mode 100644 index 0000000..14e7068 --- /dev/null +++ b/.history/src/Quad_20200511220027.h @@ -0,0 +1,25 @@ +#include "Color.h" +#include "Vertex.h" +#include + +class Quad { + public: + Color color; + Vertex topL,topR,botR,botL; + Quad(Vertex topL, Vertex topR, Vertex botR, Vertex botL); + Quad(); + void setColor(Color color); + void render(); +}; + +void Quad::setColor(Color c) { + color = c; +} + +void Quad::render() { + glColor4f(color.r,color.g,color.b,color.a); + glVertex3f(topL.x,topL.y,topL.z); + glVertex3f(topR.x,topR.y,topR.z); + glVertex3f(botR.x,botR.y,botR.z); + glVertex3f(botL.x,botL.y,botL.z); +} \ No newline at end of file diff --git a/.history/src/Quad_20200511220042.cpp b/.history/src/Quad_20200511220042.cpp new file mode 100644 index 0000000..05526b6 --- /dev/null +++ b/.history/src/Quad_20200511220042.cpp @@ -0,0 +1,10 @@ +#include "Quad.h" + +Quad::Quad(Vertex topL, Vertex topR, Vertex botR, Vertex botL) { + this->topL=topL; + this->topR=topR; + this->botR=botR; + this->botL=botL; +} + +Quad::Quad() {}; \ No newline at end of file diff --git a/.history/src/Quad_20200511220043.cpp b/.history/src/Quad_20200511220043.cpp new file mode 100644 index 0000000..7ff42ef --- /dev/null +++ b/.history/src/Quad_20200511220043.cpp @@ -0,0 +1,10 @@ +#include "Quad.h" + +Quad::Quad(Vertex topL, Vertex topR, Vertex botR, Vertex botL) { + this->topL=topL; + this->topR=topR; + this->botR=botR; + this->botL=botL; +} + +Quad::Quad() {} \ No newline at end of file diff --git a/.history/src/Quad_20200511220045.cpp b/.history/src/Quad_20200511220045.cpp new file mode 100644 index 0000000..299ea2c --- /dev/null +++ b/.history/src/Quad_20200511220045.cpp @@ -0,0 +1,9 @@ +#include "Quad.h" + +Quad::Quad(Vertex topL, Vertex topR, Vertex botR, Vertex botL) { + this->topL=topL; + this->topR=topR; + this->botR=botR; + this->botL=botL; +} +Quad::Quad() {} \ No newline at end of file diff --git a/.history/src/Quad_20200511220046.cpp b/.history/src/Quad_20200511220046.cpp new file mode 100644 index 0000000..7ff42ef --- /dev/null +++ b/.history/src/Quad_20200511220046.cpp @@ -0,0 +1,10 @@ +#include "Quad.h" + +Quad::Quad(Vertex topL, Vertex topR, Vertex botR, Vertex botL) { + this->topL=topL; + this->topR=topR; + this->botR=botR; + this->botL=botL; +} + +Quad::Quad() {} \ No newline at end of file diff --git a/.history/src/Quad_20200511220105.cpp b/.history/src/Quad_20200511220105.cpp new file mode 100644 index 0000000..4cda0ef --- /dev/null +++ b/.history/src/Quad_20200511220105.cpp @@ -0,0 +1,14 @@ +#include "Quad.h" + +Quad::Quad(Vertex topL, Vertex topR, Vertex botR, Vertex botL) { + this->topL=topL; + this->topR=topR; + this->botR=botR; + this->botL=botL; +} + +Quad::Quad() {} + +void Quad::setColor(Color c) { + +} \ No newline at end of file diff --git a/.history/src/Quad_20200511220115.h b/.history/src/Quad_20200511220115.h new file mode 100644 index 0000000..aeb5d15 --- /dev/null +++ b/.history/src/Quad_20200511220115.h @@ -0,0 +1,25 @@ +#include "Color.h" +#include "Vertex.h" +#include + +class Quad { + public: + Color color; + Vertex topL,topR,botR,botL; + Quad(Vertex topL, Vertex topR, Vertex botR, Vertex botL); + Quad(); + void setColor(Color c); + void render(); +}; + +void Quad::setColor(Color c) { + color = c; +} + +void Quad::render() { + glColor4f(color.r,color.g,color.b,color.a); + glVertex3f(topL.x,topL.y,topL.z); + glVertex3f(topR.x,topR.y,topR.z); + glVertex3f(botR.x,botR.y,botR.z); + glVertex3f(botL.x,botL.y,botL.z); +} \ No newline at end of file diff --git a/.history/src/Quad_20200511220118.h b/.history/src/Quad_20200511220118.h new file mode 100644 index 0000000..f9e629d --- /dev/null +++ b/.history/src/Quad_20200511220118.h @@ -0,0 +1,21 @@ +#include "Color.h" +#include "Vertex.h" +#include + +class Quad { + public: + Color color; + Vertex topL,topR,botR,botL; + Quad(Vertex topL, Vertex topR, Vertex botR, Vertex botL); + Quad(); + void setColor(Color c); + void render(); +}; + +void Quad::render() { + glColor4f(color.r,color.g,color.b,color.a); + glVertex3f(topL.x,topL.y,topL.z); + glVertex3f(topR.x,topR.y,topR.z); + glVertex3f(botR.x,botR.y,botR.z); + glVertex3f(botL.x,botL.y,botL.z); +} \ No newline at end of file diff --git a/.history/src/Quad_20200511220128.cpp b/.history/src/Quad_20200511220128.cpp new file mode 100644 index 0000000..9d27da3 --- /dev/null +++ b/.history/src/Quad_20200511220128.cpp @@ -0,0 +1,14 @@ +#include "Quad.h" + +Quad::Quad(Vertex topL, Vertex topR, Vertex botR, Vertex botL) { + this->topL=topL; + this->topR=topR; + this->botR=botR; + this->botL=botL; +} + +Quad::Quad() {} + +void Quad::setColor(Color c) { + this->color=c; +} \ No newline at end of file diff --git a/.history/src/Quad_20200511220143.cpp b/.history/src/Quad_20200511220143.cpp new file mode 100644 index 0000000..222a68f --- /dev/null +++ b/.history/src/Quad_20200511220143.cpp @@ -0,0 +1,22 @@ +#include "Quad.h" + +Quad::Quad(Vertex topL, Vertex topR, Vertex botR, Vertex botL) { + this->topL=topL; + this->topR=topR; + this->botR=botR; + this->botL=botL; +} + +Quad::Quad() {} + +void Quad::setColor(Color c) { + this->color=c; +} + +void Quad::render() { + glColor4f(color.r,color.g,color.b,color.a); + glVertex3f(topL.x,topL.y,topL.z); + glVertex3f(topR.x,topR.y,topR.z); + glVertex3f(botR.x,botR.y,botR.z); + glVertex3f(botL.x,botL.y,botL.z); +} \ No newline at end of file diff --git a/.history/src/Quad_20200511220149.cpp b/.history/src/Quad_20200511220149.cpp new file mode 100644 index 0000000..222a68f --- /dev/null +++ b/.history/src/Quad_20200511220149.cpp @@ -0,0 +1,22 @@ +#include "Quad.h" + +Quad::Quad(Vertex topL, Vertex topR, Vertex botR, Vertex botL) { + this->topL=topL; + this->topR=topR; + this->botR=botR; + this->botL=botL; +} + +Quad::Quad() {} + +void Quad::setColor(Color c) { + this->color=c; +} + +void Quad::render() { + glColor4f(color.r,color.g,color.b,color.a); + glVertex3f(topL.x,topL.y,topL.z); + glVertex3f(topR.x,topR.y,topR.z); + glVertex3f(botR.x,botR.y,botR.z); + glVertex3f(botL.x,botL.y,botL.z); +} \ No newline at end of file diff --git a/.history/src/Quad_20200511220152.h b/.history/src/Quad_20200511220152.h new file mode 100644 index 0000000..4f4a248 --- /dev/null +++ b/.history/src/Quad_20200511220152.h @@ -0,0 +1,13 @@ +#include "Color.h" +#include "Vertex.h" +#include + +class Quad { + public: + Color color; + Vertex topL,topR,botR,botL; + Quad(Vertex topL, Vertex topR, Vertex botR, Vertex botL); + Quad(); + void setColor(Color c); + void render(); +}; \ No newline at end of file diff --git a/.history/src/Quad_20200511220156.cpp b/.history/src/Quad_20200511220156.cpp new file mode 100644 index 0000000..222a68f --- /dev/null +++ b/.history/src/Quad_20200511220156.cpp @@ -0,0 +1,22 @@ +#include "Quad.h" + +Quad::Quad(Vertex topL, Vertex topR, Vertex botR, Vertex botL) { + this->topL=topL; + this->topR=topR; + this->botR=botR; + this->botL=botL; +} + +Quad::Quad() {} + +void Quad::setColor(Color c) { + this->color=c; +} + +void Quad::render() { + glColor4f(color.r,color.g,color.b,color.a); + glVertex3f(topL.x,topL.y,topL.z); + glVertex3f(topR.x,topR.y,topR.z); + glVertex3f(botR.x,botR.y,botR.z); + glVertex3f(botL.x,botL.y,botL.z); +} \ No newline at end of file diff --git a/.history/src/Quad_20200512000121.cpp b/.history/src/Quad_20200512000121.cpp new file mode 100644 index 0000000..121dbd9 --- /dev/null +++ b/.history/src/Quad_20200512000121.cpp @@ -0,0 +1,22 @@ +#include "Quad.h" + +Quad::Quad(Vertex topL, Vertex topR, Vertex botR, Vertex botL) { + this->topL=topL; + this->topR=topR; + this->botR=botR; + this->botL=botL; +} + +Quad::Quad() {} + +void Quad::setColor(myColor c) { + this->color=c; +} + +void Quad::render() { + glColor4f(color.r,color.g,color.b,color.a); + glVertex3f(topL.x,topL.y,topL.z); + glVertex3f(topR.x,topR.y,topR.z); + glVertex3f(botR.x,botR.y,botR.z); + glVertex3f(botL.x,botL.y,botL.z); +} \ No newline at end of file diff --git a/.history/src/Quad_20200512000128.h b/.history/src/Quad_20200512000128.h new file mode 100644 index 0000000..fe8a2f8 --- /dev/null +++ b/.history/src/Quad_20200512000128.h @@ -0,0 +1,13 @@ +#include "Color.h" +#include "Vertex.h" +#include + +class Quad { + public: + Color color; + Vertex topL,topR,botR,botL; + Quad(Vertex topL, Vertex topR, Vertex botR, Vertex botL); + Quad(); + void setColor(myColor c); + void render(); +}; \ No newline at end of file diff --git a/.history/src/Quad_20200512000132.h b/.history/src/Quad_20200512000132.h new file mode 100644 index 0000000..fe8a2f8 --- /dev/null +++ b/.history/src/Quad_20200512000132.h @@ -0,0 +1,13 @@ +#include "Color.h" +#include "Vertex.h" +#include + +class Quad { + public: + Color color; + Vertex topL,topR,botR,botL; + Quad(Vertex topL, Vertex topR, Vertex botR, Vertex botL); + Quad(); + void setColor(myColor c); + void render(); +}; \ No newline at end of file diff --git a/.history/src/Quad_20200512000134.h b/.history/src/Quad_20200512000134.h new file mode 100644 index 0000000..fe8a2f8 --- /dev/null +++ b/.history/src/Quad_20200512000134.h @@ -0,0 +1,13 @@ +#include "Color.h" +#include "Vertex.h" +#include + +class Quad { + public: + Color color; + Vertex topL,topR,botR,botL; + Quad(Vertex topL, Vertex topR, Vertex botR, Vertex botL); + Quad(); + void setColor(myColor c); + void render(); +}; \ No newline at end of file diff --git a/.history/src/Quad_20200512000139.h b/.history/src/Quad_20200512000139.h new file mode 100644 index 0000000..c2b2a05 --- /dev/null +++ b/.history/src/Quad_20200512000139.h @@ -0,0 +1,13 @@ +#include "Color.h" +#include "Vertex.h" +#include + +class Quad { + public: + myColor color; + Vertex topL,topR,botR,botL; + Quad(Vertex topL, Vertex topR, Vertex botR, Vertex botL); + Quad(); + void setColor(myColor c); + void render(); +}; \ No newline at end of file diff --git a/.history/src/Quad_20200512010256.cpp b/.history/src/Quad_20200512010256.cpp new file mode 100644 index 0000000..04973df --- /dev/null +++ b/.history/src/Quad_20200512010256.cpp @@ -0,0 +1,23 @@ +#include "Quad.h" + +Quad::Quad(Vertex topL, Vertex topR, Vertex botR, Vertex botL) { + this->topL=topL; + this->topR=topR; + this->botR=botR; + this->botL=botL; +} + +Quad::Quad() {} + +void Quad::setColor(myColor c) { + this->color=c; +} + +void Quad::render() { + printf("Rendering quad"); + glColor4f(color.r,color.g,color.b,color.a); + glVertex3f(topL.x,topL.y,topL.z); + glVertex3f(topR.x,topR.y,topR.z); + glVertex3f(botR.x,botR.y,botR.z); + glVertex3f(botL.x,botL.y,botL.z); +} \ No newline at end of file diff --git a/.history/src/Quad_20200512010259.cpp b/.history/src/Quad_20200512010259.cpp new file mode 100644 index 0000000..04973df --- /dev/null +++ b/.history/src/Quad_20200512010259.cpp @@ -0,0 +1,23 @@ +#include "Quad.h" + +Quad::Quad(Vertex topL, Vertex topR, Vertex botR, Vertex botL) { + this->topL=topL; + this->topR=topR; + this->botR=botR; + this->botL=botL; +} + +Quad::Quad() {} + +void Quad::setColor(myColor c) { + this->color=c; +} + +void Quad::render() { + printf("Rendering quad"); + glColor4f(color.r,color.g,color.b,color.a); + glVertex3f(topL.x,topL.y,topL.z); + glVertex3f(topR.x,topR.y,topR.z); + glVertex3f(botR.x,botR.y,botR.z); + glVertex3f(botL.x,botL.y,botL.z); +} \ No newline at end of file diff --git a/.history/src/Quad_20200512010312.cpp b/.history/src/Quad_20200512010312.cpp new file mode 100644 index 0000000..c6eb1bf --- /dev/null +++ b/.history/src/Quad_20200512010312.cpp @@ -0,0 +1,24 @@ +#include "Quad.h" +#include + +Quad::Quad(Vertex topL, Vertex topR, Vertex botR, Vertex botL) { + this->topL=topL; + this->topR=topR; + this->botR=botR; + this->botL=botL; +} + +Quad::Quad() {} + +void Quad::setColor(myColor c) { + this->color=c; +} + +void Quad::render() { + printf("Rendering quad"); + glColor4f(color.r,color.g,color.b,color.a); + glVertex3f(topL.x,topL.y,topL.z); + glVertex3f(topR.x,topR.y,topR.z); + glVertex3f(botR.x,botR.y,botR.z); + glVertex3f(botL.x,botL.y,botL.z); +} \ No newline at end of file diff --git a/.history/src/Quad_20200512010331.cpp b/.history/src/Quad_20200512010331.cpp new file mode 100644 index 0000000..3092d4a --- /dev/null +++ b/.history/src/Quad_20200512010331.cpp @@ -0,0 +1,24 @@ +#include "Quad.h" +#include + +Quad::Quad(Vertex topL, Vertex topR, Vertex botR, Vertex botL) { + this->topL=topL; + this->topR=topR; + this->botR=botR; + this->botL=botL; +} + +Quad::Quad() {} + +void Quad::setColor(myColor c) { + this->color=c; +} + +void Quad::render() { + printf("Rendering quad\n"); + glColor4f(color.r,color.g,color.b,color.a); + glVertex3f(topL.x,topL.y,topL.z); + glVertex3f(topR.x,topR.y,topR.z); + glVertex3f(botR.x,botR.y,botR.z); + glVertex3f(botL.x,botL.y,botL.z); +} \ No newline at end of file diff --git a/.history/src/Quad_20200512010514.cpp b/.history/src/Quad_20200512010514.cpp new file mode 100644 index 0000000..2134b11 --- /dev/null +++ b/.history/src/Quad_20200512010514.cpp @@ -0,0 +1,23 @@ +#include "Quad.h" +#include + +Quad::Quad(Vertex topL, Vertex topR, Vertex botR, Vertex botL) { + this->topL=topL; + this->topR=topR; + this->botR=botR; + this->botL=botL; +} + +Quad::Quad() {} + +void Quad::setColor(myColor c) { + this->color=c; +} + +void Quad::render() { + glColor4f(color.r,color.g,color.b,color.a); + glVertex3f(topL.x,topL.y,topL.z); + glVertex3f(topR.x,topR.y,topR.z); + glVertex3f(botR.x,botR.y,botR.z); + glVertex3f(botL.x,botL.y,botL.z); +} \ No newline at end of file diff --git a/.history/src/Vertex_20200511171556.h b/.history/src/Vertex_20200511171556.h new file mode 100644 index 0000000..e69de29 diff --git a/.history/src/Vertex_20200511171606.h b/.history/src/Vertex_20200511171606.h new file mode 100644 index 0000000..894e508 --- /dev/null +++ b/.history/src/Vertex_20200511171606.h @@ -0,0 +1,4 @@ +class Vertex { + public: + float x,y,z; +}; \ No newline at end of file diff --git a/.history/src/Vertex_20200511172125.h b/.history/src/Vertex_20200511172125.h new file mode 100644 index 0000000..a38ae7b --- /dev/null +++ b/.history/src/Vertex_20200511172125.h @@ -0,0 +1,9 @@ +class Vertex { + public: + float x,y,z; + Vertex(float x, float y, float z) { + this->x=x; + this->y=y; + this->z=z; + } +}; \ No newline at end of file diff --git a/.history/src/Vertex_20200511172637.h b/.history/src/Vertex_20200511172637.h new file mode 100644 index 0000000..a38ae7b --- /dev/null +++ b/.history/src/Vertex_20200511172637.h @@ -0,0 +1,9 @@ +class Vertex { + public: + float x,y,z; + Vertex(float x, float y, float z) { + this->x=x; + this->y=y; + this->z=z; + } +}; \ No newline at end of file diff --git a/.history/src/Vertex_20200511180436.h b/.history/src/Vertex_20200511180436.h new file mode 100644 index 0000000..31c98b9 --- /dev/null +++ b/.history/src/Vertex_20200511180436.h @@ -0,0 +1,10 @@ +class Vertex { + public: + float x,y,z; + Vertex(); + Vertex(float x, float y, float z) { + this->x=x; + this->y=y; + this->z=z; + } +}; \ No newline at end of file diff --git a/.history/src/Vertex_20200511220207.cpp b/.history/src/Vertex_20200511220207.cpp new file mode 100644 index 0000000..e69de29 diff --git a/.history/src/Vertex_20200511220407.cpp b/.history/src/Vertex_20200511220407.cpp new file mode 100644 index 0000000..77d49cb --- /dev/null +++ b/.history/src/Vertex_20200511220407.cpp @@ -0,0 +1,7 @@ +#include "Vertex.h" + +Vertex::Vertex(float x, float y, float z) { + this->x=x; + this->y=y; + this->z=z; +} \ No newline at end of file diff --git a/.history/src/Vertex_20200511220725.cpp b/.history/src/Vertex_20200511220725.cpp new file mode 100644 index 0000000..b95d28f --- /dev/null +++ b/.history/src/Vertex_20200511220725.cpp @@ -0,0 +1,9 @@ +#include "Vertex.h" + +Vertex::Vertex(float x, float y, float z) { + this->x=x; + this->y=y; + this->z=z; +} + +Vertex::Vertex() {} \ No newline at end of file diff --git a/.history/src/Vertex_20200511220729.h b/.history/src/Vertex_20200511220729.h new file mode 100644 index 0000000..51c0c21 --- /dev/null +++ b/.history/src/Vertex_20200511220729.h @@ -0,0 +1,6 @@ +class Vertex { + public: + float x,y,z; + Vertex(); + Vertex(float x, float y, float z); +}; \ No newline at end of file diff --git a/.history/src/Vertex_20200511220731.cpp b/.history/src/Vertex_20200511220731.cpp new file mode 100644 index 0000000..b95d28f --- /dev/null +++ b/.history/src/Vertex_20200511220731.cpp @@ -0,0 +1,9 @@ +#include "Vertex.h" + +Vertex::Vertex(float x, float y, float z) { + this->x=x; + this->y=y; + this->z=z; +} + +Vertex::Vertex() {} \ No newline at end of file diff --git a/.history/src/Vertex_20200512010117.cpp b/.history/src/Vertex_20200512010117.cpp new file mode 100644 index 0000000..9b24af4 --- /dev/null +++ b/.history/src/Vertex_20200512010117.cpp @@ -0,0 +1,10 @@ +#include "Vertex.h" + +Vertex::Vertex(float x, float y, float z) { + this->x=x; + this->y=y; + this->z=z; + printf("Created a vertex at %f,%f,%f") +} + +Vertex::Vertex() {} \ No newline at end of file diff --git a/.history/src/Vertex_20200512010119.cpp b/.history/src/Vertex_20200512010119.cpp new file mode 100644 index 0000000..82485ec --- /dev/null +++ b/.history/src/Vertex_20200512010119.cpp @@ -0,0 +1,10 @@ +#include "Vertex.h" + +Vertex::Vertex(float x, float y, float z) { + this->x=x; + this->y=y; + this->z=z; + printf("Created a vertex at %f,%f,%f"); +} + +Vertex::Vertex() {} \ No newline at end of file diff --git a/.history/src/Vertex_20200512010126.cpp b/.history/src/Vertex_20200512010126.cpp new file mode 100644 index 0000000..1e14b9a --- /dev/null +++ b/.history/src/Vertex_20200512010126.cpp @@ -0,0 +1,10 @@ +#include "Vertex.h" + +Vertex::Vertex(float x, float y, float z) { + this->x=x; + this->y=y; + this->z=z; + printf("Created a vertex at %f,%f,%f",x,y,z); +} + +Vertex::Vertex() {} \ No newline at end of file diff --git a/.history/src/Vertex_20200512010150.cpp b/.history/src/Vertex_20200512010150.cpp new file mode 100644 index 0000000..c450d96 --- /dev/null +++ b/.history/src/Vertex_20200512010150.cpp @@ -0,0 +1,10 @@ +#include "Vertex.h" +#include +Vertex::Vertex(float x, float y, float z) { + this->x=x; + this->y=y; + this->z=z; + printf("Created a vertex at %f,%f,%f",x,y,z); +} + +Vertex::Vertex() {} \ No newline at end of file diff --git a/.history/src/Vertex_20200512010152.cpp b/.history/src/Vertex_20200512010152.cpp new file mode 100644 index 0000000..8c0592c --- /dev/null +++ b/.history/src/Vertex_20200512010152.cpp @@ -0,0 +1,11 @@ +#include "Vertex.h" +#include + +Vertex::Vertex(float x, float y, float z) { + this->x=x; + this->y=y; + this->z=z; + printf("Created a vertex at %f,%f,%f",x,y,z); +} + +Vertex::Vertex() {} \ No newline at end of file diff --git a/.history/src/Vertex_20200512010338.cpp b/.history/src/Vertex_20200512010338.cpp new file mode 100644 index 0000000..a2b8180 --- /dev/null +++ b/.history/src/Vertex_20200512010338.cpp @@ -0,0 +1,11 @@ +#include "Vertex.h" +#include + +Vertex::Vertex(float x, float y, float z) { + this->x=x; + this->y=y; + this->z=z; + printf("Created a vertex at %f,%f,%f\n",x,y,z); +} + +Vertex::Vertex() {} \ No newline at end of file diff --git a/.history/src/color_20200511171454.h b/.history/src/color_20200511171454.h new file mode 100644 index 0000000..e69de29 diff --git a/.history/src/color_20200511171508.h b/.history/src/color_20200511171508.h new file mode 100644 index 0000000..fce2787 --- /dev/null +++ b/.history/src/color_20200511171508.h @@ -0,0 +1,10 @@ +class Color { + public: + float r,g,b,a; + Color(float r,float g,float b,float a) { + this->r=r; + this->g=g; + this->b=b; + this->a=a; + } +}; \ No newline at end of file diff --git a/.history/src/gl_20200511140709.cpp b/.history/src/gl_20200511140709.cpp new file mode 100644 index 0000000..1868b29 --- /dev/null +++ b/.history/src/gl_20200511140709.cpp @@ -0,0 +1,38 @@ +#include +#include +#include +#include + +int main() { + //glewExperimental = true; + if(!glfwInit()) { + printf("[ERROR] Failed to initialize GLEW"); + return -1; + } + glfwWindowHint(GLFW_SAMPLES, 4); + glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); + glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 4); + glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); + glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); + + GLFWwindow *win; + win = glfwCreateWindow(400,400, "HydroSimulator", NULL, NULL); + if(win == NULL) { + printf("[ERROR] Could not create a glfw window"); + glfwTerminate(); + return -1; + } + glfwMakeContextCurrent(win); + glewExperimental=true; + if(glewInit() != GLEW_OK) { + printf("[ERROR] Failed to initialize GLEW"); + return -1; + } + + glfwSetInputMode(win, GLFW_STICKY_KEYS, GL_TRUE); + do { + glClear(GL_COLOR_BUFFER_BIT); + glfwSwapBuffers(win); + glfwPollEvents(); + } while(glfwGetKey(win, GLFW_KEY_ESCAPE) != GLFW_PRESS && glfwWindowShouldClose(win) == 0); +} diff --git a/.history/src/gl_20200511175144.cpp b/.history/src/gl_20200511175144.cpp new file mode 100644 index 0000000..1868b29 --- /dev/null +++ b/.history/src/gl_20200511175144.cpp @@ -0,0 +1,38 @@ +#include +#include +#include +#include + +int main() { + //glewExperimental = true; + if(!glfwInit()) { + printf("[ERROR] Failed to initialize GLEW"); + return -1; + } + glfwWindowHint(GLFW_SAMPLES, 4); + glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); + glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 4); + glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); + glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); + + GLFWwindow *win; + win = glfwCreateWindow(400,400, "HydroSimulator", NULL, NULL); + if(win == NULL) { + printf("[ERROR] Could not create a glfw window"); + glfwTerminate(); + return -1; + } + glfwMakeContextCurrent(win); + glewExperimental=true; + if(glewInit() != GLEW_OK) { + printf("[ERROR] Failed to initialize GLEW"); + return -1; + } + + glfwSetInputMode(win, GLFW_STICKY_KEYS, GL_TRUE); + do { + glClear(GL_COLOR_BUFFER_BIT); + glfwSwapBuffers(win); + glfwPollEvents(); + } while(glfwGetKey(win, GLFW_KEY_ESCAPE) != GLFW_PRESS && glfwWindowShouldClose(win) == 0); +} diff --git a/.history/src/main_20200511141624.cpp b/.history/src/main_20200511141624.cpp new file mode 100644 index 0000000..41d6a42 --- /dev/null +++ b/.history/src/main_20200511141624.cpp @@ -0,0 +1,120 @@ +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", gluErrorString(error)); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", gluErrorString(error)); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize the OpenGL clear color\n%s\n", gluErrorString(error)); + success = false; + } + return success; +} +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} +void update() { +} +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glBegin(GL_QUADS); + glVertex2f(-0.5,-0.5); + glVertex2f(0.5,-0.5); + glVertex2f(0.5,0.5); + glVertex2f(-0.5,0.5); + glEnd(); + } +} +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511144632.cpp b/.history/src/main_20200511144632.cpp new file mode 100644 index 0000000..41d6a42 --- /dev/null +++ b/.history/src/main_20200511144632.cpp @@ -0,0 +1,120 @@ +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", gluErrorString(error)); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", gluErrorString(error)); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize the OpenGL clear color\n%s\n", gluErrorString(error)); + success = false; + } + return success; +} +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} +void update() { +} +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glBegin(GL_QUADS); + glVertex2f(-0.5,-0.5); + glVertex2f(0.5,-0.5); + glVertex2f(0.5,0.5); + glVertex2f(-0.5,0.5); + glEnd(); + } +} +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511145101.cpp b/.history/src/main_20200511145101.cpp new file mode 100644 index 0000000..69d8710 --- /dev/null +++ b/.history/src/main_20200511145101.cpp @@ -0,0 +1,120 @@ +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", gluErrorString(error)); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", gluErrorString(error)); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize the OpenGL clear color\n%s\n", gluErrorString(error)); + success = false; + } + return success; +} +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} +void update() { +} +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glBegin(GL_QUADS); + glVertex2f(-0.5,-0.5); + glVertex2f(0.5,-0.5); + glVertex2f(0.5,0.5); + glVertex2f(-0.5,0.5); + glEnd(); + } +} +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511150605.cpp b/.history/src/main_20200511150605.cpp new file mode 100644 index 0000000..69d8710 --- /dev/null +++ b/.history/src/main_20200511150605.cpp @@ -0,0 +1,120 @@ +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", gluErrorString(error)); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", gluErrorString(error)); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize the OpenGL clear color\n%s\n", gluErrorString(error)); + success = false; + } + return success; +} +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} +void update() { +} +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glBegin(GL_QUADS); + glVertex2f(-0.5,-0.5); + glVertex2f(0.5,-0.5); + glVertex2f(0.5,0.5); + glVertex2f(-0.5,0.5); + glEnd(); + } +} +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511151949.cpp b/.history/src/main_20200511151949.cpp new file mode 100644 index 0000000..69d8710 --- /dev/null +++ b/.history/src/main_20200511151949.cpp @@ -0,0 +1,120 @@ +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", gluErrorString(error)); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", gluErrorString(error)); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize the OpenGL clear color\n%s\n", gluErrorString(error)); + success = false; + } + return success; +} +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} +void update() { +} +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glBegin(GL_QUADS); + glVertex2f(-0.5,-0.5); + glVertex2f(0.5,-0.5); + glVertex2f(0.5,0.5); + glVertex2f(-0.5,0.5); + glEnd(); + } +} +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511152157.cpp b/.history/src/main_20200511152157.cpp new file mode 100644 index 0000000..88dabb5 --- /dev/null +++ b/.history/src/main_20200511152157.cpp @@ -0,0 +1,120 @@ +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", gluErrorString(error)); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", gluErrorString(error)); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize the OpenGL clear color\n%s\n", gluErrorString(error)); + success = false; + } + return success; +} +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} +void update() { +} +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glBegin(GL_QUADS); + glVertex3f(1.0f,1.0f,-1.0f); + glVertex(-1.0f,1.0f,-1.0f); + glVertex2f(0.5,0.5); + glVertex2f(-0.5,0.5); + glEnd(); + } +} +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511152206.cpp b/.history/src/main_20200511152206.cpp new file mode 100644 index 0000000..84b33ca --- /dev/null +++ b/.history/src/main_20200511152206.cpp @@ -0,0 +1,120 @@ +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", gluErrorString(error)); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", gluErrorString(error)); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize the OpenGL clear color\n%s\n", gluErrorString(error)); + success = false; + } + return success; +} +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} +void update() { +} +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glBegin(GL_QUADS); + glVertex3f(1.0f,1.0f,-1.0f); + glVertex3f(-1.0f,1.0f,-1.0f); + glVertex2f(0.5,0.5); + glVertex2f(-0.5,0.5); + glEnd(); + } +} +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511152249.cpp b/.history/src/main_20200511152249.cpp new file mode 100644 index 0000000..3cbc9b8 --- /dev/null +++ b/.history/src/main_20200511152249.cpp @@ -0,0 +1,120 @@ +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", gluErrorString(error)); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", gluErrorString(error)); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize the OpenGL clear color\n%s\n", gluErrorString(error)); + success = false; + } + return success; +} +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} +void update() { +} +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glBegin(GL_QUADS); + glVertex3f(1.0f,1.0f,-1.0f); + glVertex3f(-1.0f,1.0f,-1.0f); + glVertex3f(-1.0f,1.0f,1.0f); + glVertex3f(1.0f,1.0f,1.0f); + glEnd(); + } +} +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511152326.cpp b/.history/src/main_20200511152326.cpp new file mode 100644 index 0000000..5ccf81f --- /dev/null +++ b/.history/src/main_20200511152326.cpp @@ -0,0 +1,121 @@ +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", gluErrorString(error)); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", gluErrorString(error)); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize the OpenGL clear color\n%s\n", gluErrorString(error)); + success = false; + } + return success; +} +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} +void update() { +} +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glBegin(GL_QUADS); + glColor3f(0.0f,1.0f,0.0f); + glVertex3f(1.0f,1.0f,-1.0f); + glVertex3f(-1.0f,1.0f,-1.0f); + glVertex3f(-1.0f,1.0f,1.0f); + glVertex3f(1.0f,1.0f,1.0f); + glEnd(); + } +} +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511152538.cpp b/.history/src/main_20200511152538.cpp new file mode 100644 index 0000000..b300ebb --- /dev/null +++ b/.history/src/main_20200511152538.cpp @@ -0,0 +1,156 @@ +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", gluErrorString(error)); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", gluErrorString(error)); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize the OpenGL clear color\n%s\n", gluErrorString(error)); + success = false; + } + return success; +} +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} +void update() { +} +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glBegin(GL_QUADS); + glColor3f(0.0f, 1.0f, 0.0f); // Green + glVertex3f( 1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f( 1.0f, 1.0f, 1.0f); + + // Bottom face (y = -1.0f) + glColor3f(1.0f, 0.5f, 0.0f); // Orange + glVertex3f( 1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f( 1.0f, -1.0f, -1.0f); + + // Front face (z = 1.0f) + glColor3f(1.0f, 0.0f, 0.0f); // Red + glVertex3f( 1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f( 1.0f, -1.0f, 1.0f); + + // Back face (z = -1.0f) + glColor3f(1.0f, 1.0f, 0.0f); // Yellow + glVertex3f( 1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f( 1.0f, 1.0f, -1.0f); + + // Left face (x = -1.0f) + glColor3f(0.0f, 0.0f, 1.0f); // Blue + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + + // Right face (x = 1.0f) + glColor3f(1.0f, 0.0f, 1.0f); // Magenta + glVertex3f(1.0f, 1.0f, -1.0f); + glVertex3f(1.0f, 1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, -1.0f); + glEnd(); + } +} +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511152716.cpp b/.history/src/main_20200511152716.cpp new file mode 100644 index 0000000..f875230 --- /dev/null +++ b/.history/src/main_20200511152716.cpp @@ -0,0 +1,151 @@ +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", gluErrorString(error)); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", gluErrorString(error)); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize the OpenGL clear color\n%s\n", gluErrorString(error)); + success = false; + } + return success; +} +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} +void update() { +} +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glBegin(GL_QUADS); + glColor3f(0.0f, 1.0f, 0.0f);//green + glVertex3f( 1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f( 1.0f, 1.0f, 1.0f); + + glColor3f(1.0f, 0.5f, 0.0f);// Orange + glVertex3f( 1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f( 1.0f, -1.0f, -1.0f); + + glColor3f(1.0f, 0.0f, 0.0f);// Red + glVertex3f( 1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f( 1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 1.0f, 0.0f);// Yellow + glVertex3f( 1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f( 1.0f, 1.0f, -1.0f); + + glColor3f(0.0f, 0.0f, 1.0f);// Blue + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 0.0f, 1.0f);// Magenta + glVertex3f(1.0f, 1.0f, -1.0f); + glVertex3f(1.0f, 1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, -1.0f); + glEnd(); + } +} +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511152836.cpp b/.history/src/main_20200511152836.cpp new file mode 100644 index 0000000..4a8e98c --- /dev/null +++ b/.history/src/main_20200511152836.cpp @@ -0,0 +1,152 @@ +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", gluErrorString(error)); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", gluErrorString(error)); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize the OpenGL clear color\n%s\n", gluErrorString(error)); + success = false; + } + return success; +} +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} +void update() { +} +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glTranslatef(1.5f,0.0f,-7.0f); + glBegin(GL_QUADS); + glColor3f(0.0f, 1.0f, 0.0f);//green + glVertex3f( 1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f( 1.0f, 1.0f, 1.0f); + + glColor3f(1.0f, 0.5f, 0.0f);// Orange + glVertex3f( 1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f( 1.0f, -1.0f, -1.0f); + + glColor3f(1.0f, 0.0f, 0.0f);// Red + glVertex3f( 1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f( 1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 1.0f, 0.0f);// Yellow + glVertex3f( 1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f( 1.0f, 1.0f, -1.0f); + + glColor3f(0.0f, 0.0f, 1.0f);// Blue + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 0.0f, 1.0f);// Magenta + glVertex3f(1.0f, 1.0f, -1.0f); + glVertex3f(1.0f, 1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, -1.0f); + glEnd(); + } +} +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511152956.cpp b/.history/src/main_20200511152956.cpp new file mode 100644 index 0000000..3d6176c --- /dev/null +++ b/.history/src/main_20200511152956.cpp @@ -0,0 +1,152 @@ +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", gluErrorString(error)); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", gluErrorString(error)); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize the OpenGL clear color\n%s\n", gluErrorString(error)); + success = false; + } + return success; +} +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} +void update() { +} +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glTranslatef(0.0f,1.0f,0.0f); + glBegin(GL_QUADS); + glColor3f(0.0f, 1.0f, 0.0f);//green + glVertex3f( 1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f( 1.0f, 1.0f, 1.0f); + + glColor3f(1.0f, 0.5f, 0.0f);// Orange + glVertex3f( 1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f( 1.0f, -1.0f, -1.0f); + + glColor3f(1.0f, 0.0f, 0.0f);// Red + glVertex3f( 1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f( 1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 1.0f, 0.0f);// Yellow + glVertex3f( 1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f( 1.0f, 1.0f, -1.0f); + + glColor3f(0.0f, 0.0f, 1.0f);// Blue + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 0.0f, 1.0f);// Magenta + glVertex3f(1.0f, 1.0f, -1.0f); + glVertex3f(1.0f, 1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, -1.0f); + glEnd(); + } +} +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511153000.cpp b/.history/src/main_20200511153000.cpp new file mode 100644 index 0000000..fde2e6a --- /dev/null +++ b/.history/src/main_20200511153000.cpp @@ -0,0 +1,152 @@ +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", gluErrorString(error)); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", gluErrorString(error)); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize the OpenGL clear color\n%s\n", gluErrorString(error)); + success = false; + } + return success; +} +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} +void update() { +} +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glTranslatef(0.0f,0.5f,0.0f); + glBegin(GL_QUADS); + glColor3f(0.0f, 1.0f, 0.0f);//green + glVertex3f( 1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f( 1.0f, 1.0f, 1.0f); + + glColor3f(1.0f, 0.5f, 0.0f);// Orange + glVertex3f( 1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f( 1.0f, -1.0f, -1.0f); + + glColor3f(1.0f, 0.0f, 0.0f);// Red + glVertex3f( 1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f( 1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 1.0f, 0.0f);// Yellow + glVertex3f( 1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f( 1.0f, 1.0f, -1.0f); + + glColor3f(0.0f, 0.0f, 1.0f);// Blue + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 0.0f, 1.0f);// Magenta + glVertex3f(1.0f, 1.0f, -1.0f); + glVertex3f(1.0f, 1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, -1.0f); + glEnd(); + } +} +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511153143.cpp b/.history/src/main_20200511153143.cpp new file mode 100644 index 0000000..f847ecb --- /dev/null +++ b/.history/src/main_20200511153143.cpp @@ -0,0 +1,152 @@ +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", gluErrorString(error)); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", gluErrorString(error)); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize the OpenGL clear color\n%s\n", gluErrorString(error)); + success = false; + } + return success; +} +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} +void update() { +} +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glTranslatef(0.0f,-0.5f,0.0f); + glBegin(GL_QUADS); + glColor3f(0.0f, 1.0f, 0.0f);//green + glVertex3f( 1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f( 1.0f, 1.0f, 1.0f); + + glColor3f(1.0f, 0.5f, 0.0f);// Orange + glVertex3f( 1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f( 1.0f, -1.0f, -1.0f); + + glColor3f(1.0f, 0.0f, 0.0f);// Red + glVertex3f( 1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f( 1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 1.0f, 0.0f);// Yellow + glVertex3f( 1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f( 1.0f, 1.0f, -1.0f); + + glColor3f(0.0f, 0.0f, 1.0f);// Blue + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 0.0f, 1.0f);// Magenta + glVertex3f(1.0f, 1.0f, -1.0f); + glVertex3f(1.0f, 1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, -1.0f); + glEnd(); + } +} +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511153153.cpp b/.history/src/main_20200511153153.cpp new file mode 100644 index 0000000..fde2e6a --- /dev/null +++ b/.history/src/main_20200511153153.cpp @@ -0,0 +1,152 @@ +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", gluErrorString(error)); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", gluErrorString(error)); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize the OpenGL clear color\n%s\n", gluErrorString(error)); + success = false; + } + return success; +} +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} +void update() { +} +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glTranslatef(0.0f,0.5f,0.0f); + glBegin(GL_QUADS); + glColor3f(0.0f, 1.0f, 0.0f);//green + glVertex3f( 1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f( 1.0f, 1.0f, 1.0f); + + glColor3f(1.0f, 0.5f, 0.0f);// Orange + glVertex3f( 1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f( 1.0f, -1.0f, -1.0f); + + glColor3f(1.0f, 0.0f, 0.0f);// Red + glVertex3f( 1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f( 1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 1.0f, 0.0f);// Yellow + glVertex3f( 1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f( 1.0f, 1.0f, -1.0f); + + glColor3f(0.0f, 0.0f, 1.0f);// Blue + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 0.0f, 1.0f);// Magenta + glVertex3f(1.0f, 1.0f, -1.0f); + glVertex3f(1.0f, 1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, -1.0f); + glEnd(); + } +} +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511153206.cpp b/.history/src/main_20200511153206.cpp new file mode 100644 index 0000000..1de001f --- /dev/null +++ b/.history/src/main_20200511153206.cpp @@ -0,0 +1,152 @@ +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", gluErrorString(error)); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", gluErrorString(error)); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize the OpenGL clear color\n%s\n", gluErrorString(error)); + success = false; + } + return success; +} +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} +void update() { +} +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glTranslatef(0.5f,0.5f,0.5f); + glBegin(GL_QUADS); + glColor3f(0.0f, 1.0f, 0.0f);//green + glVertex3f( 1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f( 1.0f, 1.0f, 1.0f); + + glColor3f(1.0f, 0.5f, 0.0f);// Orange + glVertex3f( 1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f( 1.0f, -1.0f, -1.0f); + + glColor3f(1.0f, 0.0f, 0.0f);// Red + glVertex3f( 1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f( 1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 1.0f, 0.0f);// Yellow + glVertex3f( 1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f( 1.0f, 1.0f, -1.0f); + + glColor3f(0.0f, 0.0f, 1.0f);// Blue + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 0.0f, 1.0f);// Magenta + glVertex3f(1.0f, 1.0f, -1.0f); + glVertex3f(1.0f, 1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, -1.0f); + glEnd(); + } +} +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511153351.cpp b/.history/src/main_20200511153351.cpp new file mode 100644 index 0000000..420f8d9 --- /dev/null +++ b/.history/src/main_20200511153351.cpp @@ -0,0 +1,153 @@ +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", gluErrorString(error)); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", gluErrorString(error)); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize the OpenGL clear color\n%s\n", gluErrorString(error)); + success = false; + } + return success; +} +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} +void update() { +} +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.5f,0.5f,0.5f); + glBegin(GL_QUADS); + glColor3f(0.0f, 1.0f, 0.0f);//green + glVertex3f( 1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f( 1.0f, 1.0f, 1.0f); + + glColor3f(1.0f, 0.5f, 0.0f);// Orange + glVertex3f( 1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f( 1.0f, -1.0f, -1.0f); + + glColor3f(1.0f, 0.0f, 0.0f);// Red + glVertex3f( 1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f( 1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 1.0f, 0.0f);// Yellow + glVertex3f( 1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f( 1.0f, 1.0f, -1.0f); + + glColor3f(0.0f, 0.0f, 1.0f);// Blue + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 0.0f, 1.0f);// Magenta + glVertex3f(1.0f, 1.0f, -1.0f); + glVertex3f(1.0f, 1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, -1.0f); + glEnd(); + } +} +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511153439.cpp b/.history/src/main_20200511153439.cpp new file mode 100644 index 0000000..a0e5ed0 --- /dev/null +++ b/.history/src/main_20200511153439.cpp @@ -0,0 +1,153 @@ +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", gluErrorString(error)); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", gluErrorString(error)); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize the OpenGL clear color\n%s\n", gluErrorString(error)); + success = false; + } + return success; +} +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} +void update() { +} +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.5f,0.0f,0.0f); + glBegin(GL_QUADS); + glColor3f(0.0f, 1.0f, 0.0f);//green + glVertex3f( 1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f( 1.0f, 1.0f, 1.0f); + + glColor3f(1.0f, 0.5f, 0.0f);// Orange + glVertex3f( 1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f( 1.0f, -1.0f, -1.0f); + + glColor3f(1.0f, 0.0f, 0.0f);// Red + glVertex3f( 1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f( 1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 1.0f, 0.0f);// Yellow + glVertex3f( 1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f( 1.0f, 1.0f, -1.0f); + + glColor3f(0.0f, 0.0f, 1.0f);// Blue + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 0.0f, 1.0f);// Magenta + glVertex3f(1.0f, 1.0f, -1.0f); + glVertex3f(1.0f, 1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, -1.0f); + glEnd(); + } +} +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511153501.cpp b/.history/src/main_20200511153501.cpp new file mode 100644 index 0000000..55325fe --- /dev/null +++ b/.history/src/main_20200511153501.cpp @@ -0,0 +1,153 @@ +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", gluErrorString(error)); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", gluErrorString(error)); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize the OpenGL clear color\n%s\n", gluErrorString(error)); + success = false; + } + return success; +} +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} +void update() { +} +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.3f,0.0f,0.0f); + glBegin(GL_QUADS); + glColor3f(0.0f, 1.0f, 0.0f);//green + glVertex3f( 1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f( 1.0f, 1.0f, 1.0f); + + glColor3f(1.0f, 0.5f, 0.0f);// Orange + glVertex3f( 1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f( 1.0f, -1.0f, -1.0f); + + glColor3f(1.0f, 0.0f, 0.0f);// Red + glVertex3f( 1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f( 1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 1.0f, 0.0f);// Yellow + glVertex3f( 1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f( 1.0f, 1.0f, -1.0f); + + glColor3f(0.0f, 0.0f, 1.0f);// Blue + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 0.0f, 1.0f);// Magenta + glVertex3f(1.0f, 1.0f, -1.0f); + glVertex3f(1.0f, 1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, -1.0f); + glEnd(); + } +} +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511153512.cpp b/.history/src/main_20200511153512.cpp new file mode 100644 index 0000000..cf79207 --- /dev/null +++ b/.history/src/main_20200511153512.cpp @@ -0,0 +1,153 @@ +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", gluErrorString(error)); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", gluErrorString(error)); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize the OpenGL clear color\n%s\n", gluErrorString(error)); + success = false; + } + return success; +} +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} +void update() { +} +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(1.0f,0.0f,0.0f); + glBegin(GL_QUADS); + glColor3f(0.0f, 1.0f, 0.0f);//green + glVertex3f( 1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f( 1.0f, 1.0f, 1.0f); + + glColor3f(1.0f, 0.5f, 0.0f);// Orange + glVertex3f( 1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f( 1.0f, -1.0f, -1.0f); + + glColor3f(1.0f, 0.0f, 0.0f);// Red + glVertex3f( 1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f( 1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 1.0f, 0.0f);// Yellow + glVertex3f( 1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f( 1.0f, 1.0f, -1.0f); + + glColor3f(0.0f, 0.0f, 1.0f);// Blue + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 0.0f, 1.0f);// Magenta + glVertex3f(1.0f, 1.0f, -1.0f); + glVertex3f(1.0f, 1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, -1.0f); + glEnd(); + } +} +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511153525.cpp b/.history/src/main_20200511153525.cpp new file mode 100644 index 0000000..f4e0325 --- /dev/null +++ b/.history/src/main_20200511153525.cpp @@ -0,0 +1,153 @@ +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", gluErrorString(error)); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", gluErrorString(error)); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize the OpenGL clear color\n%s\n", gluErrorString(error)); + success = false; + } + return success; +} +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} +void update() { +} +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + glBegin(GL_QUADS); + glColor3f(0.0f, 1.0f, 0.0f);//green + glVertex3f( 1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f( 1.0f, 1.0f, 1.0f); + + glColor3f(1.0f, 0.5f, 0.0f);// Orange + glVertex3f( 1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f( 1.0f, -1.0f, -1.0f); + + glColor3f(1.0f, 0.0f, 0.0f);// Red + glVertex3f( 1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f( 1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 1.0f, 0.0f);// Yellow + glVertex3f( 1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f( 1.0f, 1.0f, -1.0f); + + glColor3f(0.0f, 0.0f, 1.0f);// Blue + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 0.0f, 1.0f);// Magenta + glVertex3f(1.0f, 1.0f, -1.0f); + glVertex3f(1.0f, 1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, -1.0f); + glEnd(); + } +} +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511153527.cpp b/.history/src/main_20200511153527.cpp new file mode 100644 index 0000000..3e322ad --- /dev/null +++ b/.history/src/main_20200511153527.cpp @@ -0,0 +1,153 @@ +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", gluErrorString(error)); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", gluErrorString(error)); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize the OpenGL clear color\n%s\n", gluErrorString(error)); + success = false; + } + return success; +} +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} +void update() { +} +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,1.0f,0.0f); + glBegin(GL_QUADS); + glColor3f(0.0f, 1.0f, 0.0f);//green + glVertex3f( 1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f( 1.0f, 1.0f, 1.0f); + + glColor3f(1.0f, 0.5f, 0.0f);// Orange + glVertex3f( 1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f( 1.0f, -1.0f, -1.0f); + + glColor3f(1.0f, 0.0f, 0.0f);// Red + glVertex3f( 1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f( 1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 1.0f, 0.0f);// Yellow + glVertex3f( 1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f( 1.0f, 1.0f, -1.0f); + + glColor3f(0.0f, 0.0f, 1.0f);// Blue + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 0.0f, 1.0f);// Magenta + glVertex3f(1.0f, 1.0f, -1.0f); + glVertex3f(1.0f, 1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, -1.0f); + glEnd(); + } +} +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511153536.cpp b/.history/src/main_20200511153536.cpp new file mode 100644 index 0000000..f4e0325 --- /dev/null +++ b/.history/src/main_20200511153536.cpp @@ -0,0 +1,153 @@ +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", gluErrorString(error)); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", gluErrorString(error)); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize the OpenGL clear color\n%s\n", gluErrorString(error)); + success = false; + } + return success; +} +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} +void update() { +} +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + glBegin(GL_QUADS); + glColor3f(0.0f, 1.0f, 0.0f);//green + glVertex3f( 1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f( 1.0f, 1.0f, 1.0f); + + glColor3f(1.0f, 0.5f, 0.0f);// Orange + glVertex3f( 1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f( 1.0f, -1.0f, -1.0f); + + glColor3f(1.0f, 0.0f, 0.0f);// Red + glVertex3f( 1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f( 1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 1.0f, 0.0f);// Yellow + glVertex3f( 1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f( 1.0f, 1.0f, -1.0f); + + glColor3f(0.0f, 0.0f, 1.0f);// Blue + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 0.0f, 1.0f);// Magenta + glVertex3f(1.0f, 1.0f, -1.0f); + glVertex3f(1.0f, 1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, -1.0f); + glEnd(); + } +} +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511153539.cpp b/.history/src/main_20200511153539.cpp new file mode 100644 index 0000000..9c55e20 --- /dev/null +++ b/.history/src/main_20200511153539.cpp @@ -0,0 +1,153 @@ +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", gluErrorString(error)); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", gluErrorString(error)); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize the OpenGL clear color\n%s\n", gluErrorString(error)); + success = false; + } + return success; +} +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} +void update() { +} +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,1.0f); + glBegin(GL_QUADS); + glColor3f(0.0f, 1.0f, 0.0f);//green + glVertex3f( 1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f( 1.0f, 1.0f, 1.0f); + + glColor3f(1.0f, 0.5f, 0.0f);// Orange + glVertex3f( 1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f( 1.0f, -1.0f, -1.0f); + + glColor3f(1.0f, 0.0f, 0.0f);// Red + glVertex3f( 1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f( 1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 1.0f, 0.0f);// Yellow + glVertex3f( 1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f( 1.0f, 1.0f, -1.0f); + + glColor3f(0.0f, 0.0f, 1.0f);// Blue + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 0.0f, 1.0f);// Magenta + glVertex3f(1.0f, 1.0f, -1.0f); + glVertex3f(1.0f, 1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, -1.0f); + glEnd(); + } +} +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511153548.cpp b/.history/src/main_20200511153548.cpp new file mode 100644 index 0000000..2c9b4a4 --- /dev/null +++ b/.history/src/main_20200511153548.cpp @@ -0,0 +1,153 @@ +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", gluErrorString(error)); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", gluErrorString(error)); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize the OpenGL clear color\n%s\n", gluErrorString(error)); + success = false; + } + return success; +} +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} +void update() { +} +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,1.5f); + glBegin(GL_QUADS); + glColor3f(0.0f, 1.0f, 0.0f);//green + glVertex3f( 1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f( 1.0f, 1.0f, 1.0f); + + glColor3f(1.0f, 0.5f, 0.0f);// Orange + glVertex3f( 1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f( 1.0f, -1.0f, -1.0f); + + glColor3f(1.0f, 0.0f, 0.0f);// Red + glVertex3f( 1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f( 1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 1.0f, 0.0f);// Yellow + glVertex3f( 1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f( 1.0f, 1.0f, -1.0f); + + glColor3f(0.0f, 0.0f, 1.0f);// Blue + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 0.0f, 1.0f);// Magenta + glVertex3f(1.0f, 1.0f, -1.0f); + glVertex3f(1.0f, 1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, -1.0f); + glEnd(); + } +} +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511153600.cpp b/.history/src/main_20200511153600.cpp new file mode 100644 index 0000000..bcb10fd --- /dev/null +++ b/.history/src/main_20200511153600.cpp @@ -0,0 +1,153 @@ +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", gluErrorString(error)); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", gluErrorString(error)); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize the OpenGL clear color\n%s\n", gluErrorString(error)); + success = false; + } + return success; +} +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} +void update() { +} +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.2f); + glBegin(GL_QUADS); + glColor3f(0.0f, 1.0f, 0.0f);//green + glVertex3f( 1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f( 1.0f, 1.0f, 1.0f); + + glColor3f(1.0f, 0.5f, 0.0f);// Orange + glVertex3f( 1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f( 1.0f, -1.0f, -1.0f); + + glColor3f(1.0f, 0.0f, 0.0f);// Red + glVertex3f( 1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f( 1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 1.0f, 0.0f);// Yellow + glVertex3f( 1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f( 1.0f, 1.0f, -1.0f); + + glColor3f(0.0f, 0.0f, 1.0f);// Blue + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 0.0f, 1.0f);// Magenta + glVertex3f(1.0f, 1.0f, -1.0f); + glVertex3f(1.0f, 1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, -1.0f); + glEnd(); + } +} +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511153617.cpp b/.history/src/main_20200511153617.cpp new file mode 100644 index 0000000..a926795 --- /dev/null +++ b/.history/src/main_20200511153617.cpp @@ -0,0 +1,154 @@ +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", gluErrorString(error)); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", gluErrorString(error)); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize the OpenGL clear color\n%s\n", gluErrorString(error)); + success = false; + } + return success; +} +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} +void update() { +} +int scale = 0; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.2f); + glBegin(GL_QUADS); + glColor3f(0.0f, 1.0f, 0.0f);//green + glVertex3f( 1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f( 1.0f, 1.0f, 1.0f); + + glColor3f(1.0f, 0.5f, 0.0f);// Orange + glVertex3f( 1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f( 1.0f, -1.0f, -1.0f); + + glColor3f(1.0f, 0.0f, 0.0f);// Red + glVertex3f( 1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f( 1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 1.0f, 0.0f);// Yellow + glVertex3f( 1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f( 1.0f, 1.0f, -1.0f); + + glColor3f(0.0f, 0.0f, 1.0f);// Blue + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 0.0f, 1.0f);// Magenta + glVertex3f(1.0f, 1.0f, -1.0f); + glVertex3f(1.0f, 1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, -1.0f); + glEnd(); + } +} +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511153630.cpp b/.history/src/main_20200511153630.cpp new file mode 100644 index 0000000..ebcf6b3 --- /dev/null +++ b/.history/src/main_20200511153630.cpp @@ -0,0 +1,154 @@ +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", gluErrorString(error)); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", gluErrorString(error)); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize the OpenGL clear color\n%s\n", gluErrorString(error)); + success = false; + } + return success; +} +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} +void update() { +} +float scale = 0; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,); + glBegin(GL_QUADS); + glColor3f(0.0f, 1.0f, 0.0f);//green + glVertex3f( 1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f( 1.0f, 1.0f, 1.0f); + + glColor3f(1.0f, 0.5f, 0.0f);// Orange + glVertex3f( 1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f( 1.0f, -1.0f, -1.0f); + + glColor3f(1.0f, 0.0f, 0.0f);// Red + glVertex3f( 1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f( 1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 1.0f, 0.0f);// Yellow + glVertex3f( 1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f( 1.0f, 1.0f, -1.0f); + + glColor3f(0.0f, 0.0f, 1.0f);// Blue + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 0.0f, 1.0f);// Magenta + glVertex3f(1.0f, 1.0f, -1.0f); + glVertex3f(1.0f, 1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, -1.0f); + glEnd(); + } +} +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511153654.cpp b/.history/src/main_20200511153654.cpp new file mode 100644 index 0000000..055ac49 --- /dev/null +++ b/.history/src/main_20200511153654.cpp @@ -0,0 +1,155 @@ +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", gluErrorString(error)); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", gluErrorString(error)); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize the OpenGL clear color\n%s\n", gluErrorString(error)); + success = false; + } + return success; +} +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} +void update() { +} +float scale = 0.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,scale); + scale+=0.01f + glBegin(GL_QUADS); + glColor3f(0.0f, 1.0f, 0.0f);//green + glVertex3f( 1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f( 1.0f, 1.0f, 1.0f); + + glColor3f(1.0f, 0.5f, 0.0f);// Orange + glVertex3f( 1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f( 1.0f, -1.0f, -1.0f); + + glColor3f(1.0f, 0.0f, 0.0f);// Red + glVertex3f( 1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f( 1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 1.0f, 0.0f);// Yellow + glVertex3f( 1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f( 1.0f, 1.0f, -1.0f); + + glColor3f(0.0f, 0.0f, 1.0f);// Blue + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 0.0f, 1.0f);// Magenta + glVertex3f(1.0f, 1.0f, -1.0f); + glVertex3f(1.0f, 1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, -1.0f); + glEnd(); + } +} +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511153655.cpp b/.history/src/main_20200511153655.cpp new file mode 100644 index 0000000..599aa85 --- /dev/null +++ b/.history/src/main_20200511153655.cpp @@ -0,0 +1,155 @@ +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", gluErrorString(error)); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", gluErrorString(error)); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize the OpenGL clear color\n%s\n", gluErrorString(error)); + success = false; + } + return success; +} +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} +void update() { +} +float scale = 0.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,scale); + scale+=0.01f; + glBegin(GL_QUADS); + glColor3f(0.0f, 1.0f, 0.0f);//green + glVertex3f( 1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f( 1.0f, 1.0f, 1.0f); + + glColor3f(1.0f, 0.5f, 0.0f);// Orange + glVertex3f( 1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f( 1.0f, -1.0f, -1.0f); + + glColor3f(1.0f, 0.0f, 0.0f);// Red + glVertex3f( 1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f( 1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 1.0f, 0.0f);// Yellow + glVertex3f( 1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f( 1.0f, 1.0f, -1.0f); + + glColor3f(0.0f, 0.0f, 1.0f);// Blue + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 0.0f, 1.0f);// Magenta + glVertex3f(1.0f, 1.0f, -1.0f); + glVertex3f(1.0f, 1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, -1.0f); + glEnd(); + } +} +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511153712.cpp b/.history/src/main_20200511153712.cpp new file mode 100644 index 0000000..80068a6 --- /dev/null +++ b/.history/src/main_20200511153712.cpp @@ -0,0 +1,155 @@ +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", gluErrorString(error)); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", gluErrorString(error)); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize the OpenGL clear color\n%s\n", gluErrorString(error)); + success = false; + } + return success; +} +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} +void update() { +} +float scale = 0.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,scale,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + glColor3f(0.0f, 1.0f, 0.0f);//green + glVertex3f( 1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f( 1.0f, 1.0f, 1.0f); + + glColor3f(1.0f, 0.5f, 0.0f);// Orange + glVertex3f( 1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f( 1.0f, -1.0f, -1.0f); + + glColor3f(1.0f, 0.0f, 0.0f);// Red + glVertex3f( 1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f( 1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 1.0f, 0.0f);// Yellow + glVertex3f( 1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f( 1.0f, 1.0f, -1.0f); + + glColor3f(0.0f, 0.0f, 1.0f);// Blue + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 0.0f, 1.0f);// Magenta + glVertex3f(1.0f, 1.0f, -1.0f); + glVertex3f(1.0f, 1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, -1.0f); + glEnd(); + } +} +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511153828.cpp b/.history/src/main_20200511153828.cpp new file mode 100644 index 0000000..94a687e --- /dev/null +++ b/.history/src/main_20200511153828.cpp @@ -0,0 +1,155 @@ +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", gluErrorString(error)); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", gluErrorString(error)); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize the OpenGL clear color\n%s\n", gluErrorString(error)); + success = false; + } + return success; +} +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} +void update() { +} +float scale = 0.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(scale,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + glColor3f(0.0f, 1.0f, 0.0f);//green + glVertex3f( 1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f( 1.0f, 1.0f, 1.0f); + + glColor3f(1.0f, 0.5f, 0.0f);// Orange + glVertex3f( 1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f( 1.0f, -1.0f, -1.0f); + + glColor3f(1.0f, 0.0f, 0.0f);// Red + glVertex3f( 1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f( 1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 1.0f, 0.0f);// Yellow + glVertex3f( 1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f( 1.0f, 1.0f, -1.0f); + + glColor3f(0.0f, 0.0f, 1.0f);// Blue + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 0.0f, 1.0f);// Magenta + glVertex3f(1.0f, 1.0f, -1.0f); + glVertex3f(1.0f, 1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, -1.0f); + glEnd(); + } +} +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511153840.cpp b/.history/src/main_20200511153840.cpp new file mode 100644 index 0000000..031b48c --- /dev/null +++ b/.history/src/main_20200511153840.cpp @@ -0,0 +1,155 @@ +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", gluErrorString(error)); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", gluErrorString(error)); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize the OpenGL clear color\n%s\n", gluErrorString(error)); + success = false; + } + return success; +} +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} +void update() { +} +float scale = 0.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(scale,scale,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + glColor3f(0.0f, 1.0f, 0.0f);//green + glVertex3f( 1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f( 1.0f, 1.0f, 1.0f); + + glColor3f(1.0f, 0.5f, 0.0f);// Orange + glVertex3f( 1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f( 1.0f, -1.0f, -1.0f); + + glColor3f(1.0f, 0.0f, 0.0f);// Red + glVertex3f( 1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f( 1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 1.0f, 0.0f);// Yellow + glVertex3f( 1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f( 1.0f, 1.0f, -1.0f); + + glColor3f(0.0f, 0.0f, 1.0f);// Blue + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 0.0f, 1.0f);// Magenta + glVertex3f(1.0f, 1.0f, -1.0f); + glVertex3f(1.0f, 1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, -1.0f); + glEnd(); + } +} +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511153905.cpp b/.history/src/main_20200511153905.cpp new file mode 100644 index 0000000..0432038 --- /dev/null +++ b/.history/src/main_20200511153905.cpp @@ -0,0 +1,155 @@ +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", gluErrorString(error)); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", gluErrorString(error)); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize the OpenGL clear color\n%s\n", gluErrorString(error)); + success = false; + } + return success; +} +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} +void update() { +} +float scale = 0.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + glColor3f(0.0f, 1.0f, 0.0f);//green + glVertex3f( 1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f( 1.0f, 1.0f, 1.0f); + + glColor3f(1.0f, 0.5f, 0.0f);// Orange + glVertex3f( 1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f( 1.0f, -1.0f, -1.0f); + + glColor3f(1.0f, 0.0f, 0.0f);// Red + glVertex3f( 1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f( 1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 1.0f, 0.0f);// Yellow + glVertex3f( 1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f( 1.0f, 1.0f, -1.0f); + + glColor3f(0.0f, 0.0f, 1.0f);// Blue + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 0.0f, 1.0f);// Magenta + glVertex3f(1.0f, 1.0f, -1.0f); + glVertex3f(1.0f, 1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, -1.0f); + glEnd(); + } +} +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511153910.cpp b/.history/src/main_20200511153910.cpp new file mode 100644 index 0000000..a6367df --- /dev/null +++ b/.history/src/main_20200511153910.cpp @@ -0,0 +1,155 @@ +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", gluErrorString(error)); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", gluErrorString(error)); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize the OpenGL clear color\n%s\n", gluErrorString(error)); + success = false; + } + return success; +} +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} +void update() { +} +float scale = 0.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + glColor3f(0.0f, 1.0f, 0.0f);//green + glVertex3f( 1.5f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f( 1.0f, 1.0f, 1.0f); + + glColor3f(1.0f, 0.5f, 0.0f);// Orange + glVertex3f( 1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f( 1.0f, -1.0f, -1.0f); + + glColor3f(1.0f, 0.0f, 0.0f);// Red + glVertex3f( 1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f( 1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 1.0f, 0.0f);// Yellow + glVertex3f( 1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f( 1.0f, 1.0f, -1.0f); + + glColor3f(0.0f, 0.0f, 1.0f);// Blue + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 0.0f, 1.0f);// Magenta + glVertex3f(1.0f, 1.0f, -1.0f); + glVertex3f(1.0f, 1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, -1.0f); + glEnd(); + } +} +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511153920.cpp b/.history/src/main_20200511153920.cpp new file mode 100644 index 0000000..0432038 --- /dev/null +++ b/.history/src/main_20200511153920.cpp @@ -0,0 +1,155 @@ +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", gluErrorString(error)); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", gluErrorString(error)); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize the OpenGL clear color\n%s\n", gluErrorString(error)); + success = false; + } + return success; +} +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} +void update() { +} +float scale = 0.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + glColor3f(0.0f, 1.0f, 0.0f);//green + glVertex3f( 1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f( 1.0f, 1.0f, 1.0f); + + glColor3f(1.0f, 0.5f, 0.0f);// Orange + glVertex3f( 1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f( 1.0f, -1.0f, -1.0f); + + glColor3f(1.0f, 0.0f, 0.0f);// Red + glVertex3f( 1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f( 1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 1.0f, 0.0f);// Yellow + glVertex3f( 1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f( 1.0f, 1.0f, -1.0f); + + glColor3f(0.0f, 0.0f, 1.0f);// Blue + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 0.0f, 1.0f);// Magenta + glVertex3f(1.0f, 1.0f, -1.0f); + glVertex3f(1.0f, 1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, -1.0f); + glEnd(); + } +} +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511153926.cpp b/.history/src/main_20200511153926.cpp new file mode 100644 index 0000000..e25c425 --- /dev/null +++ b/.history/src/main_20200511153926.cpp @@ -0,0 +1,155 @@ +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", gluErrorString(error)); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", gluErrorString(error)); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize the OpenGL clear color\n%s\n", gluErrorString(error)); + success = false; + } + return success; +} +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} +void update() { +} +float scale = 0.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + glColor3f(0.0f, 1.0f, 0.0f);//green + glVertex3f( 1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f( 1.0f, 1.0f, 1.0f); + + glColor3f(1.0f, 0.5f, 0.0f);// Orange + glVertex3f( 1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f( 1.0f, -1.0f, -1.0f); + + glColor3f(1.0f, 0.0f, 0.0f);// Red + glVertex3f( 1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f( 1.0f, -1.0f, 1.0f); + + glColor3f(1.5f, 1.0f, 0.0f);// Yellow + glVertex3f( 1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f( 1.0f, 1.0f, -1.0f); + + glColor3f(0.0f, 0.0f, 1.0f);// Blue + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 0.0f, 1.0f);// Magenta + glVertex3f(1.0f, 1.0f, -1.0f); + glVertex3f(1.0f, 1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, -1.0f); + glEnd(); + } +} +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511153948.cpp b/.history/src/main_20200511153948.cpp new file mode 100644 index 0000000..e581c83 --- /dev/null +++ b/.history/src/main_20200511153948.cpp @@ -0,0 +1,155 @@ +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", gluErrorString(error)); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", gluErrorString(error)); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize the OpenGL clear color\n%s\n", gluErrorString(error)); + success = false; + } + return success; +} +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} +void update() { +} +float scale = 0.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + glColor3f(0.0f, 1.0f, 0.0f);//green + glVertex3f( 1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f( 1.0f, 1.0f, 1.0f); + + glColor3f(1.0f, 0.5f, 0.0f);// Orange + glVertex3f( 1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f( 1.0f, -1.0f, -1.0f); + + glColor3f(1.0f, 0.0f, 0.0f);// Red + glVertex3f( 1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f( 1.0f, -1.0f, 1.0f); + + glColor3f(0.5f, 1.0f, 0.0f);// Yellow + glVertex3f( 1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f( 1.0f, 1.0f, -1.0f); + + glColor3f(0.0f, 0.0f, 1.0f);// Blue + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 0.0f, 1.0f);// Magenta + glVertex3f(1.0f, 1.0f, -1.0f); + glVertex3f(1.0f, 1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, -1.0f); + glEnd(); + } +} +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511153957.cpp b/.history/src/main_20200511153957.cpp new file mode 100644 index 0000000..0432038 --- /dev/null +++ b/.history/src/main_20200511153957.cpp @@ -0,0 +1,155 @@ +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", gluErrorString(error)); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", gluErrorString(error)); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize the OpenGL clear color\n%s\n", gluErrorString(error)); + success = false; + } + return success; +} +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} +void update() { +} +float scale = 0.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + glColor3f(0.0f, 1.0f, 0.0f);//green + glVertex3f( 1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f( 1.0f, 1.0f, 1.0f); + + glColor3f(1.0f, 0.5f, 0.0f);// Orange + glVertex3f( 1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f( 1.0f, -1.0f, -1.0f); + + glColor3f(1.0f, 0.0f, 0.0f);// Red + glVertex3f( 1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f( 1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 1.0f, 0.0f);// Yellow + glVertex3f( 1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f( 1.0f, 1.0f, -1.0f); + + glColor3f(0.0f, 0.0f, 1.0f);// Blue + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 0.0f, 1.0f);// Magenta + glVertex3f(1.0f, 1.0f, -1.0f); + glVertex3f(1.0f, 1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, -1.0f); + glEnd(); + } +} +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511154013.cpp b/.history/src/main_20200511154013.cpp new file mode 100644 index 0000000..e335cb5 --- /dev/null +++ b/.history/src/main_20200511154013.cpp @@ -0,0 +1,155 @@ +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", gluErrorString(error)); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", gluErrorString(error)); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize the OpenGL clear color\n%s\n", gluErrorString(error)); + success = false; + } + return success; +} +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} +void update() { +} +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + glColor3f(0.0f, 1.0f, 0.0f);//green + glVertex3f( 1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f( 1.0f, 1.0f, 1.0f); + + glColor3f(1.0f, 0.5f, 0.0f);// Orange + glVertex3f( 1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f( 1.0f, -1.0f, -1.0f); + + glColor3f(1.0f, 0.0f, 0.0f);// Red + glVertex3f( 1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f( 1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 1.0f, 0.0f);// Yellow + glVertex3f( 1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f( 1.0f, 1.0f, -1.0f); + + glColor3f(0.0f, 0.0f, 1.0f);// Blue + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 0.0f, 1.0f);// Magenta + glVertex3f(1.0f, 1.0f, -1.0f); + glVertex3f(1.0f, 1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, -1.0f); + glEnd(); + } +} +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511154031.cpp b/.history/src/main_20200511154031.cpp new file mode 100644 index 0000000..a8fac37 --- /dev/null +++ b/.history/src/main_20200511154031.cpp @@ -0,0 +1,155 @@ +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", gluErrorString(error)); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", gluErrorString(error)); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize the OpenGL clear color\n%s\n", gluErrorString(error)); + success = false; + } + return success; +} +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} +void update() { +} +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + glColor3f(0.0f, 1.0f, 0.0f);//green + glVertex3f( 1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f( 1.0f, 1.0f, 1.0f); + + glColor3f(1.0f, 0.5f, 0.0f);// Orange + glVertex3f( 1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f( 1.0f, -1.0f, -1.0f); + + glColor3f(1.0f, 0.0f, 0.0f);// Red + glVertex3f( 1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f( 1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 1.0f, 0.0f);// Yellow + glVertex3f( 1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f( 1.0f, 1.0f, scale); + + glColor3f(0.0f, 0.0f, 1.0f);// Blue + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 0.0f, 1.0f);// Magenta + glVertex3f(1.0f, 1.0f, -1.0f); + glVertex3f(1.0f, 1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, -1.0f); + glEnd(); + } +} +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511154055.cpp b/.history/src/main_20200511154055.cpp new file mode 100644 index 0000000..3548264 --- /dev/null +++ b/.history/src/main_20200511154055.cpp @@ -0,0 +1,155 @@ +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", gluErrorString(error)); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", gluErrorString(error)); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize the OpenGL clear color\n%s\n", gluErrorString(error)); + success = false; + } + return success; +} +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} +void update() { +} +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + glColor3f(0.0f, 1.0f, 0.0f);//green + glVertex3f( 1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f( 1.0f, 1.0f, 1.0f); + + glColor3f(1.0f, 0.5f, 0.0f);// Orange + glVertex3f( 1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f( 1.0f, -1.0f, -1.0f); + + glColor3f(1.0f, 0.0f, 0.0f);// Red + glVertex3f( 1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f( 1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 1.0f, 0.0f);// Yellow + glVertex3f( 1.0f, scale, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f( 1.0f, 1.0f, scale); + + glColor3f(0.0f, 0.0f, 1.0f);// Blue + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 0.0f, 1.0f);// Magenta + glVertex3f(1.0f, 1.0f, -1.0f); + glVertex3f(1.0f, 1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, -1.0f); + glEnd(); + } +} +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511154127.cpp b/.history/src/main_20200511154127.cpp new file mode 100644 index 0000000..115131a --- /dev/null +++ b/.history/src/main_20200511154127.cpp @@ -0,0 +1,155 @@ +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", gluErrorString(error)); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", gluErrorString(error)); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize the OpenGL clear color\n%s\n", gluErrorString(error)); + success = false; + } + return success; +} +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} +void update() { +} +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + glColor3f(0.0f, 1.0f, 0.0f);//green + glVertex3f( 1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f( 1.0f, 1.0f, 1.0f); + + glColor3f(1.0f, 0.5f, 0.0f);// Orange + glVertex3f( 1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f( 1.0f, -1.0f, -1.0f); + + glColor3f(1.0f, 0.0f, 0.0f);// Red + glVertex3f( 1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, scale, 1.0f); + glVertex3f( 1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 1.0f, 0.0f);// Yellow + glVertex3f( 1.0f, scale, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f( 1.0f, 1.0f, scale); + + glColor3f(0.0f, 0.0f, 1.0f);// Blue + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 0.0f, 1.0f);// Magenta + glVertex3f(1.0f, 1.0f, -1.0f); + glVertex3f(1.0f, 1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, -1.0f); + glEnd(); + } +} +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511163804.cpp b/.history/src/main_20200511163804.cpp new file mode 100644 index 0000000..e335cb5 --- /dev/null +++ b/.history/src/main_20200511163804.cpp @@ -0,0 +1,155 @@ +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", gluErrorString(error)); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", gluErrorString(error)); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize the OpenGL clear color\n%s\n", gluErrorString(error)); + success = false; + } + return success; +} +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} +void update() { +} +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + glColor3f(0.0f, 1.0f, 0.0f);//green + glVertex3f( 1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f( 1.0f, 1.0f, 1.0f); + + glColor3f(1.0f, 0.5f, 0.0f);// Orange + glVertex3f( 1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f( 1.0f, -1.0f, -1.0f); + + glColor3f(1.0f, 0.0f, 0.0f);// Red + glVertex3f( 1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f( 1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 1.0f, 0.0f);// Yellow + glVertex3f( 1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f( 1.0f, 1.0f, -1.0f); + + glColor3f(0.0f, 0.0f, 1.0f);// Blue + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 0.0f, 1.0f);// Magenta + glVertex3f(1.0f, 1.0f, -1.0f); + glVertex3f(1.0f, 1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, -1.0f); + glEnd(); + } +} +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511163907.cpp b/.history/src/main_20200511163907.cpp new file mode 100644 index 0000000..e335cb5 --- /dev/null +++ b/.history/src/main_20200511163907.cpp @@ -0,0 +1,155 @@ +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", gluErrorString(error)); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", gluErrorString(error)); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize the OpenGL clear color\n%s\n", gluErrorString(error)); + success = false; + } + return success; +} +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} +void update() { +} +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + glColor3f(0.0f, 1.0f, 0.0f);//green + glVertex3f( 1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f( 1.0f, 1.0f, 1.0f); + + glColor3f(1.0f, 0.5f, 0.0f);// Orange + glVertex3f( 1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f( 1.0f, -1.0f, -1.0f); + + glColor3f(1.0f, 0.0f, 0.0f);// Red + glVertex3f( 1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f( 1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 1.0f, 0.0f);// Yellow + glVertex3f( 1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f( 1.0f, 1.0f, -1.0f); + + glColor3f(0.0f, 0.0f, 1.0f);// Blue + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 0.0f, 1.0f);// Magenta + glVertex3f(1.0f, 1.0f, -1.0f); + glVertex3f(1.0f, 1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, -1.0f); + glEnd(); + } +} +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511163917.cpp b/.history/src/main_20200511163917.cpp new file mode 100644 index 0000000..e335cb5 --- /dev/null +++ b/.history/src/main_20200511163917.cpp @@ -0,0 +1,155 @@ +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", gluErrorString(error)); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", gluErrorString(error)); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize the OpenGL clear color\n%s\n", gluErrorString(error)); + success = false; + } + return success; +} +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} +void update() { +} +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + glColor3f(0.0f, 1.0f, 0.0f);//green + glVertex3f( 1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f( 1.0f, 1.0f, 1.0f); + + glColor3f(1.0f, 0.5f, 0.0f);// Orange + glVertex3f( 1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f( 1.0f, -1.0f, -1.0f); + + glColor3f(1.0f, 0.0f, 0.0f);// Red + glVertex3f( 1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f( 1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 1.0f, 0.0f);// Yellow + glVertex3f( 1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f( 1.0f, 1.0f, -1.0f); + + glColor3f(0.0f, 0.0f, 1.0f);// Blue + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 0.0f, 1.0f);// Magenta + glVertex3f(1.0f, 1.0f, -1.0f); + glVertex3f(1.0f, 1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, -1.0f); + glEnd(); + } +} +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511164038.cpp b/.history/src/main_20200511164038.cpp new file mode 100644 index 0000000..e335cb5 --- /dev/null +++ b/.history/src/main_20200511164038.cpp @@ -0,0 +1,155 @@ +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", gluErrorString(error)); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", gluErrorString(error)); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize the OpenGL clear color\n%s\n", gluErrorString(error)); + success = false; + } + return success; +} +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} +void update() { +} +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + glColor3f(0.0f, 1.0f, 0.0f);//green + glVertex3f( 1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f( 1.0f, 1.0f, 1.0f); + + glColor3f(1.0f, 0.5f, 0.0f);// Orange + glVertex3f( 1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f( 1.0f, -1.0f, -1.0f); + + glColor3f(1.0f, 0.0f, 0.0f);// Red + glVertex3f( 1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f( 1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 1.0f, 0.0f);// Yellow + glVertex3f( 1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f( 1.0f, 1.0f, -1.0f); + + glColor3f(0.0f, 0.0f, 1.0f);// Blue + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 0.0f, 1.0f);// Magenta + glVertex3f(1.0f, 1.0f, -1.0f); + glVertex3f(1.0f, 1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, -1.0f); + glEnd(); + } +} +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511164730.cpp b/.history/src/main_20200511164730.cpp new file mode 100644 index 0000000..15c32c0 --- /dev/null +++ b/.history/src/main_20200511164730.cpp @@ -0,0 +1,153 @@ +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", gluErrorString(error)); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", gluErrorString(error)); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize the OpenGL clear color\n%s\n", gluErrorString(error)); + success = false; + } + return success; +} +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} +void update() { +} +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + glColor3f(0.0f, 1.0f, 0.0f);//green + glVertex3f(0.5f,0.5f,0.5f); + glVertex3f(0.5f,-0.5f,0.5f); + + glColor3f(1.0f, 0.5f, 0.0f);// Orange + glVertex3f( 1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f( 1.0f, -1.0f, -1.0f); + + glColor3f(1.0f, 0.0f, 0.0f);// Red + glVertex3f( 1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f( 1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 1.0f, 0.0f);// Yellow + glVertex3f( 1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f( 1.0f, 1.0f, -1.0f); + + glColor3f(0.0f, 0.0f, 1.0f);// Blue + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 0.0f, 1.0f);// Magenta + glVertex3f(1.0f, 1.0f, -1.0f); + glVertex3f(1.0f, 1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, -1.0f); + glEnd(); + } +} +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511164948.cpp b/.history/src/main_20200511164948.cpp new file mode 100644 index 0000000..b5663e6 --- /dev/null +++ b/.history/src/main_20200511164948.cpp @@ -0,0 +1,158 @@ +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +class Vertex { + public: + float x,y,z; +}; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", gluErrorString(error)); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", gluErrorString(error)); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize the OpenGL clear color\n%s\n", gluErrorString(error)); + success = false; + } + return success; +} +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} +void update() { +} +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + glColor3f(0.0f, 1.0f, 0.0f);//green + glVertex3f(0.5f,0.5f,0.5f); + glVertex3f(0.5f,-0.5f,0.5f); + + glColor3f(1.0f, 0.5f, 0.0f);// Orange + glVertex3f( 1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f( 1.0f, -1.0f, -1.0f); + + glColor3f(1.0f, 0.0f, 0.0f);// Red + glVertex3f( 1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f( 1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 1.0f, 0.0f);// Yellow + glVertex3f( 1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f( 1.0f, 1.0f, -1.0f); + + glColor3f(0.0f, 0.0f, 1.0f);// Blue + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 0.0f, 1.0f);// Magenta + glVertex3f(1.0f, 1.0f, -1.0f); + glVertex3f(1.0f, 1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, -1.0f); + glEnd(); + } +} +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511165120.cpp b/.history/src/main_20200511165120.cpp new file mode 100644 index 0000000..fe568c3 --- /dev/null +++ b/.history/src/main_20200511165120.cpp @@ -0,0 +1,163 @@ +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +class Vertex { + public: + float x,y,z; +}; + +class Quad { + public: + Vertex topL,topR,botR,botL; +} + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", gluErrorString(error)); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", gluErrorString(error)); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize the OpenGL clear color\n%s\n", gluErrorString(error)); + success = false; + } + return success; +} +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} +void update() { +} +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + glColor3f(0.0f, 1.0f, 0.0f);//green + glVertex3f(0.5f,0.5f,0.5f); + glVertex3f(0.5f,-0.5f,0.5f); + + glColor3f(1.0f, 0.5f, 0.0f);// Orange + glVertex3f( 1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f( 1.0f, -1.0f, -1.0f); + + glColor3f(1.0f, 0.0f, 0.0f);// Red + glVertex3f( 1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f( 1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 1.0f, 0.0f);// Yellow + glVertex3f( 1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f( 1.0f, 1.0f, -1.0f); + + glColor3f(0.0f, 0.0f, 1.0f);// Blue + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 0.0f, 1.0f);// Magenta + glVertex3f(1.0f, 1.0f, -1.0f); + glVertex3f(1.0f, 1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, -1.0f); + glEnd(); + } +} +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511165122.cpp b/.history/src/main_20200511165122.cpp new file mode 100644 index 0000000..ddccb63 --- /dev/null +++ b/.history/src/main_20200511165122.cpp @@ -0,0 +1,163 @@ +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +class Vertex { + public: + float x,y,z; +}; + +class Quad { + public: + Vertex topL,topR,botR,botL; +}; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", gluErrorString(error)); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", gluErrorString(error)); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize the OpenGL clear color\n%s\n", gluErrorString(error)); + success = false; + } + return success; +} +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} +void update() { +} +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + glColor3f(0.0f, 1.0f, 0.0f);//green + glVertex3f(0.5f,0.5f,0.5f); + glVertex3f(0.5f,-0.5f,0.5f); + + glColor3f(1.0f, 0.5f, 0.0f);// Orange + glVertex3f( 1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f( 1.0f, -1.0f, -1.0f); + + glColor3f(1.0f, 0.0f, 0.0f);// Red + glVertex3f( 1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f( 1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 1.0f, 0.0f);// Yellow + glVertex3f( 1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f( 1.0f, 1.0f, -1.0f); + + glColor3f(0.0f, 0.0f, 1.0f);// Blue + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 0.0f, 1.0f);// Magenta + glVertex3f(1.0f, 1.0f, -1.0f); + glVertex3f(1.0f, 1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, -1.0f); + glEnd(); + } +} +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511165240.cpp b/.history/src/main_20200511165240.cpp new file mode 100644 index 0000000..fcdadca --- /dev/null +++ b/.history/src/main_20200511165240.cpp @@ -0,0 +1,168 @@ +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +class Vertex { + public: + float x,y,z; +}; + +class Quad { + public: + Vertex topL,topR,botR,botL; + void render(); +}; + +Quad::render() { + +} + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", gluErrorString(error)); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", gluErrorString(error)); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize the OpenGL clear color\n%s\n", gluErrorString(error)); + success = false; + } + return success; +} +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} +void update() { +} +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + glColor3f(0.0f, 1.0f, 0.0f);//green + glVertex3f(0.5f,0.5f,0.5f); + glVertex3f(0.5f,-0.5f,0.5f); + + glColor3f(1.0f, 0.5f, 0.0f);// Orange + glVertex3f( 1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f( 1.0f, -1.0f, -1.0f); + + glColor3f(1.0f, 0.0f, 0.0f);// Red + glVertex3f( 1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f( 1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 1.0f, 0.0f);// Yellow + glVertex3f( 1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f( 1.0f, 1.0f, -1.0f); + + glColor3f(0.0f, 0.0f, 1.0f);// Blue + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 0.0f, 1.0f);// Magenta + glVertex3f(1.0f, 1.0f, -1.0f); + glVertex3f(1.0f, 1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, -1.0f); + glEnd(); + } +} +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511165437.cpp b/.history/src/main_20200511165437.cpp new file mode 100644 index 0000000..f279f6b --- /dev/null +++ b/.history/src/main_20200511165437.cpp @@ -0,0 +1,168 @@ +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +class Vertex { + public: + float x,y,z; +}; + +class Quad { + public: + Vertex topL,topR,botR,botL; + void render(); +}; + +void Quad::render() { + +} + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", gluErrorString(error)); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", gluErrorString(error)); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize the OpenGL clear color\n%s\n", gluErrorString(error)); + success = false; + } + return success; +} +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} +void update() { +} +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + glColor3f(0.0f, 1.0f, 0.0f);//green + glVertex3f(0.5f,0.5f,0.5f); + glVertex3f(0.5f,-0.5f,0.5f); + + glColor3f(1.0f, 0.5f, 0.0f);// Orange + glVertex3f( 1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f( 1.0f, -1.0f, -1.0f); + + glColor3f(1.0f, 0.0f, 0.0f);// Red + glVertex3f( 1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f( 1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 1.0f, 0.0f);// Yellow + glVertex3f( 1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f( 1.0f, 1.0f, -1.0f); + + glColor3f(0.0f, 0.0f, 1.0f);// Blue + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 0.0f, 1.0f);// Magenta + glVertex3f(1.0f, 1.0f, -1.0f); + glVertex3f(1.0f, 1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, -1.0f); + glEnd(); + } +} +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511165658.cpp b/.history/src/main_20200511165658.cpp new file mode 100644 index 0000000..4aa99bd --- /dev/null +++ b/.history/src/main_20200511165658.cpp @@ -0,0 +1,171 @@ +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +class Vertex { + public: + float x,y,z; +}; + +class Quad { + public: + Vertex topL,topR,botR,botL; + void render(); +}; + +void Quad::render() { + glVertex3f(topL.x,topL.y,topL.z); + glVertex3f(topR.x,topR.y,topR.z); + glVertex3f(botR.x,botR.y,botR.z); + glVertex3f(botL.x,botL.y,botL.z); +} + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", gluErrorString(error)); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", gluErrorString(error)); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize the OpenGL clear color\n%s\n", gluErrorString(error)); + success = false; + } + return success; +} +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} +void update() { +} +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + glColor3f(0.0f, 1.0f, 0.0f);//green + glVertex3f(0.5f,0.5f,0.5f); + glVertex3f(0.5f,-0.5f,0.5f); + + glColor3f(1.0f, 0.5f, 0.0f);// Orange + glVertex3f( 1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f( 1.0f, -1.0f, -1.0f); + + glColor3f(1.0f, 0.0f, 0.0f);// Red + glVertex3f( 1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f( 1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 1.0f, 0.0f);// Yellow + glVertex3f( 1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f( 1.0f, 1.0f, -1.0f); + + glColor3f(0.0f, 0.0f, 1.0f);// Blue + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 0.0f, 1.0f);// Magenta + glVertex3f(1.0f, 1.0f, -1.0f); + glVertex3f(1.0f, 1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, -1.0f); + glEnd(); + } +} +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511165816.cpp b/.history/src/main_20200511165816.cpp new file mode 100644 index 0000000..4aa99bd --- /dev/null +++ b/.history/src/main_20200511165816.cpp @@ -0,0 +1,171 @@ +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +class Vertex { + public: + float x,y,z; +}; + +class Quad { + public: + Vertex topL,topR,botR,botL; + void render(); +}; + +void Quad::render() { + glVertex3f(topL.x,topL.y,topL.z); + glVertex3f(topR.x,topR.y,topR.z); + glVertex3f(botR.x,botR.y,botR.z); + glVertex3f(botL.x,botL.y,botL.z); +} + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", gluErrorString(error)); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", gluErrorString(error)); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize the OpenGL clear color\n%s\n", gluErrorString(error)); + success = false; + } + return success; +} +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} +void update() { +} +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + glColor3f(0.0f, 1.0f, 0.0f);//green + glVertex3f(0.5f,0.5f,0.5f); + glVertex3f(0.5f,-0.5f,0.5f); + + glColor3f(1.0f, 0.5f, 0.0f);// Orange + glVertex3f( 1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f( 1.0f, -1.0f, -1.0f); + + glColor3f(1.0f, 0.0f, 0.0f);// Red + glVertex3f( 1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f( 1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 1.0f, 0.0f);// Yellow + glVertex3f( 1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f( 1.0f, 1.0f, -1.0f); + + glColor3f(0.0f, 0.0f, 1.0f);// Blue + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 0.0f, 1.0f);// Magenta + glVertex3f(1.0f, 1.0f, -1.0f); + glVertex3f(1.0f, 1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, -1.0f); + glEnd(); + } +} +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511165944.cpp b/.history/src/main_20200511165944.cpp new file mode 100644 index 0000000..79b37de --- /dev/null +++ b/.history/src/main_20200511165944.cpp @@ -0,0 +1,181 @@ +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +class Color { + public: + float r,g,b,a; +}; + +class Vertex { + public: + float x,y,z; +}; + +class Quad { + public: + Vertex topL,topR,botR,botL; + void setColor(); + void render(); +}; + +void Quad::setColor(Color color) { + +} + +void Quad::render() { + glVertex3f(topL.x,topL.y,topL.z); + glVertex3f(topR.x,topR.y,topR.z); + glVertex3f(botR.x,botR.y,botR.z); + glVertex3f(botL.x,botL.y,botL.z); +} + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", gluErrorString(error)); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", gluErrorString(error)); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize the OpenGL clear color\n%s\n", gluErrorString(error)); + success = false; + } + return success; +} +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} +void update() { +} +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + glColor3f(0.0f, 1.0f, 0.0f);//green + glVertex3f(0.5f,0.5f,0.5f); + glVertex3f(0.5f,-0.5f,0.5f); + + glColor3f(1.0f, 0.5f, 0.0f);// Orange + glVertex3f( 1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f( 1.0f, -1.0f, -1.0f); + + glColor3f(1.0f, 0.0f, 0.0f);// Red + glVertex3f( 1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f( 1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 1.0f, 0.0f);// Yellow + glVertex3f( 1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f( 1.0f, 1.0f, -1.0f); + + glColor3f(0.0f, 0.0f, 1.0f);// Blue + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 0.0f, 1.0f);// Magenta + glVertex3f(1.0f, 1.0f, -1.0f); + glVertex3f(1.0f, 1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, -1.0f); + glEnd(); + } +} +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511165954.cpp b/.history/src/main_20200511165954.cpp new file mode 100644 index 0000000..7ada889 --- /dev/null +++ b/.history/src/main_20200511165954.cpp @@ -0,0 +1,181 @@ +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +class Color { + public: + float r,g,b,a; +}; + +class Vertex { + public: + float x,y,z; +}; + +class Quad { + public: + Vertex topL,topR,botR,botL; + void setColor(Color color); + void render(); +}; + +void Quad::setColor(Color color) { + +} + +void Quad::render() { + glVertex3f(topL.x,topL.y,topL.z); + glVertex3f(topR.x,topR.y,topR.z); + glVertex3f(botR.x,botR.y,botR.z); + glVertex3f(botL.x,botL.y,botL.z); +} + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", gluErrorString(error)); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", gluErrorString(error)); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize the OpenGL clear color\n%s\n", gluErrorString(error)); + success = false; + } + return success; +} +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} +void update() { +} +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + glColor3f(0.0f, 1.0f, 0.0f);//green + glVertex3f(0.5f,0.5f,0.5f); + glVertex3f(0.5f,-0.5f,0.5f); + + glColor3f(1.0f, 0.5f, 0.0f);// Orange + glVertex3f( 1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f( 1.0f, -1.0f, -1.0f); + + glColor3f(1.0f, 0.0f, 0.0f);// Red + glVertex3f( 1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f( 1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 1.0f, 0.0f);// Yellow + glVertex3f( 1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f( 1.0f, 1.0f, -1.0f); + + glColor3f(0.0f, 0.0f, 1.0f);// Blue + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 0.0f, 1.0f);// Magenta + glVertex3f(1.0f, 1.0f, -1.0f); + glVertex3f(1.0f, 1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, -1.0f); + glEnd(); + } +} +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511170722.cpp b/.history/src/main_20200511170722.cpp new file mode 100644 index 0000000..dda38c4 --- /dev/null +++ b/.history/src/main_20200511170722.cpp @@ -0,0 +1,187 @@ +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +class Color { + public: + float r,g,b,a; + Color(float r,float g,float b,float a) { + this->r=r; + this->g=g; + this->b=b; + this->a=a; + } +}; + +class Vertex { + public: + float x,y,z; +}; + +class Quad { + public: + Vertex topL,topR,botR,botL; + void setColor(Color color); + void render(); +}; + +void Quad::setColor(Color color) { + +} + +void Quad::render() { + glVertex3f(topL.x,topL.y,topL.z); + glVertex3f(topR.x,topR.y,topR.z); + glVertex3f(botR.x,botR.y,botR.z); + glVertex3f(botL.x,botL.y,botL.z); +} + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", gluErrorString(error)); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", gluErrorString(error)); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize the OpenGL clear color\n%s\n", gluErrorString(error)); + success = false; + } + return success; +} +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} +void update() { +} +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + glColor3f(0.0f, 1.0f, 0.0f);//green + glVertex3f(0.5f,0.5f,0.5f); + glVertex3f(0.5f,-0.5f,0.5f); + + glColor3f(1.0f, 0.5f, 0.0f);// Orange + glVertex3f( 1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f( 1.0f, -1.0f, -1.0f); + + glColor3f(1.0f, 0.0f, 0.0f);// Red + glVertex3f( 1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f( 1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 1.0f, 0.0f);// Yellow + glVertex3f( 1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f( 1.0f, 1.0f, -1.0f); + + glColor3f(0.0f, 0.0f, 1.0f);// Blue + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 0.0f, 1.0f);// Magenta + glVertex3f(1.0f, 1.0f, -1.0f); + glVertex3f(1.0f, 1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, -1.0f); + glEnd(); + } +} +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511170815.cpp b/.history/src/main_20200511170815.cpp new file mode 100644 index 0000000..a8ad7ae --- /dev/null +++ b/.history/src/main_20200511170815.cpp @@ -0,0 +1,189 @@ +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +class Color { + public: + float r,g,b,a; + Color(float r,float g,float b,float a) { + this->r=r; + this->g=g; + this->b=b; + this->a=a; + } +}; + +class Vertex { + public: + float x,y,z; +}; + +class Quad { + public: + Color color; + Vertex topL,topR,botR,botL; + void setColor(Color color); + void render(); +}; + +void Quad::setColor(Color c) { + c +} + +void Quad::render() { + glColor4f(); + glVertex3f(topL.x,topL.y,topL.z); + glVertex3f(topR.x,topR.y,topR.z); + glVertex3f(botR.x,botR.y,botR.z); + glVertex3f(botL.x,botL.y,botL.z); +} + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", gluErrorString(error)); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", gluErrorString(error)); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize the OpenGL clear color\n%s\n", gluErrorString(error)); + success = false; + } + return success; +} +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} +void update() { +} +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + glColor3f(0.0f, 1.0f, 0.0f);//green + glVertex3f(0.5f,0.5f,0.5f); + glVertex3f(0.5f,-0.5f,0.5f); + + glColor3f(1.0f, 0.5f, 0.0f);// Orange + glVertex3f( 1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f( 1.0f, -1.0f, -1.0f); + + glColor3f(1.0f, 0.0f, 0.0f);// Red + glVertex3f( 1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f( 1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 1.0f, 0.0f);// Yellow + glVertex3f( 1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f( 1.0f, 1.0f, -1.0f); + + glColor3f(0.0f, 0.0f, 1.0f);// Blue + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 0.0f, 1.0f);// Magenta + glVertex3f(1.0f, 1.0f, -1.0f); + glVertex3f(1.0f, 1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, -1.0f); + glEnd(); + } +} +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511170819.cpp b/.history/src/main_20200511170819.cpp new file mode 100644 index 0000000..c1033ee --- /dev/null +++ b/.history/src/main_20200511170819.cpp @@ -0,0 +1,189 @@ +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +class Color { + public: + float r,g,b,a; + Color(float r,float g,float b,float a) { + this->r=r; + this->g=g; + this->b=b; + this->a=a; + } +}; + +class Vertex { + public: + float x,y,z; +}; + +class Quad { + public: + Color color; + Vertex topL,topR,botR,botL; + void setColor(Color color); + void render(); +}; + +void Quad::setColor(Color c) { + color = c; +} + +void Quad::render() { + glColor4f(); + glVertex3f(topL.x,topL.y,topL.z); + glVertex3f(topR.x,topR.y,topR.z); + glVertex3f(botR.x,botR.y,botR.z); + glVertex3f(botL.x,botL.y,botL.z); +} + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", gluErrorString(error)); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", gluErrorString(error)); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize the OpenGL clear color\n%s\n", gluErrorString(error)); + success = false; + } + return success; +} +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} +void update() { +} +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + glColor3f(0.0f, 1.0f, 0.0f);//green + glVertex3f(0.5f,0.5f,0.5f); + glVertex3f(0.5f,-0.5f,0.5f); + + glColor3f(1.0f, 0.5f, 0.0f);// Orange + glVertex3f( 1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f( 1.0f, -1.0f, -1.0f); + + glColor3f(1.0f, 0.0f, 0.0f);// Red + glVertex3f( 1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f( 1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 1.0f, 0.0f);// Yellow + glVertex3f( 1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f( 1.0f, 1.0f, -1.0f); + + glColor3f(0.0f, 0.0f, 1.0f);// Blue + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 0.0f, 1.0f);// Magenta + glVertex3f(1.0f, 1.0f, -1.0f); + glVertex3f(1.0f, 1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, -1.0f); + glEnd(); + } +} +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511170856.cpp b/.history/src/main_20200511170856.cpp new file mode 100644 index 0000000..c1033ee --- /dev/null +++ b/.history/src/main_20200511170856.cpp @@ -0,0 +1,189 @@ +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +class Color { + public: + float r,g,b,a; + Color(float r,float g,float b,float a) { + this->r=r; + this->g=g; + this->b=b; + this->a=a; + } +}; + +class Vertex { + public: + float x,y,z; +}; + +class Quad { + public: + Color color; + Vertex topL,topR,botR,botL; + void setColor(Color color); + void render(); +}; + +void Quad::setColor(Color c) { + color = c; +} + +void Quad::render() { + glColor4f(); + glVertex3f(topL.x,topL.y,topL.z); + glVertex3f(topR.x,topR.y,topR.z); + glVertex3f(botR.x,botR.y,botR.z); + glVertex3f(botL.x,botL.y,botL.z); +} + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", gluErrorString(error)); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", gluErrorString(error)); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize the OpenGL clear color\n%s\n", gluErrorString(error)); + success = false; + } + return success; +} +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} +void update() { +} +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + glColor3f(0.0f, 1.0f, 0.0f);//green + glVertex3f(0.5f,0.5f,0.5f); + glVertex3f(0.5f,-0.5f,0.5f); + + glColor3f(1.0f, 0.5f, 0.0f);// Orange + glVertex3f( 1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f( 1.0f, -1.0f, -1.0f); + + glColor3f(1.0f, 0.0f, 0.0f);// Red + glVertex3f( 1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f( 1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 1.0f, 0.0f);// Yellow + glVertex3f( 1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f( 1.0f, 1.0f, -1.0f); + + glColor3f(0.0f, 0.0f, 1.0f);// Blue + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 0.0f, 1.0f);// Magenta + glVertex3f(1.0f, 1.0f, -1.0f); + glVertex3f(1.0f, 1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, -1.0f); + glEnd(); + } +} +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511170941.cpp b/.history/src/main_20200511170941.cpp new file mode 100644 index 0000000..a00c9ad --- /dev/null +++ b/.history/src/main_20200511170941.cpp @@ -0,0 +1,189 @@ +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +class Color { + public: + float r,g,b,a; + Color(float r,float g,float b,float a) { + this->r=r; + this->g=g; + this->b=b; + this->a=a; + } +}; + +class Vertex { + public: + float x,y,z; +}; + +class Quad { + public: + Color color; + Vertex topL,topR,botR,botL; + void setColor(Color color); + void render(); +}; + +void Quad::setColor(Color c) { + color = c; +} + +void Quad::render() { + glColor4f(color.r,color.g,color.b,color.a); + glVertex3f(topL.x,topL.y,topL.z); + glVertex3f(topR.x,topR.y,topR.z); + glVertex3f(botR.x,botR.y,botR.z); + glVertex3f(botL.x,botL.y,botL.z); +} + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", gluErrorString(error)); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", gluErrorString(error)); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize the OpenGL clear color\n%s\n", gluErrorString(error)); + success = false; + } + return success; +} +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} +void update() { +} +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + glColor3f(0.0f, 1.0f, 0.0f);//green + glVertex3f(0.5f,0.5f,0.5f); + glVertex3f(0.5f,-0.5f,0.5f); + + glColor3f(1.0f, 0.5f, 0.0f);// Orange + glVertex3f( 1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f( 1.0f, -1.0f, -1.0f); + + glColor3f(1.0f, 0.0f, 0.0f);// Red + glVertex3f( 1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f( 1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 1.0f, 0.0f);// Yellow + glVertex3f( 1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f( 1.0f, 1.0f, -1.0f); + + glColor3f(0.0f, 0.0f, 1.0f);// Blue + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 0.0f, 1.0f);// Magenta + glVertex3f(1.0f, 1.0f, -1.0f); + glVertex3f(1.0f, 1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, -1.0f); + glEnd(); + } +} +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511171006.cpp b/.history/src/main_20200511171006.cpp new file mode 100644 index 0000000..a00c9ad --- /dev/null +++ b/.history/src/main_20200511171006.cpp @@ -0,0 +1,189 @@ +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +class Color { + public: + float r,g,b,a; + Color(float r,float g,float b,float a) { + this->r=r; + this->g=g; + this->b=b; + this->a=a; + } +}; + +class Vertex { + public: + float x,y,z; +}; + +class Quad { + public: + Color color; + Vertex topL,topR,botR,botL; + void setColor(Color color); + void render(); +}; + +void Quad::setColor(Color c) { + color = c; +} + +void Quad::render() { + glColor4f(color.r,color.g,color.b,color.a); + glVertex3f(topL.x,topL.y,topL.z); + glVertex3f(topR.x,topR.y,topR.z); + glVertex3f(botR.x,botR.y,botR.z); + glVertex3f(botL.x,botL.y,botL.z); +} + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", gluErrorString(error)); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", gluErrorString(error)); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, "[ERROR] Could not initialize the OpenGL clear color\n%s\n", gluErrorString(error)); + success = false; + } + return success; +} +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} +void update() { +} +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + glColor3f(0.0f, 1.0f, 0.0f);//green + glVertex3f(0.5f,0.5f,0.5f); + glVertex3f(0.5f,-0.5f,0.5f); + + glColor3f(1.0f, 0.5f, 0.0f);// Orange + glVertex3f( 1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f( 1.0f, -1.0f, -1.0f); + + glColor3f(1.0f, 0.0f, 0.0f);// Red + glVertex3f( 1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f( 1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 1.0f, 0.0f);// Yellow + glVertex3f( 1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f( 1.0f, 1.0f, -1.0f); + + glColor3f(0.0f, 0.0f, 1.0f);// Blue + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 0.0f, 1.0f);// Magenta + glVertex3f(1.0f, 1.0f, -1.0f); + glVertex3f(1.0f, 1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, -1.0f); + glEnd(); + } +} +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511171313.cpp b/.history/src/main_20200511171313.cpp new file mode 100644 index 0000000..c283606 --- /dev/null +++ b/.history/src/main_20200511171313.cpp @@ -0,0 +1,201 @@ +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +class Color { + public: + float r,g,b,a; + Color(float r,float g,float b,float a) { + this->r=r; + this->g=g; + this->b=b; + this->a=a; + } +}; + +class Vertex { + public: + float x,y,z; +}; + +class Quad { + public: + Color color; + Vertex topL,topR,botR,botL; + void setColor(Color color); + void render(); +}; + +void Quad::setColor(Color c) { + color = c; +} + +void Quad::render() { + glColor4f(color.r,color.g,color.b,color.a); + glVertex3f(topL.x,topL.y,topL.z); + glVertex3f(topR.x,topR.y,topR.z); + glVertex3f(botR.x,botR.y,botR.z); + glVertex3f(botL.x,botL.y,botL.z); +} + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + glColor3f(0.0f, 1.0f, 0.0f);//green + glVertex3f(0.5f,0.5f,0.5f); + glVertex3f(0.5f,-0.5f,0.5f); + + glColor3f(1.0f, 0.5f, 0.0f);// Orange + glVertex3f( 1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f( 1.0f, -1.0f, -1.0f); + + glColor3f(1.0f, 0.0f, 0.0f);// Red + glVertex3f( 1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f( 1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 1.0f, 0.0f);// Yellow + glVertex3f( 1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f( 1.0f, 1.0f, -1.0f); + + glColor3f(0.0f, 0.0f, 1.0f);// Blue + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 0.0f, 1.0f);// Magenta + glVertex3f(1.0f, 1.0f, -1.0f); + glVertex3f(1.0f, 1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, -1.0f); + glEnd(); + } +} +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511171319.cpp b/.history/src/main_20200511171319.cpp new file mode 100644 index 0000000..a81d026 --- /dev/null +++ b/.history/src/main_20200511171319.cpp @@ -0,0 +1,202 @@ +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +class Color { + public: + float r,g,b,a; + Color(float r,float g,float b,float a) { + this->r=r; + this->g=g; + this->b=b; + this->a=a; + } +}; + +class Vertex { + public: + float x,y,z; +}; + +class Quad { + public: + Color color; + Vertex topL,topR,botR,botL; + void setColor(Color color); + void render(); +}; + +void Quad::setColor(Color c) { + color = c; +} + +void Quad::render() { + glColor4f(color.r,color.g,color.b,color.a); + glVertex3f(topL.x,topL.y,topL.z); + glVertex3f(topR.x,topR.y,topR.z); + glVertex3f(botR.x,botR.y,botR.z); + glVertex3f(botL.x,botL.y,botL.z); +} + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + glColor3f(0.0f, 1.0f, 0.0f);//green + glVertex3f(0.5f,0.5f,0.5f); + glVertex3f(0.5f,-0.5f,0.5f); + + glColor3f(1.0f, 0.5f, 0.0f);// Orange + glVertex3f( 1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f( 1.0f, -1.0f, -1.0f); + + glColor3f(1.0f, 0.0f, 0.0f);// Red + glVertex3f( 1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f( 1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 1.0f, 0.0f);// Yellow + glVertex3f( 1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f( 1.0f, 1.0f, -1.0f); + + glColor3f(0.0f, 0.0f, 1.0f);// Blue + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 0.0f, 1.0f);// Magenta + glVertex3f(1.0f, 1.0f, -1.0f); + glVertex3f(1.0f, 1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, -1.0f); + glEnd(); + } +} + +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511171334.cpp b/.history/src/main_20200511171334.cpp new file mode 100644 index 0000000..a81d026 --- /dev/null +++ b/.history/src/main_20200511171334.cpp @@ -0,0 +1,202 @@ +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +class Color { + public: + float r,g,b,a; + Color(float r,float g,float b,float a) { + this->r=r; + this->g=g; + this->b=b; + this->a=a; + } +}; + +class Vertex { + public: + float x,y,z; +}; + +class Quad { + public: + Color color; + Vertex topL,topR,botR,botL; + void setColor(Color color); + void render(); +}; + +void Quad::setColor(Color c) { + color = c; +} + +void Quad::render() { + glColor4f(color.r,color.g,color.b,color.a); + glVertex3f(topL.x,topL.y,topL.z); + glVertex3f(topR.x,topR.y,topR.z); + glVertex3f(botR.x,botR.y,botR.z); + glVertex3f(botL.x,botL.y,botL.z); +} + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + glColor3f(0.0f, 1.0f, 0.0f);//green + glVertex3f(0.5f,0.5f,0.5f); + glVertex3f(0.5f,-0.5f,0.5f); + + glColor3f(1.0f, 0.5f, 0.0f);// Orange + glVertex3f( 1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f( 1.0f, -1.0f, -1.0f); + + glColor3f(1.0f, 0.0f, 0.0f);// Red + glVertex3f( 1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f( 1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 1.0f, 0.0f);// Yellow + glVertex3f( 1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f( 1.0f, 1.0f, -1.0f); + + glColor3f(0.0f, 0.0f, 1.0f);// Blue + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 0.0f, 1.0f);// Magenta + glVertex3f(1.0f, 1.0f, -1.0f); + glVertex3f(1.0f, 1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, -1.0f); + glEnd(); + } +} + +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511171517.cpp b/.history/src/main_20200511171517.cpp new file mode 100644 index 0000000..ff776e3 --- /dev/null +++ b/.history/src/main_20200511171517.cpp @@ -0,0 +1,192 @@ +#include +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +class Vertex { + public: + float x,y,z; +}; + +class Quad { + public: + Color color; + Vertex topL,topR,botR,botL; + void setColor(Color color); + void render(); +}; + +void Quad::setColor(Color c) { + color = c; +} + +void Quad::render() { + glColor4f(color.r,color.g,color.b,color.a); + glVertex3f(topL.x,topL.y,topL.z); + glVertex3f(topR.x,topR.y,topR.z); + glVertex3f(botR.x,botR.y,botR.z); + glVertex3f(botL.x,botL.y,botL.z); +} + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + glColor3f(0.0f, 1.0f, 0.0f);//green + glVertex3f(0.5f,0.5f,0.5f); + glVertex3f(0.5f,-0.5f,0.5f); + + glColor3f(1.0f, 0.5f, 0.0f);// Orange + glVertex3f( 1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f( 1.0f, -1.0f, -1.0f); + + glColor3f(1.0f, 0.0f, 0.0f);// Red + glVertex3f( 1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f( 1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 1.0f, 0.0f);// Yellow + glVertex3f( 1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f( 1.0f, 1.0f, -1.0f); + + glColor3f(0.0f, 0.0f, 1.0f);// Blue + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 0.0f, 1.0f);// Magenta + glVertex3f(1.0f, 1.0f, -1.0f); + glVertex3f(1.0f, 1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, -1.0f); + glEnd(); + } +} + +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511171546.cpp b/.history/src/main_20200511171546.cpp new file mode 100644 index 0000000..ff776e3 --- /dev/null +++ b/.history/src/main_20200511171546.cpp @@ -0,0 +1,192 @@ +#include +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +class Vertex { + public: + float x,y,z; +}; + +class Quad { + public: + Color color; + Vertex topL,topR,botR,botL; + void setColor(Color color); + void render(); +}; + +void Quad::setColor(Color c) { + color = c; +} + +void Quad::render() { + glColor4f(color.r,color.g,color.b,color.a); + glVertex3f(topL.x,topL.y,topL.z); + glVertex3f(topR.x,topR.y,topR.z); + glVertex3f(botR.x,botR.y,botR.z); + glVertex3f(botL.x,botL.y,botL.z); +} + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + glColor3f(0.0f, 1.0f, 0.0f);//green + glVertex3f(0.5f,0.5f,0.5f); + glVertex3f(0.5f,-0.5f,0.5f); + + glColor3f(1.0f, 0.5f, 0.0f);// Orange + glVertex3f( 1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f( 1.0f, -1.0f, -1.0f); + + glColor3f(1.0f, 0.0f, 0.0f);// Red + glVertex3f( 1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f( 1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 1.0f, 0.0f);// Yellow + glVertex3f( 1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f( 1.0f, 1.0f, -1.0f); + + glColor3f(0.0f, 0.0f, 1.0f);// Blue + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 0.0f, 1.0f);// Magenta + glVertex3f(1.0f, 1.0f, -1.0f); + glVertex3f(1.0f, 1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, -1.0f); + glEnd(); + } +} + +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511171549.cpp b/.history/src/main_20200511171549.cpp new file mode 100644 index 0000000..3cc97e1 --- /dev/null +++ b/.history/src/main_20200511171549.cpp @@ -0,0 +1,192 @@ +#include +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +class Vertex { + public: + float x,y,z; +}; + +class Quad { + public: + Color color; + Vertex topL,topR,botR,botL; + void setColor(Color color); + void render(); +}; + +void Quad::setColor(Color c) { + color = c; +} + +void Quad::render() { + glColor4f(color.r,color.g,color.b,color.a); + glVertex3f(topL.x,topL.y,topL.z); + glVertex3f(topR.x,topR.y,topR.z); + glVertex3f(botR.x,botR.y,botR.z); + glVertex3f(botL.x,botL.y,botL.z); +} + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + glColor3f(0.0f, 1.0f, 0.0f);//green + glVertex3f(0.5f,0.5f,0.5f); + glVertex3f(0.5f,-0.5f,0.5f); + + glColor3f(1.0f, 0.5f, 0.0f);// Orange + glVertex3f( 1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f( 1.0f, -1.0f, -1.0f); + + glColor3f(1.0f, 0.0f, 0.0f);// Red + glVertex3f( 1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f( 1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 1.0f, 0.0f);// Yellow + glVertex3f( 1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f( 1.0f, 1.0f, -1.0f); + + glColor3f(0.0f, 0.0f, 1.0f);// Blue + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 0.0f, 1.0f);// Magenta + glVertex3f(1.0f, 1.0f, -1.0f); + glVertex3f(1.0f, 1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, -1.0f); + glEnd(); + } +} + +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511171615.cpp b/.history/src/main_20200511171615.cpp new file mode 100644 index 0000000..5493cef --- /dev/null +++ b/.history/src/main_20200511171615.cpp @@ -0,0 +1,188 @@ +#include +#include +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +class Quad { + public: + Color color; + Vertex topL,topR,botR,botL; + void setColor(Color color); + void render(); +}; + +void Quad::setColor(Color c) { + color = c; +} + +void Quad::render() { + glColor4f(color.r,color.g,color.b,color.a); + glVertex3f(topL.x,topL.y,topL.z); + glVertex3f(topR.x,topR.y,topR.z); + glVertex3f(botR.x,botR.y,botR.z); + glVertex3f(botL.x,botL.y,botL.z); +} + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + glColor3f(0.0f, 1.0f, 0.0f);//green + glVertex3f(0.5f,0.5f,0.5f); + glVertex3f(0.5f,-0.5f,0.5f); + + glColor3f(1.0f, 0.5f, 0.0f);// Orange + glVertex3f( 1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f( 1.0f, -1.0f, -1.0f); + + glColor3f(1.0f, 0.0f, 0.0f);// Red + glVertex3f( 1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f( 1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 1.0f, 0.0f);// Yellow + glVertex3f( 1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f( 1.0f, 1.0f, -1.0f); + + glColor3f(0.0f, 0.0f, 1.0f);// Blue + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 0.0f, 1.0f);// Magenta + glVertex3f(1.0f, 1.0f, -1.0f); + glVertex3f(1.0f, 1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, -1.0f); + glEnd(); + } +} + +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511171753.cpp b/.history/src/main_20200511171753.cpp new file mode 100644 index 0000000..654c3d8 --- /dev/null +++ b/.history/src/main_20200511171753.cpp @@ -0,0 +1,166 @@ +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + glColor3f(0.0f, 1.0f, 0.0f);//green + glVertex3f(0.5f,0.5f,0.5f); + glVertex3f(0.5f,-0.5f,0.5f); + + glColor3f(1.0f, 0.5f, 0.0f);// Orange + glVertex3f( 1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f( 1.0f, -1.0f, -1.0f); + + glColor3f(1.0f, 0.0f, 0.0f);// Red + glVertex3f( 1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f( 1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 1.0f, 0.0f);// Yellow + glVertex3f( 1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f( 1.0f, 1.0f, -1.0f); + + glColor3f(0.0f, 0.0f, 1.0f);// Blue + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 0.0f, 1.0f);// Magenta + glVertex3f(1.0f, 1.0f, -1.0f); + glVertex3f(1.0f, 1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, -1.0f); + glEnd(); + } +} + +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511175200.cpp b/.history/src/main_20200511175200.cpp new file mode 100644 index 0000000..654c3d8 --- /dev/null +++ b/.history/src/main_20200511175200.cpp @@ -0,0 +1,166 @@ +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + glColor3f(0.0f, 1.0f, 0.0f);//green + glVertex3f(0.5f,0.5f,0.5f); + glVertex3f(0.5f,-0.5f,0.5f); + + glColor3f(1.0f, 0.5f, 0.0f);// Orange + glVertex3f( 1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f( 1.0f, -1.0f, -1.0f); + + glColor3f(1.0f, 0.0f, 0.0f);// Red + glVertex3f( 1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f( 1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 1.0f, 0.0f);// Yellow + glVertex3f( 1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f( 1.0f, 1.0f, -1.0f); + + glColor3f(0.0f, 0.0f, 1.0f);// Blue + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 0.0f, 1.0f);// Magenta + glVertex3f(1.0f, 1.0f, -1.0f); + glVertex3f(1.0f, 1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, -1.0f); + glEnd(); + } +} + +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511175201.cpp b/.history/src/main_20200511175201.cpp new file mode 100644 index 0000000..654c3d8 --- /dev/null +++ b/.history/src/main_20200511175201.cpp @@ -0,0 +1,166 @@ +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + glColor3f(0.0f, 1.0f, 0.0f);//green + glVertex3f(0.5f,0.5f,0.5f); + glVertex3f(0.5f,-0.5f,0.5f); + + glColor3f(1.0f, 0.5f, 0.0f);// Orange + glVertex3f( 1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f( 1.0f, -1.0f, -1.0f); + + glColor3f(1.0f, 0.0f, 0.0f);// Red + glVertex3f( 1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f( 1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 1.0f, 0.0f);// Yellow + glVertex3f( 1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f( 1.0f, 1.0f, -1.0f); + + glColor3f(0.0f, 0.0f, 1.0f);// Blue + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 0.0f, 1.0f);// Magenta + glVertex3f(1.0f, 1.0f, -1.0f); + glVertex3f(1.0f, 1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, -1.0f); + glEnd(); + } +} + +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511175225.cpp b/.history/src/main_20200511175225.cpp new file mode 100644 index 0000000..d898d0e --- /dev/null +++ b/.history/src/main_20200511175225.cpp @@ -0,0 +1,167 @@ +#include +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + glColor3f(0.0f, 1.0f, 0.0f);//green + glVertex3f(0.5f,0.5f,0.5f); + glVertex3f(0.5f,-0.5f,0.5f); + + glColor3f(1.0f, 0.5f, 0.0f);// Orange + glVertex3f( 1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f( 1.0f, -1.0f, -1.0f); + + glColor3f(1.0f, 0.0f, 0.0f);// Red + glVertex3f( 1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f( 1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 1.0f, 0.0f);// Yellow + glVertex3f( 1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f( 1.0f, 1.0f, -1.0f); + + glColor3f(0.0f, 0.0f, 1.0f);// Blue + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 0.0f, 1.0f);// Magenta + glVertex3f(1.0f, 1.0f, -1.0f); + glVertex3f(1.0f, 1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, -1.0f); + glEnd(); + } +} + +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511175904.cpp b/.history/src/main_20200511175904.cpp new file mode 100644 index 0000000..d898d0e --- /dev/null +++ b/.history/src/main_20200511175904.cpp @@ -0,0 +1,167 @@ +#include +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + glColor3f(0.0f, 1.0f, 0.0f);//green + glVertex3f(0.5f,0.5f,0.5f); + glVertex3f(0.5f,-0.5f,0.5f); + + glColor3f(1.0f, 0.5f, 0.0f);// Orange + glVertex3f( 1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f( 1.0f, -1.0f, -1.0f); + + glColor3f(1.0f, 0.0f, 0.0f);// Red + glVertex3f( 1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f( 1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 1.0f, 0.0f);// Yellow + glVertex3f( 1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f( 1.0f, 1.0f, -1.0f); + + glColor3f(0.0f, 0.0f, 1.0f);// Blue + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 0.0f, 1.0f);// Magenta + glVertex3f(1.0f, 1.0f, -1.0f); + glVertex3f(1.0f, 1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, -1.0f); + glEnd(); + } +} + +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511180500.cpp b/.history/src/main_20200511180500.cpp new file mode 100644 index 0000000..d898d0e --- /dev/null +++ b/.history/src/main_20200511180500.cpp @@ -0,0 +1,167 @@ +#include +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + glColor3f(0.0f, 1.0f, 0.0f);//green + glVertex3f(0.5f,0.5f,0.5f); + glVertex3f(0.5f,-0.5f,0.5f); + + glColor3f(1.0f, 0.5f, 0.0f);// Orange + glVertex3f( 1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f( 1.0f, -1.0f, -1.0f); + + glColor3f(1.0f, 0.0f, 0.0f);// Red + glVertex3f( 1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f( 1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 1.0f, 0.0f);// Yellow + glVertex3f( 1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f( 1.0f, 1.0f, -1.0f); + + glColor3f(0.0f, 0.0f, 1.0f);// Blue + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 0.0f, 1.0f);// Magenta + glVertex3f(1.0f, 1.0f, -1.0f); + glVertex3f(1.0f, 1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, -1.0f); + glEnd(); + } +} + +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511185350.cpp b/.history/src/main_20200511185350.cpp new file mode 100644 index 0000000..d898d0e --- /dev/null +++ b/.history/src/main_20200511185350.cpp @@ -0,0 +1,167 @@ +#include +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + glColor3f(0.0f, 1.0f, 0.0f);//green + glVertex3f(0.5f,0.5f,0.5f); + glVertex3f(0.5f,-0.5f,0.5f); + + glColor3f(1.0f, 0.5f, 0.0f);// Orange + glVertex3f( 1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f( 1.0f, -1.0f, -1.0f); + + glColor3f(1.0f, 0.0f, 0.0f);// Red + glVertex3f( 1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + glVertex3f( 1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 1.0f, 0.0f);// Yellow + glVertex3f( 1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f( 1.0f, 1.0f, -1.0f); + + glColor3f(0.0f, 0.0f, 1.0f);// Blue + glVertex3f(-1.0f, 1.0f, 1.0f); + glVertex3f(-1.0f, 1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, -1.0f); + glVertex3f(-1.0f, -1.0f, 1.0f); + + glColor3f(1.0f, 0.0f, 1.0f);// Magenta + glVertex3f(1.0f, 1.0f, -1.0f); + glVertex3f(1.0f, 1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, 1.0f); + glVertex3f(1.0f, -1.0f, -1.0f); + glEnd(); + } +} + +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511185420.cpp b/.history/src/main_20200511185420.cpp new file mode 100644 index 0000000..8a6747d --- /dev/null +++ b/.history/src/main_20200511185420.cpp @@ -0,0 +1,134 @@ +#include +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + glEnd(); + } +} + +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511191949.cpp b/.history/src/main_20200511191949.cpp new file mode 100644 index 0000000..e7bd210 --- /dev/null +++ b/.history/src/main_20200511191949.cpp @@ -0,0 +1,135 @@ +#include +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + + glEnd(); + } +} + +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511192159.cpp b/.history/src/main_20200511192159.cpp new file mode 100644 index 0000000..2d81a93 --- /dev/null +++ b/.history/src/main_20200511192159.cpp @@ -0,0 +1,139 @@ +#include +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float a = 0.5f; +Vertex tlb(-0.5f,0.5f,-0.5f); +Vertex trb(0.5f,0.5f,) + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + + glEnd(); + } +} + +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511194222.cpp b/.history/src/main_20200511194222.cpp new file mode 100644 index 0000000..8cc9020 --- /dev/null +++ b/.history/src/main_20200511194222.cpp @@ -0,0 +1,141 @@ +#include +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float a = 0.5f; +Vertex btl(-0.5f,0.5f,-0.5f); +Vertex btr(0.5f,0.5f,-0.5f); +Vertex bbr(0.5f,-0.5f,-0.5f); +Vertex bbl(-0.5f,-0.5f,-0.5f); + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + + glEnd(); + } +} + +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511194426.cpp b/.history/src/main_20200511194426.cpp new file mode 100644 index 0000000..4984d9c --- /dev/null +++ b/.history/src/main_20200511194426.cpp @@ -0,0 +1,146 @@ +#include +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float a = 0.5f; +Vertex btl(-0.5f,0.5f,-0.5f); +Vertex btr(0.5f,0.5f,-0.5f); +Vertex bbr(0.5f,-0.5f,-0.5f); +Vertex bbl(-0.5f,-0.5f,-0.5f); + +Vertex ftl(-0.5f,0.5f,0.5f); +Vertex ftr(0.5f,0.5f,0.5f); +Vertex fbr(0.5f,-0.5f,0.5f); +Vertex fbl(-0.5f,-0.5f,0.5f); + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + + glEnd(); + } +} + +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511194624.cpp b/.history/src/main_20200511194624.cpp new file mode 100644 index 0000000..4b267a4 --- /dev/null +++ b/.history/src/main_20200511194624.cpp @@ -0,0 +1,148 @@ +#include +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float a = 0.5f; +Vertex btl(-0.5f,0.5f,-0.5f); +Vertex btr(0.5f,0.5f,-0.5f); +Vertex bbr(0.5f,-0.5f,-0.5f); +Vertex bbl(-0.5f,-0.5f,-0.5f); + +Vertex ftl(-0.5f,0.5f,0.5f); +Vertex ftr(0.5f,0.5f,0.5f); +Vertex fbr(0.5f,-0.5f,0.5f); +Vertex fbl(-0.5f,-0.5f,0.5f); + +Quad left(btl,ftl,bbl,fbl); + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + + glEnd(); + } +} + +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511194806.cpp b/.history/src/main_20200511194806.cpp new file mode 100644 index 0000000..8e3b244 --- /dev/null +++ b/.history/src/main_20200511194806.cpp @@ -0,0 +1,150 @@ +#include +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float a = 0.5f; +Vertex btl(-0.5f,0.5f,-0.5f); +Vertex btr(0.5f,0.5f,-0.5f); +Vertex bbr(0.5f,-0.5f,-0.5f); +Vertex bbl(-0.5f,-0.5f,-0.5f); + +Vertex ftl(-0.5f,0.5f,0.5f); +Vertex ftr(0.5f,0.5f,0.5f); +Vertex fbr(0.5f,-0.5f,0.5f); +Vertex fbl(-0.5f,-0.5f,0.5f); + +Quad left(btl,ftl,bbl,fbl); +Quad top(btl,btr,ftl,ftr); +Quad right(ftr,btr,fbr,bbr); + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + + glEnd(); + } +} + +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511194836.cpp b/.history/src/main_20200511194836.cpp new file mode 100644 index 0000000..1320c3e --- /dev/null +++ b/.history/src/main_20200511194836.cpp @@ -0,0 +1,151 @@ +#include +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float a = 0.5f; +Vertex btl(-0.5f,0.5f,-0.5f); +Vertex btr(0.5f,0.5f,-0.5f); +Vertex bbr(0.5f,-0.5f,-0.5f); +Vertex bbl(-0.5f,-0.5f,-0.5f); + +Vertex ftl(-0.5f,0.5f,0.5f); +Vertex ftr(0.5f,0.5f,0.5f); +Vertex fbr(0.5f,-0.5f,0.5f); +Vertex fbl(-0.5f,-0.5f,0.5f); + +Quad left(btl,ftl,bbl,fbl); +Quad top(btl,btr,ftl,ftr); +Quad right(ftr,btr,fbr,bbr); +Quad bottom(fbl,fbr,bbl,bbr); + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + + glEnd(); + } +} + +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511194848.cpp b/.history/src/main_20200511194848.cpp new file mode 100644 index 0000000..96df6f9 --- /dev/null +++ b/.history/src/main_20200511194848.cpp @@ -0,0 +1,151 @@ +#include +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float a = 0.5f; +Vertex btl(-0.5f,0.5f,-0.5f); +Vertex btr(0.5f,0.5f,-0.5f); +Vertex bbr(0.5f,-0.5f,-0.5f); +Vertex bbl(-0.5f,-0.5f,-0.5f); + +Vertex ftl(-0.5f,0.5f,0.5f); +Vertex ftr(0.5f,0.5f,0.5f); +Vertex fbr(0.5f,-0.5f,0.5f); +Vertex fbl(-0.5f,-0.5f,0.5f); + +Quad left(btl,ftl,bbl,fbl); +Quad top(btl,btr,ftl,ftr); +Quad right(ftr,btr,fbr,bbr); +Quad bottom(fbl,fbr,bbl,bbr); + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + left.render(); + glEnd(); + } +} + +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511194909.cpp b/.history/src/main_20200511194909.cpp new file mode 100644 index 0000000..d9ee635 --- /dev/null +++ b/.history/src/main_20200511194909.cpp @@ -0,0 +1,152 @@ +#include +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float a = 0.5f; +Vertex btl(-0.5f,0.5f,-0.5f); +Vertex btr(0.5f,0.5f,-0.5f); +Vertex bbr(0.5f,-0.5f,-0.5f); +Vertex bbl(-0.5f,-0.5f,-0.5f); + +Vertex ftl(-0.5f,0.5f,0.5f); +Vertex ftr(0.5f,0.5f,0.5f); +Vertex fbr(0.5f,-0.5f,0.5f); +Vertex fbl(-0.5f,-0.5f,0.5f); + +Quad left(btl,ftl,bbl,fbl); +left.setColor(); +Quad top(btl,btr,ftl,ftr); +Quad right(ftr,btr,fbr,bbr); +Quad bottom(fbl,fbr,bbl,bbr); + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + left.render(); + glEnd(); + } +} + +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511194919.cpp b/.history/src/main_20200511194919.cpp new file mode 100644 index 0000000..96df6f9 --- /dev/null +++ b/.history/src/main_20200511194919.cpp @@ -0,0 +1,151 @@ +#include +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float a = 0.5f; +Vertex btl(-0.5f,0.5f,-0.5f); +Vertex btr(0.5f,0.5f,-0.5f); +Vertex bbr(0.5f,-0.5f,-0.5f); +Vertex bbl(-0.5f,-0.5f,-0.5f); + +Vertex ftl(-0.5f,0.5f,0.5f); +Vertex ftr(0.5f,0.5f,0.5f); +Vertex fbr(0.5f,-0.5f,0.5f); +Vertex fbl(-0.5f,-0.5f,0.5f); + +Quad left(btl,ftl,bbl,fbl); +Quad top(btl,btr,ftl,ftr); +Quad right(ftr,btr,fbr,bbr); +Quad bottom(fbl,fbr,bbl,bbr); + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + left.render(); + glEnd(); + } +} + +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511195619.cpp b/.history/src/main_20200511195619.cpp new file mode 100644 index 0000000..756f8ed --- /dev/null +++ b/.history/src/main_20200511195619.cpp @@ -0,0 +1,152 @@ +#include +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float a = 0.5f; +Vertex btl(-0.5f,0.5f,-0.5f); +Vertex btr(0.5f,0.5f,-0.5f); +Vertex bbr(0.5f,-0.5f,-0.5f); +Vertex bbl(-0.5f,-0.5f,-0.5f); + +Vertex ftl(-0.5f,0.5f,0.5f); +Vertex ftr(0.5f,0.5f,0.5f); +Vertex fbr(0.5f,-0.5f,0.5f); +Vertex fbl(-0.5f,-0.5f,0.5f); + +Quad left(btl,ftl,bbl,fbl); +Quad top(btl,btr,ftl,ftr); +Quad right(ftr,btr,fbr,bbr); +Quad bottom(fbl,fbr,bbl,bbr); + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + left.render(); + glEnd(); + } +} + +int main() { + left.setColor() + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511195626.cpp b/.history/src/main_20200511195626.cpp new file mode 100644 index 0000000..f8cdc0d --- /dev/null +++ b/.history/src/main_20200511195626.cpp @@ -0,0 +1,152 @@ +#include +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float a = 0.5f; +Vertex btl(-0.5f,0.5f,-0.5f); +Vertex btr(0.5f,0.5f,-0.5f); +Vertex bbr(0.5f,-0.5f,-0.5f); +Vertex bbl(-0.5f,-0.5f,-0.5f); + +Vertex ftl(-0.5f,0.5f,0.5f); +Vertex ftr(0.5f,0.5f,0.5f); +Vertex fbr(0.5f,-0.5f,0.5f); +Vertex fbl(-0.5f,-0.5f,0.5f); + +Quad left(btl,ftl,bbl,fbl); +Quad top(btl,btr,ftl,ftr); +Quad right(ftr,btr,fbr,bbr); +Quad bottom(fbl,fbr,bbl,bbr); + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + left.render(); + glEnd(); + } +} + +int main() { + left.setColor(); + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511195635.cpp b/.history/src/main_20200511195635.cpp new file mode 100644 index 0000000..c0d61a3 --- /dev/null +++ b/.history/src/main_20200511195635.cpp @@ -0,0 +1,152 @@ +#include +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float a = 0.5f; +Vertex btl(-0.5f,0.5f,-0.5f); +Vertex btr(0.5f,0.5f,-0.5f); +Vertex bbr(0.5f,-0.5f,-0.5f); +Vertex bbl(-0.5f,-0.5f,-0.5f); + +Vertex ftl(-0.5f,0.5f,0.5f); +Vertex ftr(0.5f,0.5f,0.5f); +Vertex fbr(0.5f,-0.5f,0.5f); +Vertex fbl(-0.5f,-0.5f,0.5f); + +Quad left(btl,ftl,bbl,fbl); +Quad top(btl,btr,ftl,ftr); +Quad right(ftr,btr,fbr,bbr); +Quad bottom(fbl,fbr,bbl,bbr); + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + left.render(); + glEnd(); + } +} + +int main() { + left.setColor(RED_f4); + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511195700.cpp b/.history/src/main_20200511195700.cpp new file mode 100644 index 0000000..5752e12 --- /dev/null +++ b/.history/src/main_20200511195700.cpp @@ -0,0 +1,152 @@ +#include +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float a = 0.5f; +Vertex btl(-0.5f,0.5f,-0.5f); +Vertex btr(0.5f,0.5f,-0.5f); +Vertex bbr(0.5f,-0.5f,-0.5f); +Vertex bbl(-0.5f,-0.5f,-0.5f); + +Vertex ftl(-0.5f,0.5f,0.5f); +Vertex ftr(0.5f,0.5f,0.5f); +Vertex fbr(0.5f,-0.5f,0.5f); +Vertex fbl(-0.5f,-0.5f,0.5f); + +Quad left(btl,ftl,bbl,fbl); +Quad top(btl,btr,ftl,ftr); +Quad right(ftr,btr,fbr,bbr); +Quad bottom(fbl,fbr,bbl,bbr); + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + left.render(); + glEnd(); + } +} + +int main() { + left.setColor(Color(RED_f4)); + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511195754.cpp b/.history/src/main_20200511195754.cpp new file mode 100644 index 0000000..fbf2e62 --- /dev/null +++ b/.history/src/main_20200511195754.cpp @@ -0,0 +1,155 @@ +#include +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float a = 0.5f; +Vertex btl(-0.5f,0.5f,-0.5f); +Vertex btr(0.5f,0.5f,-0.5f); +Vertex bbr(0.5f,-0.5f,-0.5f); +Vertex bbl(-0.5f,-0.5f,-0.5f); + +Vertex ftl(-0.5f,0.5f,0.5f); +Vertex ftr(0.5f,0.5f,0.5f); +Vertex fbr(0.5f,-0.5f,0.5f); +Vertex fbl(-0.5f,-0.5f,0.5f); + +Quad left(btl,ftl,bbl,fbl); +Quad top(btl,btr,ftl,ftr); +Quad right(ftr,btr,fbr,bbr); +Quad bottom(fbl,fbr,bbl,bbr); + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + left.render(); + glEnd(); + } +} + +int main() { + left.setColor(Color(RED_f4)); + top.setColor(Color(GREEN_f4)); + right.setColor(Color(BLUE_f4)); + bottom.setColor(Color(PURPLE_f4)); + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511195830.cpp b/.history/src/main_20200511195830.cpp new file mode 100644 index 0000000..a3913b1 --- /dev/null +++ b/.history/src/main_20200511195830.cpp @@ -0,0 +1,158 @@ +#include +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float a = 0.5f; +Vertex btl(-0.5f,0.5f,-0.5f); +Vertex btr(0.5f,0.5f,-0.5f); +Vertex bbr(0.5f,-0.5f,-0.5f); +Vertex bbl(-0.5f,-0.5f,-0.5f); + +Vertex ftl(-0.5f,0.5f,0.5f); +Vertex ftr(0.5f,0.5f,0.5f); +Vertex fbr(0.5f,-0.5f,0.5f); +Vertex fbl(-0.5f,-0.5f,0.5f); + +Quad left(btl,ftl,bbl,fbl); +Quad top(btl,btr,ftl,ftr); +Quad right(ftr,btr,fbr,bbr); +Quad bottom(fbl,fbr,bbl,bbr); + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + left.render(); + top.render(); + right.render(); + bottom.render(); + glEnd(); + } +} + +int main() { + left.setColor(Color(RED_f4)); + top.setColor(Color(GREEN_f4)); + right.setColor(Color(BLUE_f4)); + bottom.setColor(Color(PURPLE_f4)); + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511195907.cpp b/.history/src/main_20200511195907.cpp new file mode 100644 index 0000000..af4f752 --- /dev/null +++ b/.history/src/main_20200511195907.cpp @@ -0,0 +1,158 @@ +#include +#include +#include +#include +#include +#include +#include <"Quad.h"> + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float a = 0.5f; +Vertex btl(-0.5f,0.5f,-0.5f); +Vertex btr(0.5f,0.5f,-0.5f); +Vertex bbr(0.5f,-0.5f,-0.5f); +Vertex bbl(-0.5f,-0.5f,-0.5f); + +Vertex ftl(-0.5f,0.5f,0.5f); +Vertex ftr(0.5f,0.5f,0.5f); +Vertex fbr(0.5f,-0.5f,0.5f); +Vertex fbl(-0.5f,-0.5f,0.5f); + +Quad left(btl,ftl,bbl,fbl); +Quad top(btl,btr,ftl,ftr); +Quad right(ftr,btr,fbr,bbr); +Quad bottom(fbl,fbr,bbl,bbr); + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + left.render(); + top.render(); + right.render(); + bottom.render(); + glEnd(); + } +} + +int main() { + left.setColor(Color(RED_f4)); + top.setColor(Color(GREEN_f4)); + right.setColor(Color(BLUE_f4)); + bottom.setColor(Color(PURPLE_f4)); + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511195930.cpp b/.history/src/main_20200511195930.cpp new file mode 100644 index 0000000..5fc5975 --- /dev/null +++ b/.history/src/main_20200511195930.cpp @@ -0,0 +1,158 @@ +#include +#include +#include +#include +#include +#include +#include <"src/Quad.h"> + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float a = 0.5f; +Vertex btl(-0.5f,0.5f,-0.5f); +Vertex btr(0.5f,0.5f,-0.5f); +Vertex bbr(0.5f,-0.5f,-0.5f); +Vertex bbl(-0.5f,-0.5f,-0.5f); + +Vertex ftl(-0.5f,0.5f,0.5f); +Vertex ftr(0.5f,0.5f,0.5f); +Vertex fbr(0.5f,-0.5f,0.5f); +Vertex fbl(-0.5f,-0.5f,0.5f); + +Quad left(btl,ftl,bbl,fbl); +Quad top(btl,btr,ftl,ftr); +Quad right(ftr,btr,fbr,bbr); +Quad bottom(fbl,fbr,bbl,bbr); + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + left.render(); + top.render(); + right.render(); + bottom.render(); + glEnd(); + } +} + +int main() { + left.setColor(Color(RED_f4)); + top.setColor(Color(GREEN_f4)); + right.setColor(Color(BLUE_f4)); + bottom.setColor(Color(PURPLE_f4)); + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511195933.cpp b/.history/src/main_20200511195933.cpp new file mode 100644 index 0000000..5fc5975 --- /dev/null +++ b/.history/src/main_20200511195933.cpp @@ -0,0 +1,158 @@ +#include +#include +#include +#include +#include +#include +#include <"src/Quad.h"> + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float a = 0.5f; +Vertex btl(-0.5f,0.5f,-0.5f); +Vertex btr(0.5f,0.5f,-0.5f); +Vertex bbr(0.5f,-0.5f,-0.5f); +Vertex bbl(-0.5f,-0.5f,-0.5f); + +Vertex ftl(-0.5f,0.5f,0.5f); +Vertex ftr(0.5f,0.5f,0.5f); +Vertex fbr(0.5f,-0.5f,0.5f); +Vertex fbl(-0.5f,-0.5f,0.5f); + +Quad left(btl,ftl,bbl,fbl); +Quad top(btl,btr,ftl,ftr); +Quad right(ftr,btr,fbr,bbr); +Quad bottom(fbl,fbr,bbl,bbr); + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + left.render(); + top.render(); + right.render(); + bottom.render(); + glEnd(); + } +} + +int main() { + left.setColor(Color(RED_f4)); + top.setColor(Color(GREEN_f4)); + right.setColor(Color(BLUE_f4)); + bottom.setColor(Color(PURPLE_f4)); + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511195942.cpp b/.history/src/main_20200511195942.cpp new file mode 100644 index 0000000..af4f752 --- /dev/null +++ b/.history/src/main_20200511195942.cpp @@ -0,0 +1,158 @@ +#include +#include +#include +#include +#include +#include +#include <"Quad.h"> + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float a = 0.5f; +Vertex btl(-0.5f,0.5f,-0.5f); +Vertex btr(0.5f,0.5f,-0.5f); +Vertex bbr(0.5f,-0.5f,-0.5f); +Vertex bbl(-0.5f,-0.5f,-0.5f); + +Vertex ftl(-0.5f,0.5f,0.5f); +Vertex ftr(0.5f,0.5f,0.5f); +Vertex fbr(0.5f,-0.5f,0.5f); +Vertex fbl(-0.5f,-0.5f,0.5f); + +Quad left(btl,ftl,bbl,fbl); +Quad top(btl,btr,ftl,ftr); +Quad right(ftr,btr,fbr,bbr); +Quad bottom(fbl,fbr,bbl,bbr); + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + left.render(); + top.render(); + right.render(); + bottom.render(); + glEnd(); + } +} + +int main() { + left.setColor(Color(RED_f4)); + top.setColor(Color(GREEN_f4)); + right.setColor(Color(BLUE_f4)); + bottom.setColor(Color(PURPLE_f4)); + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511200052.cpp b/.history/src/main_20200511200052.cpp new file mode 100644 index 0000000..019cdf7 --- /dev/null +++ b/.history/src/main_20200511200052.cpp @@ -0,0 +1,158 @@ +#include +#include +#include +#include +#include +#include +#include "Quad.h" + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float a = 0.5f; +Vertex btl(-0.5f,0.5f,-0.5f); +Vertex btr(0.5f,0.5f,-0.5f); +Vertex bbr(0.5f,-0.5f,-0.5f); +Vertex bbl(-0.5f,-0.5f,-0.5f); + +Vertex ftl(-0.5f,0.5f,0.5f); +Vertex ftr(0.5f,0.5f,0.5f); +Vertex fbr(0.5f,-0.5f,0.5f); +Vertex fbl(-0.5f,-0.5f,0.5f); + +Quad left(btl,ftl,bbl,fbl); +Quad top(btl,btr,ftl,ftr); +Quad right(ftr,btr,fbr,bbr); +Quad bottom(fbl,fbr,bbl,bbr); + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + left.render(); + top.render(); + right.render(); + bottom.render(); + glEnd(); + } +} + +int main() { + left.setColor(Color(RED_f4)); + top.setColor(Color(GREEN_f4)); + right.setColor(Color(BLUE_f4)); + bottom.setColor(Color(PURPLE_f4)); + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511200156.cpp b/.history/src/main_20200511200156.cpp new file mode 100644 index 0000000..019cdf7 --- /dev/null +++ b/.history/src/main_20200511200156.cpp @@ -0,0 +1,158 @@ +#include +#include +#include +#include +#include +#include +#include "Quad.h" + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float a = 0.5f; +Vertex btl(-0.5f,0.5f,-0.5f); +Vertex btr(0.5f,0.5f,-0.5f); +Vertex bbr(0.5f,-0.5f,-0.5f); +Vertex bbl(-0.5f,-0.5f,-0.5f); + +Vertex ftl(-0.5f,0.5f,0.5f); +Vertex ftr(0.5f,0.5f,0.5f); +Vertex fbr(0.5f,-0.5f,0.5f); +Vertex fbl(-0.5f,-0.5f,0.5f); + +Quad left(btl,ftl,bbl,fbl); +Quad top(btl,btr,ftl,ftr); +Quad right(ftr,btr,fbr,bbr); +Quad bottom(fbl,fbr,bbl,bbr); + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + left.render(); + top.render(); + right.render(); + bottom.render(); + glEnd(); + } +} + +int main() { + left.setColor(Color(RED_f4)); + top.setColor(Color(GREEN_f4)); + right.setColor(Color(BLUE_f4)); + bottom.setColor(Color(PURPLE_f4)); + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511235857.cpp b/.history/src/main_20200511235857.cpp new file mode 100644 index 0000000..92cbe27 --- /dev/null +++ b/.history/src/main_20200511235857.cpp @@ -0,0 +1,158 @@ +#include +#include +#include +#include +#include +#include +#include "Quad.h" + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float a = 0.5f; +Vertex btl(-0.5f,0.5f,-0.5f); +Vertex btr(0.5f,0.5f,-0.5f); +Vertex bbr(0.5f,-0.5f,-0.5f); +Vertex bbl(-0.5f,-0.5f,-0.5f); + +Vertex ftl(-0.5f,0.5f,0.5f); +Vertex ftr(0.5f,0.5f,0.5f); +Vertex fbr(0.5f,-0.5f,0.5f); +Vertex fbl(-0.5f,-0.5f,0.5f); + +Quad left(btl,ftl,bbl,fbl); +Quad top(btl,btr,ftl,ftr); +Quad right(ftr,btr,fbr,bbr); +Quad bottom(fbl,fbr,bbl,bbr); + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + left.render(); + top.render(); + right.render(); + bottom.render(); + glEnd(); + } +} + +int main() { + left.setColor(Color(RED_f4)); + top.setColor(Color(GREEN_f4)); + right.setColor(Color(BLUE_f4)); + bottom.setColor(Color(PURPLE_f4)); + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511235900.cpp b/.history/src/main_20200511235900.cpp new file mode 100644 index 0000000..019cdf7 --- /dev/null +++ b/.history/src/main_20200511235900.cpp @@ -0,0 +1,158 @@ +#include +#include +#include +#include +#include +#include +#include "Quad.h" + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float a = 0.5f; +Vertex btl(-0.5f,0.5f,-0.5f); +Vertex btr(0.5f,0.5f,-0.5f); +Vertex bbr(0.5f,-0.5f,-0.5f); +Vertex bbl(-0.5f,-0.5f,-0.5f); + +Vertex ftl(-0.5f,0.5f,0.5f); +Vertex ftr(0.5f,0.5f,0.5f); +Vertex fbr(0.5f,-0.5f,0.5f); +Vertex fbl(-0.5f,-0.5f,0.5f); + +Quad left(btl,ftl,bbl,fbl); +Quad top(btl,btr,ftl,ftr); +Quad right(ftr,btr,fbr,bbr); +Quad bottom(fbl,fbr,bbl,bbr); + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + left.render(); + top.render(); + right.render(); + bottom.render(); + glEnd(); + } +} + +int main() { + left.setColor(Color(RED_f4)); + top.setColor(Color(GREEN_f4)); + right.setColor(Color(BLUE_f4)); + bottom.setColor(Color(PURPLE_f4)); + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511235911.cpp b/.history/src/main_20200511235911.cpp new file mode 100644 index 0000000..14f0437 --- /dev/null +++ b/.history/src/main_20200511235911.cpp @@ -0,0 +1,159 @@ +#include +#include +#include +#include +#include +#include +#include "Quad.h" +#inclide "Color.h" + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float a = 0.5f; +Vertex btl(-0.5f,0.5f,-0.5f); +Vertex btr(0.5f,0.5f,-0.5f); +Vertex bbr(0.5f,-0.5f,-0.5f); +Vertex bbl(-0.5f,-0.5f,-0.5f); + +Vertex ftl(-0.5f,0.5f,0.5f); +Vertex ftr(0.5f,0.5f,0.5f); +Vertex fbr(0.5f,-0.5f,0.5f); +Vertex fbl(-0.5f,-0.5f,0.5f); + +Quad left(btl,ftl,bbl,fbl); +Quad top(btl,btr,ftl,ftr); +Quad right(ftr,btr,fbr,bbr); +Quad bottom(fbl,fbr,bbl,bbr); + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + left.render(); + top.render(); + right.render(); + bottom.render(); + glEnd(); + } +} + +int main() { + left.setColor(Color(RED_f4)); + top.setColor(Color(GREEN_f4)); + right.setColor(Color(BLUE_f4)); + bottom.setColor(Color(PURPLE_f4)); + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200511235939.cpp b/.history/src/main_20200511235939.cpp new file mode 100644 index 0000000..5a45de2 --- /dev/null +++ b/.history/src/main_20200511235939.cpp @@ -0,0 +1,159 @@ +#include +#include +#include +#include +#include +#include +#include "Quad.h" +#include "Color.h" + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float a = 0.5f; +Vertex btl(-0.5f,0.5f,-0.5f); +Vertex btr(0.5f,0.5f,-0.5f); +Vertex bbr(0.5f,-0.5f,-0.5f); +Vertex bbl(-0.5f,-0.5f,-0.5f); + +Vertex ftl(-0.5f,0.5f,0.5f); +Vertex ftr(0.5f,0.5f,0.5f); +Vertex fbr(0.5f,-0.5f,0.5f); +Vertex fbl(-0.5f,-0.5f,0.5f); + +Quad left(btl,ftl,bbl,fbl); +Quad top(btl,btr,ftl,ftr); +Quad right(ftr,btr,fbr,bbr); +Quad bottom(fbl,fbr,bbl,bbr); + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + left.render(); + top.render(); + right.render(); + bottom.render(); + glEnd(); + } +} + +int main() { + left.setColor(Color(RED_f4)); + top.setColor(Color(GREEN_f4)); + right.setColor(Color(BLUE_f4)); + bottom.setColor(Color(PURPLE_f4)); + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200512000104.cpp b/.history/src/main_20200512000104.cpp new file mode 100644 index 0000000..1fcf9eb --- /dev/null +++ b/.history/src/main_20200512000104.cpp @@ -0,0 +1,159 @@ +#include +#include +#include +#include +#include +#include +#include "Quad.h" +#include "Color.h" + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float a = 0.5f; +Vertex btl(-0.5f,0.5f,-0.5f); +Vertex btr(0.5f,0.5f,-0.5f); +Vertex bbr(0.5f,-0.5f,-0.5f); +Vertex bbl(-0.5f,-0.5f,-0.5f); + +Vertex ftl(-0.5f,0.5f,0.5f); +Vertex ftr(0.5f,0.5f,0.5f); +Vertex fbr(0.5f,-0.5f,0.5f); +Vertex fbl(-0.5f,-0.5f,0.5f); + +Quad left(btl,ftl,bbl,fbl); +Quad top(btl,btr,ftl,ftr); +Quad right(ftr,btr,fbr,bbr); +Quad bottom(fbl,fbr,bbl,bbr); + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + left.render(); + top.render(); + right.render(); + bottom.render(); + glEnd(); + } +} + +int main() { + left.setColor(myColor(RED_f4)); + top.setColor(Color(GREEN_f4)); + right.setColor(Color(BLUE_f4)); + bottom.setColor(Color(PURPLE_f4)); + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200512000113.cpp b/.history/src/main_20200512000113.cpp new file mode 100644 index 0000000..46f6059 --- /dev/null +++ b/.history/src/main_20200512000113.cpp @@ -0,0 +1,159 @@ +#include +#include +#include +#include +#include +#include +#include "Quad.h" +#include "Color.h" + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float a = 0.5f; +Vertex btl(-0.5f,0.5f,-0.5f); +Vertex btr(0.5f,0.5f,-0.5f); +Vertex bbr(0.5f,-0.5f,-0.5f); +Vertex bbl(-0.5f,-0.5f,-0.5f); + +Vertex ftl(-0.5f,0.5f,0.5f); +Vertex ftr(0.5f,0.5f,0.5f); +Vertex fbr(0.5f,-0.5f,0.5f); +Vertex fbl(-0.5f,-0.5f,0.5f); + +Quad left(btl,ftl,bbl,fbl); +Quad top(btl,btr,ftl,ftr); +Quad right(ftr,btr,fbr,bbr); +Quad bottom(fbl,fbr,bbl,bbr); + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + left.render(); + top.render(); + right.render(); + bottom.render(); + glEnd(); + } +} + +int main() { + left.setColor(myColor(RED_f4)); + top.setColor(myColor(GREEN_f4)); + right.setColor(myColor(BLUE_f4)); + bottom.setColor(myColor(PURPLE_f4)); + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200512000411.cpp b/.history/src/main_20200512000411.cpp new file mode 100644 index 0000000..455a831 --- /dev/null +++ b/.history/src/main_20200512000411.cpp @@ -0,0 +1,153 @@ +#include +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float a = 0.5f; +Vertex btl(-0.5f,0.5f,-0.5f); +Vertex btr(0.5f,0.5f,-0.5f); +Vertex bbr(0.5f,-0.5f,-0.5f); +Vertex bbl(-0.5f,-0.5f,-0.5f); + +Vertex ftl(-0.5f,0.5f,0.5f); +Vertex ftr(0.5f,0.5f,0.5f); +Vertex fbr(0.5f,-0.5f,0.5f); +Vertex fbl(-0.5f,-0.5f,0.5f); + +Quad left(btl,ftl,bbl,fbl); +Quad top(btl,btr,ftl,ftr); +Quad right(ftr,btr,fbr,bbr); +Quad bottom(fbl,fbr,bbl,bbr); + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + glEnd(); + } +} + +int main() { + left.setColor(RED_f4); + top.setColor(GREEN_f4); + right.setColor(BLUE_f4); + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200512000429.cpp b/.history/src/main_20200512000429.cpp new file mode 100644 index 0000000..e4ff6e7 --- /dev/null +++ b/.history/src/main_20200512000429.cpp @@ -0,0 +1,154 @@ +#include +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float a = 0.5f; +Vertex btl(-0.5f,0.5f,-0.5f); +Vertex btr(0.5f,0.5f,-0.5f); +Vertex bbr(0.5f,-0.5f,-0.5f); +Vertex bbl(-0.5f,-0.5f,-0.5f); + +Vertex ftl(-0.5f,0.5f,0.5f); +Vertex ftr(0.5f,0.5f,0.5f); +Vertex fbr(0.5f,-0.5f,0.5f); +Vertex fbl(-0.5f,-0.5f,0.5f); + +Quad left(btl,ftl,bbl,fbl); +Quad top(btl,btr,ftl,ftr); +Quad right(ftr,btr,fbr,bbr); +Quad bottom(fbl,fbr,bbl,bbr); + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + glEnd(); + } +} + +int main() { + left.setColor(RED_f4); + top.setColor(GREEN_f4); + right.setColor(BLUE_f4); + bottom.setColor(PURPLE_f4); + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200512000549.cpp b/.history/src/main_20200512000549.cpp new file mode 100644 index 0000000..75d1002 --- /dev/null +++ b/.history/src/main_20200512000549.cpp @@ -0,0 +1,154 @@ +#include +#include +#include +#include +#include +#include +#include + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float a = 0.5f; +Vertex btl(-0.5f,0.5f,-0.5f); +Vertex btr(0.5f,0.5f,-0.5f); +Vertex bbr(0.5f,-0.5f,-0.5f); +Vertex bbl(-0.5f,-0.5f,-0.5f); + +Vertex ftl(-0.5f,0.5f,0.5f); +Vertex ftr(0.5f,0.5f,0.5f); +Vertex fbr(0.5f,-0.5f,0.5f); +Vertex fbl(-0.5f,-0.5f,0.5f); + +Quad left(btl,ftl,bbl,fbl); +Quad top(btl,btr,ftl,ftr); +Quad right(ftr,btr,fbr,bbr); +Quad bottom(fbl,fbr,bbl,bbr); + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + glEnd(); + } +} + +int main() { + left.setColor(myColor(RED_f4)); + top.setColor(myColor(GREEN_f4)); + right.setColor(myColor(BLUE_f4)); + bottom.setColor(myColor(PURPLE_f4)); + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200512000614.cpp b/.history/src/main_20200512000614.cpp new file mode 100644 index 0000000..998ddb0 --- /dev/null +++ b/.history/src/main_20200512000614.cpp @@ -0,0 +1,154 @@ +#include +#include +#include +#include +#include +#include +#include "Quad.h" + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float a = 0.5f; +Vertex btl(-0.5f,0.5f,-0.5f); +Vertex btr(0.5f,0.5f,-0.5f); +Vertex bbr(0.5f,-0.5f,-0.5f); +Vertex bbl(-0.5f,-0.5f,-0.5f); + +Vertex ftl(-0.5f,0.5f,0.5f); +Vertex ftr(0.5f,0.5f,0.5f); +Vertex fbr(0.5f,-0.5f,0.5f); +Vertex fbl(-0.5f,-0.5f,0.5f); + +Quad left(btl,ftl,bbl,fbl); +Quad top(btl,btr,ftl,ftr); +Quad right(ftr,btr,fbr,bbr); +Quad bottom(fbl,fbr,bbl,bbr); + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + glEnd(); + } +} + +int main() { + left.setColor(myColor(RED_f4)); + top.setColor(myColor(GREEN_f4)); + right.setColor(myColor(BLUE_f4)); + bottom.setColor(myColor(PURPLE_f4)); + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200512010342.cpp b/.history/src/main_20200512010342.cpp new file mode 100644 index 0000000..998ddb0 --- /dev/null +++ b/.history/src/main_20200512010342.cpp @@ -0,0 +1,154 @@ +#include +#include +#include +#include +#include +#include +#include "Quad.h" + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float a = 0.5f; +Vertex btl(-0.5f,0.5f,-0.5f); +Vertex btr(0.5f,0.5f,-0.5f); +Vertex bbr(0.5f,-0.5f,-0.5f); +Vertex bbl(-0.5f,-0.5f,-0.5f); + +Vertex ftl(-0.5f,0.5f,0.5f); +Vertex ftr(0.5f,0.5f,0.5f); +Vertex fbr(0.5f,-0.5f,0.5f); +Vertex fbl(-0.5f,-0.5f,0.5f); + +Quad left(btl,ftl,bbl,fbl); +Quad top(btl,btr,ftl,ftr); +Quad right(ftr,btr,fbr,bbr); +Quad bottom(fbl,fbr,bbl,bbr); + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + glEnd(); + } +} + +int main() { + left.setColor(myColor(RED_f4)); + top.setColor(myColor(GREEN_f4)); + right.setColor(myColor(BLUE_f4)); + bottom.setColor(myColor(PURPLE_f4)); + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200512010405.cpp b/.history/src/main_20200512010405.cpp new file mode 100644 index 0000000..dcaf1c4 --- /dev/null +++ b/.history/src/main_20200512010405.cpp @@ -0,0 +1,155 @@ +#include +#include +#include +#include +#include +#include +#include "Quad.h" + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float a = 0.5f; +Vertex btl(-0.5f,0.5f,-0.5f); +Vertex btr(0.5f,0.5f,-0.5f); +Vertex bbr(0.5f,-0.5f,-0.5f); +Vertex bbl(-0.5f,-0.5f,-0.5f); + +Vertex ftl(-0.5f,0.5f,0.5f); +Vertex ftr(0.5f,0.5f,0.5f); +Vertex fbr(0.5f,-0.5f,0.5f); +Vertex fbl(-0.5f,-0.5f,0.5f); + +Quad left(btl,ftl,bbl,fbl); +Quad top(btl,btr,ftl,ftr); +Quad right(ftr,btr,fbr,bbr); +Quad bottom(fbl,fbr,bbl,bbr); + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + glEnd(); + } +} + +int main() { + left.setColor(myColor(RED_f4)); + top.setColor(myColor(GREEN_f4)); + right.setColor(myColor(BLUE_f4)); + bottom.setColor(myColor(PURPLE_f4)); + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + printf("Succesfully initialized"); + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200512010408.cpp b/.history/src/main_20200512010408.cpp new file mode 100644 index 0000000..9c8a06f --- /dev/null +++ b/.history/src/main_20200512010408.cpp @@ -0,0 +1,155 @@ +#include +#include +#include +#include +#include +#include +#include "Quad.h" + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float a = 0.5f; +Vertex btl(-0.5f,0.5f,-0.5f); +Vertex btr(0.5f,0.5f,-0.5f); +Vertex bbr(0.5f,-0.5f,-0.5f); +Vertex bbl(-0.5f,-0.5f,-0.5f); + +Vertex ftl(-0.5f,0.5f,0.5f); +Vertex ftr(0.5f,0.5f,0.5f); +Vertex fbr(0.5f,-0.5f,0.5f); +Vertex fbl(-0.5f,-0.5f,0.5f); + +Quad left(btl,ftl,bbl,fbl); +Quad top(btl,btr,ftl,ftr); +Quad right(ftr,btr,fbr,bbr); +Quad bottom(fbl,fbr,bbl,bbr); + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + glEnd(); + } +} + +int main() { + left.setColor(myColor(RED_f4)); + top.setColor(myColor(GREEN_f4)); + right.setColor(myColor(BLUE_f4)); + bottom.setColor(myColor(PURPLE_f4)); + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + printf("Succesfully initialized\n"); + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200512010440.cpp b/.history/src/main_20200512010440.cpp new file mode 100644 index 0000000..da5a708 --- /dev/null +++ b/.history/src/main_20200512010440.cpp @@ -0,0 +1,157 @@ +#include +#include +#include +#include +#include +#include +#include "Quad.h" + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float a = 0.5f; +Vertex btl(-0.5f,0.5f,-0.5f); +Vertex btr(0.5f,0.5f,-0.5f); +Vertex bbr(0.5f,-0.5f,-0.5f); +Vertex bbl(-0.5f,-0.5f,-0.5f); + +Vertex ftl(-0.5f,0.5f,0.5f); +Vertex ftr(0.5f,0.5f,0.5f); +Vertex fbr(0.5f,-0.5f,0.5f); +Vertex fbl(-0.5f,-0.5f,0.5f); + +Quad left(btl,ftl,bbl,fbl); +Quad top(btl,btr,ftl,ftr); +Quad right(ftr,btr,fbr,bbr); +Quad bottom(fbl,fbr,bbl,bbr); + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + left.render(); + top.render(); + glEnd(); + } +} + +int main() { + left.setColor(myColor(RED_f4)); + top.setColor(myColor(GREEN_f4)); + right.setColor(myColor(BLUE_f4)); + bottom.setColor(myColor(PURPLE_f4)); + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + printf("Succesfully initialized\n"); + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200512010451.cpp b/.history/src/main_20200512010451.cpp new file mode 100644 index 0000000..17aa21b --- /dev/null +++ b/.history/src/main_20200512010451.cpp @@ -0,0 +1,159 @@ +#include +#include +#include +#include +#include +#include +#include "Quad.h" + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float a = 0.5f; +Vertex btl(-0.5f,0.5f,-0.5f); +Vertex btr(0.5f,0.5f,-0.5f); +Vertex bbr(0.5f,-0.5f,-0.5f); +Vertex bbl(-0.5f,-0.5f,-0.5f); + +Vertex ftl(-0.5f,0.5f,0.5f); +Vertex ftr(0.5f,0.5f,0.5f); +Vertex fbr(0.5f,-0.5f,0.5f); +Vertex fbl(-0.5f,-0.5f,0.5f); + +Quad left(btl,ftl,bbl,fbl); +Quad top(btl,btr,ftl,ftr); +Quad right(ftr,btr,fbr,bbr); +Quad bottom(fbl,fbr,bbl,bbr); + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + left.render(); + top.render(); + right.render(); + bottom.render(); + glEnd(); + } +} + +int main() { + left.setColor(myColor(RED_f4)); + top.setColor(myColor(GREEN_f4)); + right.setColor(myColor(BLUE_f4)); + bottom.setColor(myColor(PURPLE_f4)); + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + printf("Succesfully initialized\n"); + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200512010535.cpp b/.history/src/main_20200512010535.cpp new file mode 100644 index 0000000..17aa21b --- /dev/null +++ b/.history/src/main_20200512010535.cpp @@ -0,0 +1,159 @@ +#include +#include +#include +#include +#include +#include +#include "Quad.h" + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float a = 0.5f; +Vertex btl(-0.5f,0.5f,-0.5f); +Vertex btr(0.5f,0.5f,-0.5f); +Vertex bbr(0.5f,-0.5f,-0.5f); +Vertex bbl(-0.5f,-0.5f,-0.5f); + +Vertex ftl(-0.5f,0.5f,0.5f); +Vertex ftr(0.5f,0.5f,0.5f); +Vertex fbr(0.5f,-0.5f,0.5f); +Vertex fbl(-0.5f,-0.5f,0.5f); + +Quad left(btl,ftl,bbl,fbl); +Quad top(btl,btr,ftl,ftr); +Quad right(ftr,btr,fbr,bbr); +Quad bottom(fbl,fbr,bbl,bbr); + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + left.render(); + top.render(); + right.render(); + bottom.render(); + glEnd(); + } +} + +int main() { + left.setColor(myColor(RED_f4)); + top.setColor(myColor(GREEN_f4)); + right.setColor(myColor(BLUE_f4)); + bottom.setColor(myColor(PURPLE_f4)); + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + printf("Succesfully initialized\n"); + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200512010630.cpp b/.history/src/main_20200512010630.cpp new file mode 100644 index 0000000..6f77461 --- /dev/null +++ b/.history/src/main_20200512010630.cpp @@ -0,0 +1,159 @@ +#include +#include +#include +#include +#include +#include +#include "Quad.h" + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float a = 0.5f; +Vertex btl(-0.5f,0.5f,-0.5f); +Vertex btr(0.5f,0.5f,-0.5f); +Vertex bbr(0.5f,-0.5f,-0.5f); +Vertex bbl(-0.5f,-0.5f,-0.5f); + +Vertex ftl(-0.5f,0.5f,0.5f); +Vertex ftr(0.5f,0.5f,0.5f); +Vertex fbr(0.5f,-0.5f,0.5f); +Vertex fbl(-0.5f,-0.5f,0.5f); + +Quad left(btl,ftl,bbl,fbl); +Quad top(btl,btr,ftl,ftr); +Quad right(ftr,btr,fbr,bbr); +Quad bottom(fbl,fbr,bbl,bbr); + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + //glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + left.render(); + top.render(); + right.render(); + bottom.render(); + glEnd(); + } +} + +int main() { + left.setColor(myColor(RED_f4)); + top.setColor(myColor(GREEN_f4)); + right.setColor(myColor(BLUE_f4)); + bottom.setColor(myColor(PURPLE_f4)); + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + printf("Succesfully initialized\n"); + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200512010633.cpp b/.history/src/main_20200512010633.cpp new file mode 100644 index 0000000..6f77461 --- /dev/null +++ b/.history/src/main_20200512010633.cpp @@ -0,0 +1,159 @@ +#include +#include +#include +#include +#include +#include +#include "Quad.h" + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float a = 0.5f; +Vertex btl(-0.5f,0.5f,-0.5f); +Vertex btr(0.5f,0.5f,-0.5f); +Vertex bbr(0.5f,-0.5f,-0.5f); +Vertex bbl(-0.5f,-0.5f,-0.5f); + +Vertex ftl(-0.5f,0.5f,0.5f); +Vertex ftr(0.5f,0.5f,0.5f); +Vertex fbr(0.5f,-0.5f,0.5f); +Vertex fbl(-0.5f,-0.5f,0.5f); + +Quad left(btl,ftl,bbl,fbl); +Quad top(btl,btr,ftl,ftr); +Quad right(ftr,btr,fbr,bbr); +Quad bottom(fbl,fbr,bbl,bbr); + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + //glTranslatef(0.0f,0.0f,0.0f); + scale+=0.01f; + glBegin(GL_QUADS); + left.render(); + top.render(); + right.render(); + bottom.render(); + glEnd(); + } +} + +int main() { + left.setColor(myColor(RED_f4)); + top.setColor(myColor(GREEN_f4)); + right.setColor(myColor(BLUE_f4)); + bottom.setColor(myColor(PURPLE_f4)); + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + printf("Succesfully initialized\n"); + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200512010641.cpp b/.history/src/main_20200512010641.cpp new file mode 100644 index 0000000..23ce2f5 --- /dev/null +++ b/.history/src/main_20200512010641.cpp @@ -0,0 +1,159 @@ +#include +#include +#include +#include +#include +#include +#include "Quad.h" + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float a = 0.5f; +Vertex btl(-0.5f,0.5f,-0.5f); +Vertex btr(0.5f,0.5f,-0.5f); +Vertex bbr(0.5f,-0.5f,-0.5f); +Vertex bbl(-0.5f,-0.5f,-0.5f); + +Vertex ftl(-0.5f,0.5f,0.5f); +Vertex ftr(0.5f,0.5f,0.5f); +Vertex fbr(0.5f,-0.5f,0.5f); +Vertex fbl(-0.5f,-0.5f,0.5f); + +Quad left(btl,ftl,bbl,fbl); +Quad top(btl,btr,ftl,ftr); +Quad right(ftr,btr,fbr,bbr); +Quad bottom(fbl,fbr,bbl,bbr); + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + //glTranslatef(0.0f,0.0f,0.0f); + //scale+=0.01f; + glBegin(GL_QUADS); + left.render(); + top.render(); + right.render(); + bottom.render(); + glEnd(); + } +} + +int main() { + left.setColor(myColor(RED_f4)); + top.setColor(myColor(GREEN_f4)); + right.setColor(myColor(BLUE_f4)); + bottom.setColor(myColor(PURPLE_f4)); + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + printf("Succesfully initialized\n"); + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200512010651.cpp b/.history/src/main_20200512010651.cpp new file mode 100644 index 0000000..8d0f19f --- /dev/null +++ b/.history/src/main_20200512010651.cpp @@ -0,0 +1,160 @@ +#include +#include +#include +#include +#include +#include +#include "Quad.h" + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float a = 0.5f; +Vertex btl(-0.5f,0.5f,-0.5f); +Vertex btr(0.5f,0.5f,-0.5f); +Vertex bbr(0.5f,-0.5f,-0.5f); +Vertex bbl(-0.5f,-0.5f,-0.5f); + +Vertex ftl(-0.5f,0.5f,0.5f); +Vertex ftr(0.5f,0.5f,0.5f); +Vertex fbr(0.5f,-0.5f,0.5f); +Vertex fbl(-0.5f,-0.5f,0.5f); + +Quad left(btl,ftl,bbl,fbl); +Quad top(btl,btr,ftl,ftr); +Quad right(ftr,btr,fbr,bbr); +Quad bottom(fbl,fbr,bbl,bbr); + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + //glTranslatef(0.0f,0.0f,0.0f); + //scale+=0.01f; + glBegin(GL_QUADS); + /*left.render(); + top.render(); + right.render(); + bottom.render(); + */ + glEnd(); + } +} + +int main() { + left.setColor(myColor(RED_f4)); + top.setColor(myColor(GREEN_f4)); + right.setColor(myColor(BLUE_f4)); + bottom.setColor(myColor(PURPLE_f4)); + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + printf("Succesfully initialized\n"); + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200512010809.cpp b/.history/src/main_20200512010809.cpp new file mode 100644 index 0000000..71b5467 --- /dev/null +++ b/.history/src/main_20200512010809.cpp @@ -0,0 +1,164 @@ +#include +#include +#include +#include +#include +#include +#include "Quad.h" + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float a = 0.5f; +Vertex btl(-0.5f,0.5f,-0.5f); +Vertex btr(0.5f,0.5f,-0.5f); +Vertex bbr(0.5f,-0.5f,-0.5f); +Vertex bbl(-0.5f,-0.5f,-0.5f); + +Vertex ftl(-0.5f,0.5f,0.5f); +Vertex ftr(0.5f,0.5f,0.5f); +Vertex fbr(0.5f,-0.5f,0.5f); +Vertex fbl(-0.5f,-0.5f,0.5f); + +Quad left(btl,ftl,bbl,fbl); +Quad top(btl,btr,ftl,ftr); +Quad right(ftr,btr,fbr,bbr); +Quad bottom(fbl,fbr,bbl,bbr); + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + //glTranslatef(0.0f,0.0f,0.0f); + //scale+=0.01f; + glBegin(GL_QUADS); + /*left.render(); + top.render(); + right.render(); + bottom.render(); + */ + glVertex2f(-0.5f,0.5f); + glVertex2f(0.5f,0.5f); + glVertex2f(0.5f,-0.5f); + glVertex(-0.5f,-0.5f) +; glEnd(); + } +} + +int main() { + left.setColor(myColor(RED_f4)); + top.setColor(myColor(GREEN_f4)); + right.setColor(myColor(BLUE_f4)); + bottom.setColor(myColor(PURPLE_f4)); + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + printf("Succesfully initialized\n"); + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200512010815.cpp b/.history/src/main_20200512010815.cpp new file mode 100644 index 0000000..4d81ada --- /dev/null +++ b/.history/src/main_20200512010815.cpp @@ -0,0 +1,164 @@ +#include +#include +#include +#include +#include +#include +#include "Quad.h" + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float a = 0.5f; +Vertex btl(-0.5f,0.5f,-0.5f); +Vertex btr(0.5f,0.5f,-0.5f); +Vertex bbr(0.5f,-0.5f,-0.5f); +Vertex bbl(-0.5f,-0.5f,-0.5f); + +Vertex ftl(-0.5f,0.5f,0.5f); +Vertex ftr(0.5f,0.5f,0.5f); +Vertex fbr(0.5f,-0.5f,0.5f); +Vertex fbl(-0.5f,-0.5f,0.5f); + +Quad left(btl,ftl,bbl,fbl); +Quad top(btl,btr,ftl,ftr); +Quad right(ftr,btr,fbr,bbr); +Quad bottom(fbl,fbr,bbl,bbr); + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + //glTranslatef(0.0f,0.0f,0.0f); + //scale+=0.01f; + glBegin(GL_QUADS); + /*left.render(); + top.render(); + right.render(); + bottom.render(); + */ + glVertex2f(-0.5f,0.5f); + glVertex2f(0.5f,0.5f); + glVertex2f(0.5f,-0.5f); + glVertex(-0.5f,-0.5f); + glEnd(); + } +} + +int main() { + left.setColor(myColor(RED_f4)); + top.setColor(myColor(GREEN_f4)); + right.setColor(myColor(BLUE_f4)); + bottom.setColor(myColor(PURPLE_f4)); + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + printf("Succesfully initialized\n"); + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200512010819.cpp b/.history/src/main_20200512010819.cpp new file mode 100644 index 0000000..4d81ada --- /dev/null +++ b/.history/src/main_20200512010819.cpp @@ -0,0 +1,164 @@ +#include +#include +#include +#include +#include +#include +#include "Quad.h" + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float a = 0.5f; +Vertex btl(-0.5f,0.5f,-0.5f); +Vertex btr(0.5f,0.5f,-0.5f); +Vertex bbr(0.5f,-0.5f,-0.5f); +Vertex bbl(-0.5f,-0.5f,-0.5f); + +Vertex ftl(-0.5f,0.5f,0.5f); +Vertex ftr(0.5f,0.5f,0.5f); +Vertex fbr(0.5f,-0.5f,0.5f); +Vertex fbl(-0.5f,-0.5f,0.5f); + +Quad left(btl,ftl,bbl,fbl); +Quad top(btl,btr,ftl,ftr); +Quad right(ftr,btr,fbr,bbr); +Quad bottom(fbl,fbr,bbl,bbr); + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + //glTranslatef(0.0f,0.0f,0.0f); + //scale+=0.01f; + glBegin(GL_QUADS); + /*left.render(); + top.render(); + right.render(); + bottom.render(); + */ + glVertex2f(-0.5f,0.5f); + glVertex2f(0.5f,0.5f); + glVertex2f(0.5f,-0.5f); + glVertex(-0.5f,-0.5f); + glEnd(); + } +} + +int main() { + left.setColor(myColor(RED_f4)); + top.setColor(myColor(GREEN_f4)); + right.setColor(myColor(BLUE_f4)); + bottom.setColor(myColor(PURPLE_f4)); + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + printf("Succesfully initialized\n"); + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200512010823.cpp b/.history/src/main_20200512010823.cpp new file mode 100644 index 0000000..ee47132 --- /dev/null +++ b/.history/src/main_20200512010823.cpp @@ -0,0 +1,164 @@ +#include +#include +#include +#include +#include +#include +#include "Quad.h" + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float a = 0.5f; +Vertex btl(-0.5f,0.5f,-0.5f); +Vertex btr(0.5f,0.5f,-0.5f); +Vertex bbr(0.5f,-0.5f,-0.5f); +Vertex bbl(-0.5f,-0.5f,-0.5f); + +Vertex ftl(-0.5f,0.5f,0.5f); +Vertex ftr(0.5f,0.5f,0.5f); +Vertex fbr(0.5f,-0.5f,0.5f); +Vertex fbl(-0.5f,-0.5f,0.5f); + +Quad left(btl,ftl,bbl,fbl); +Quad top(btl,btr,ftl,ftr); +Quad right(ftr,btr,fbr,bbr); +Quad bottom(fbl,fbr,bbl,bbr); + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + //glTranslatef(0.0f,0.0f,0.0f); + //scale+=0.01f; + glBegin(GL_QUADS); + /*left.render(); + top.render(); + right.render(); + bottom.render(); + */ + glVertex2f(-0.5f,0.5f); + glVertex2f(0.5f,0.5f); + glVertex2f(0.5f,-0.5f); + glVertex2f(-0.5f,-0.5f); + glEnd(); + } +} + +int main() { + left.setColor(myColor(RED_f4)); + top.setColor(myColor(GREEN_f4)); + right.setColor(myColor(BLUE_f4)); + bottom.setColor(myColor(PURPLE_f4)); + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + printf("Succesfully initialized\n"); + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200512010947.cpp b/.history/src/main_20200512010947.cpp new file mode 100644 index 0000000..e5d032b --- /dev/null +++ b/.history/src/main_20200512010947.cpp @@ -0,0 +1,164 @@ +#include +#include +#include +#include +#include +#include +#include "Quad.h" + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float a = 0.5f; +Vertex btl(-0.5f,0.5f,-0.5f); +Vertex btr(0.5f,0.5f,-0.5f); +Vertex bbr(0.5f,-0.5f,-0.5f); +Vertex bbl(-0.5f,-0.5f,-0.5f); + +Vertex ftl(-0.5f,0.5f,0.5f); +Vertex ftr(0.5f,0.5f,0.5f); +Vertex fbr(0.5f,-0.5f,0.5f); +Vertex fbl(-0.5f,-0.5f,0.5f); + +Quad left(btl,ftl,bbl,fbl); +Quad top(btl,btr,ftl,ftr); +Quad right(ftr,btr,fbr,bbr); +Quad bottom(fbl,fbr,bbl,bbr); + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + //glTranslatef(0.0f,0.0f,0.0f); + //scale+=0.01f; + glBegin(GL_QUADS); + /*left.render(); + top.render(); + right.render(); + bottom.render(); + */ + glVertex3f(-0.5f,0.5f,0.5f); + glVertex3f(0.5f,0.5f,0.5f); + glVertex3f(0.5f,-0.5f,0.5f); + glVertex3f(-0.5f,-0.5f,0.5f); + glEnd(); + } +} + +int main() { + left.setColor(myColor(RED_f4)); + top.setColor(myColor(GREEN_f4)); + right.setColor(myColor(BLUE_f4)); + bottom.setColor(myColor(PURPLE_f4)); + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + printf("Succesfully initialized\n"); + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200512011009.cpp b/.history/src/main_20200512011009.cpp new file mode 100644 index 0000000..276b7f5 --- /dev/null +++ b/.history/src/main_20200512011009.cpp @@ -0,0 +1,163 @@ +#include +#include +#include +#include +#include +#include +#include "Quad.h" + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float a = 0.5f; +Vertex btl(-0.5f,0.5f,-0.5f); +Vertex btr(0.5f,0.5f,-0.5f); +Vertex bbr(0.5f,-0.5f,-0.5f); +Vertex bbl(-0.5f,-0.5f,-0.5f); + +Vertex ftl(-0.5f,0.5f,0.5f); +Vertex ftr(0.5f,0.5f,0.5f); +Vertex fbr(0.5f,-0.5f,0.5f); +Vertex fbl(-0.5f,-0.5f,0.5f); + +Quad left(btl,ftl,bbl,fbl); +Quad top(btl,btr,ftl,ftr); +Quad right(ftr,btr,fbr,bbr); +Quad bottom(fbl,fbr,bbl,bbr); + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + //glTranslatef(0.0f,0.0f,0.0f); + //scale+=0.01f; + glBegin(GL_QUADS); + left.render(); + top.render(); + right.render(); + bottom.render(); + glVertex3f(-0.5f,0.5f,0.5f); + glVertex3f(0.5f,0.5f,0.5f); + glVertex3f(0.5f,-0.5f,0.5f); + glVertex3f(-0.5f,-0.5f,0.5f); + glEnd(); + } +} + +int main() { + left.setColor(myColor(RED_f4)); + top.setColor(myColor(GREEN_f4)); + right.setColor(myColor(BLUE_f4)); + bottom.setColor(myColor(PURPLE_f4)); + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + printf("Succesfully initialized\n"); + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200512011055.cpp b/.history/src/main_20200512011055.cpp new file mode 100644 index 0000000..74be268 --- /dev/null +++ b/.history/src/main_20200512011055.cpp @@ -0,0 +1,163 @@ +#include +#include +#include +#include +#include +#include +#include "Quad.h" + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float a = 0.5f; +Vertex btl(-0.5f,0.5f,-0.5f); +Vertex btr(0.5f,0.5f,-0.5f); +Vertex bbr(0.5f,-0.5f,-0.5f); +Vertex bbl(-0.5f,-0.5f,-0.5f); + +Vertex ftl(-0.5f,0.5f,0.5f); +Vertex ftr(0.5f,0.5f,0.5f); +Vertex fbr(0.5f,-0.5f,0.5f); +Vertex fbl(-0.5f,-0.5f,0.5f); + +Quad left(btl,ftl,bbl,fbl); +Quad top(btl,btr,ftl,ftr); +Quad right(ftr,btr,fbr,bbr); +Quad bottom(fbl,fbr,bbl,bbr); + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + //glTranslatef(0.0f,0.0f,0.0f); + //scale+=0.01f; + glBegin(GL_QUADS); + //left.render(); + //top.render(); + //right.render(); + //bottom.render(); + glVertex3f(-0.5f,0.5f,0.5f); + glVertex3f(0.5f,0.5f,0.5f); + glVertex3f(0.5f,-0.5f,0.5f); + glVertex3f(-0.5f,-0.5f,0.5f); + glEnd(); + } +} + +int main() { + left.setColor(myColor(RED_f4)); + top.setColor(myColor(GREEN_f4)); + right.setColor(myColor(BLUE_f4)); + bottom.setColor(myColor(PURPLE_f4)); + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + printf("Succesfully initialized\n"); + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200512011126.cpp b/.history/src/main_20200512011126.cpp new file mode 100644 index 0000000..5848b74 --- /dev/null +++ b/.history/src/main_20200512011126.cpp @@ -0,0 +1,164 @@ +#include +#include +#include +#include +#include +#include +#include "Quad.h" + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float a = 0.5f; +Vertex btl(-0.5f,0.5f,-0.5f); +Vertex btr(0.5f,0.5f,-0.5f); +Vertex bbr(0.5f,-0.5f,-0.5f); +Vertex bbl(-0.5f,-0.5f,-0.5f); + +Vertex ftl(-0.5f,0.5f,0.5f); +Vertex ftr(0.5f,0.5f,0.5f); +Vertex fbr(0.5f,-0.5f,0.5f); +Vertex fbl(-0.5f,-0.5f,0.5f); + +Quad left(btl,ftl,bbl,fbl); +Quad top(btl,btr,ftl,ftr); +Quad right(ftr,btr,fbr,bbr); +Quad bottom(fbl,fbr,bbl,bbr); +Quad front(ftl,ftr,fbr,fbl); + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + //glTranslatef(0.0f,0.0f,0.0f); + //scale+=0.01f; + glBegin(GL_QUADS); + //left.render(); + //top.render(); + //right.render(); + //bottom.render(); + glVertex3f(-0.5f,0.5f,0.5f); + glVertex3f(0.5f,0.5f,0.5f); + glVertex3f(0.5f,-0.5f,0.5f); + glVertex3f(-0.5f,-0.5f,0.5f); + glEnd(); + } +} + +int main() { + left.setColor(myColor(RED_f4)); + top.setColor(myColor(GREEN_f4)); + right.setColor(myColor(BLUE_f4)); + bottom.setColor(myColor(PURPLE_f4)); + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + printf("Succesfully initialized\n"); + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200512011142.cpp b/.history/src/main_20200512011142.cpp new file mode 100644 index 0000000..affc053 --- /dev/null +++ b/.history/src/main_20200512011142.cpp @@ -0,0 +1,165 @@ +#include +#include +#include +#include +#include +#include +#include "Quad.h" + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float a = 0.5f; +Vertex btl(-0.5f,0.5f,-0.5f); +Vertex btr(0.5f,0.5f,-0.5f); +Vertex bbr(0.5f,-0.5f,-0.5f); +Vertex bbl(-0.5f,-0.5f,-0.5f); + +Vertex ftl(-0.5f,0.5f,0.5f); +Vertex ftr(0.5f,0.5f,0.5f); +Vertex fbr(0.5f,-0.5f,0.5f); +Vertex fbl(-0.5f,-0.5f,0.5f); + +Quad left(btl,ftl,bbl,fbl); +Quad top(btl,btr,ftl,ftr); +Quad right(ftr,btr,fbr,bbr); +Quad bottom(fbl,fbr,bbl,bbr); +Quad front(ftl,ftr,fbr,fbl); + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + //glTranslatef(0.0f,0.0f,0.0f); + //scale+=0.01f; + glBegin(GL_QUADS); + //left.render(); + //top.render(); + //right.render(); + //bottom.render(); + front.render(); + glVertex3f(-0.5f,0.5f,0.5f); + glVertex3f(0.5f,0.5f,0.5f); + glVertex3f(0.5f,-0.5f,0.5f); + glVertex3f(-0.5f,-0.5f,0.5f); + glEnd(); + } +} + +int main() { + left.setColor(myColor(RED_f4)); + top.setColor(myColor(GREEN_f4)); + right.setColor(myColor(BLUE_f4)); + bottom.setColor(myColor(PURPLE_f4)); + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + printf("Succesfully initialized\n"); + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200512011153.cpp b/.history/src/main_20200512011153.cpp new file mode 100644 index 0000000..490b858 --- /dev/null +++ b/.history/src/main_20200512011153.cpp @@ -0,0 +1,167 @@ +#include +#include +#include +#include +#include +#include +#include "Quad.h" + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float a = 0.5f; +Vertex btl(-0.5f,0.5f,-0.5f); +Vertex btr(0.5f,0.5f,-0.5f); +Vertex bbr(0.5f,-0.5f,-0.5f); +Vertex bbl(-0.5f,-0.5f,-0.5f); + +Vertex ftl(-0.5f,0.5f,0.5f); +Vertex ftr(0.5f,0.5f,0.5f); +Vertex fbr(0.5f,-0.5f,0.5f); +Vertex fbl(-0.5f,-0.5f,0.5f); + +Quad left(btl,ftl,bbl,fbl); +Quad top(btl,btr,ftl,ftr); +Quad right(ftr,btr,fbr,bbr); +Quad bottom(fbl,fbr,bbl,bbr); +Quad front(ftl,ftr,fbr,fbl); + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + //glTranslatef(0.0f,0.0f,0.0f); + //scale+=0.01f; + glBegin(GL_QUADS); + //left.render(); + //top.render(); + //right.render(); + //bottom.render(); + front.render(); + /* + glVertex3f(-0.5f,0.5f,0.5f); + glVertex3f(0.5f,0.5f,0.5f); + glVertex3f(0.5f,-0.5f,0.5f); + glVertex3f(-0.5f,-0.5f,0.5f); + */ + glEnd(); + } +} + +int main() { + left.setColor(myColor(RED_f4)); + top.setColor(myColor(GREEN_f4)); + right.setColor(myColor(BLUE_f4)); + bottom.setColor(myColor(PURPLE_f4)); + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + printf("Succesfully initialized\n"); + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200512011236.cpp b/.history/src/main_20200512011236.cpp new file mode 100644 index 0000000..29b402d --- /dev/null +++ b/.history/src/main_20200512011236.cpp @@ -0,0 +1,168 @@ +#include +#include +#include +#include +#include +#include +#include "Quad.h" + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float a = 0.5f; +Vertex btl(-0.5f,0.5f,-0.5f); +Vertex btr(0.5f,0.5f,-0.5f); +Vertex bbr(0.5f,-0.5f,-0.5f); +Vertex bbl(-0.5f,-0.5f,-0.5f); + +Vertex ftl(-0.5f,0.5f,0.5f); +Vertex ftr(0.5f,0.5f,0.5f); +Vertex fbr(0.5f,-0.5f,0.5f); +Vertex fbl(-0.5f,-0.5f,0.5f); + +Quad left(btl,ftl,bbl,fbl); +Quad top(btl,btr,ftl,ftr); +Quad right(ftr,btr,fbr,bbr); +Quad bottom(fbl,fbr,bbl,bbr); +Quad front(ftl,ftr,fbr,fbl); + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + //glTranslatef(0.0f,0.0f,0.0f); + //scale+=0.01f; + glBegin(GL_QUADS); + //left.render(); + //top.render(); + //right.render(); + //bottom.render(); + front.setColor(myColor(1.0,1.0,1.0,1.0)); + front.render(); + /* + glVertex3f(-0.5f,0.5f,0.5f); + glVertex3f(0.5f,0.5f,0.5f); + glVertex3f(0.5f,-0.5f,0.5f); + glVertex3f(-0.5f,-0.5f,0.5f); + */ + glEnd(); + } +} + +int main() { + left.setColor(myColor(RED_f4)); + top.setColor(myColor(GREEN_f4)); + right.setColor(myColor(BLUE_f4)); + bottom.setColor(myColor(PURPLE_f4)); + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + printf("Succesfully initialized\n"); + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200512011317.cpp b/.history/src/main_20200512011317.cpp new file mode 100644 index 0000000..3ecd9bf --- /dev/null +++ b/.history/src/main_20200512011317.cpp @@ -0,0 +1,160 @@ +#include +#include +#include +#include +#include +#include +#include "Quad.h" + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float a = 0.5f; +Vertex btl(-0.5f,0.5f,-0.5f); +Vertex btr(0.5f,0.5f,-0.5f); +Vertex bbr(0.5f,-0.5f,-0.5f); +Vertex bbl(-0.5f,-0.5f,-0.5f); + +Vertex ftl(-0.5f,0.5f,0.5f); +Vertex ftr(0.5f,0.5f,0.5f); +Vertex fbr(0.5f,-0.5f,0.5f); +Vertex fbl(-0.5f,-0.5f,0.5f); + +Quad left(btl,ftl,bbl,fbl); +Quad top(btl,btr,ftl,ftr); +Quad right(ftr,btr,fbr,bbr); +Quad bottom(fbl,fbr,bbl,bbr); +Quad front(ftl,ftr,fbr,fbl); + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + //glTranslatef(0.0f,0.0f,0.0f); + //scale+=0.01f; + glBegin(GL_QUADS); + left.setColor(myColor(RED_f4)); + top.setColor(myColor(GREEN_f4)); + right.setColor(myColor(BLUE_f4)); + bottom.setColor(myColor(PURPLE_f4)); + left.render(); + top.render(); + right.render(); + bottom.render(); + glEnd(); + } +} + +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + printf("Succesfully initialized\n"); + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200512011351.cpp b/.history/src/main_20200512011351.cpp new file mode 100644 index 0000000..0a1e1bf --- /dev/null +++ b/.history/src/main_20200512011351.cpp @@ -0,0 +1,162 @@ +#include +#include +#include +#include +#include +#include +#include "Quad.h" + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float a = 0.5f; +Vertex btl(-0.5f,0.5f,-0.5f); +Vertex btr(0.5f,0.5f,-0.5f); +Vertex bbr(0.5f,-0.5f,-0.5f); +Vertex bbl(-0.5f,-0.5f,-0.5f); + +Vertex ftl(-0.5f,0.5f,0.5f); +Vertex ftr(0.5f,0.5f,0.5f); +Vertex fbr(0.5f,-0.5f,0.5f); +Vertex fbl(-0.5f,-0.5f,0.5f); + +Quad left(btl,ftl,bbl,fbl); +Quad top(btl,btr,ftl,ftr); +Quad right(ftr,btr,fbr,bbr); +Quad bottom(fbl,fbr,bbl,bbr); +Quad front(ftl,ftr,fbr,fbl); + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + //glTranslatef(0.0f,0.0f,0.0f); + //scale+=0.01f; + glBegin(GL_QUADS); + /* + left.setColor(myColor(RED_f4)); + top.setColor(myColor(GREEN_f4)); + right.setColor(myColor(BLUE_f4)); + bottom.setColor(myColor(PURPLE_f4)); + left.render(); + top.render(); + right.render(); + bottom.render(); + */ + glEnd(); + } +} + +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + printf("Succesfully initialized\n"); + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200512011417.cpp b/.history/src/main_20200512011417.cpp new file mode 100644 index 0000000..a5f5abc --- /dev/null +++ b/.history/src/main_20200512011417.cpp @@ -0,0 +1,163 @@ +#include +#include +#include +#include +#include +#include +#include "Quad.h" + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float a = 0.5f; +Vertex btl(-0.5f,0.5f,-0.5f); +Vertex btr(0.5f,0.5f,-0.5f); +Vertex bbr(0.5f,-0.5f,-0.5f); +Vertex bbl(-0.5f,-0.5f,-0.5f); + +Vertex ftl(-0.5f,0.5f,0.5f); +Vertex ftr(0.5f,0.5f,0.5f); +Vertex fbr(0.5f,-0.5f,0.5f); +Vertex fbl(-0.5f,-0.5f,0.5f); + +Quad left(btl,ftl,bbl,fbl); +Quad top(btl,btr,ftl,ftr); +Quad right(ftr,btr,fbr,bbr); +Quad bottom(fbl,fbr,bbl,bbr); +Quad front(ftl,ftr,fbr,fbl); + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + //glTranslatef(0.0f,0.0f,0.0f); + //scale+=0.01f; + glBegin(GL_QUADS); + /* + left.setColor(myColor(RED_f4)); + top.setColor(myColor(GREEN_f4)); + right.setColor(myColor(BLUE_f4)); + bottom.setColor(myColor(PURPLE_f4)); + left.render(); + top.render(); + right.render(); + bottom.render(); + */ + front.setColor(myColor(1,1,1,1)); + glEnd(); + } +} + +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + printf("Succesfully initialized\n"); + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200512011436.cpp b/.history/src/main_20200512011436.cpp new file mode 100644 index 0000000..9e327b5 --- /dev/null +++ b/.history/src/main_20200512011436.cpp @@ -0,0 +1,164 @@ +#include +#include +#include +#include +#include +#include +#include "Quad.h" + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float a = 0.5f; +Vertex btl(-0.5f,0.5f,-0.5f); +Vertex btr(0.5f,0.5f,-0.5f); +Vertex bbr(0.5f,-0.5f,-0.5f); +Vertex bbl(-0.5f,-0.5f,-0.5f); + +Vertex ftl(-0.5f,0.5f,0.5f); +Vertex ftr(0.5f,0.5f,0.5f); +Vertex fbr(0.5f,-0.5f,0.5f); +Vertex fbl(-0.5f,-0.5f,0.5f); + +Quad left(btl,ftl,bbl,fbl); +Quad top(btl,btr,ftl,ftr); +Quad right(ftr,btr,fbr,bbr); +Quad bottom(fbl,fbr,bbl,bbr); +Quad front(ftl,ftr,fbr,fbl); + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + //glTranslatef(0.0f,0.0f,0.0f); + //scale+=0.01f; + glBegin(GL_QUADS); + /* + left.setColor(myColor(RED_f4)); + top.setColor(myColor(GREEN_f4)); + right.setColor(myColor(BLUE_f4)); + bottom.setColor(myColor(PURPLE_f4)); + left.render(); + top.render(); + right.render(); + bottom.render(); + */ + front.setColor(myColor(1,1,1,1)); + front.render(); + glEnd(); + } +} + +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + printf("Succesfully initialized\n"); + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200512011507.cpp b/.history/src/main_20200512011507.cpp new file mode 100644 index 0000000..bda62f8 --- /dev/null +++ b/.history/src/main_20200512011507.cpp @@ -0,0 +1,164 @@ +#include +#include +#include +#include +#include +#include +#include "Quad.h" + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float a = 0.5f; +Vertex btl(-0.5f,0.5f,-0.5f); +Vertex btr(0.5f,0.5f,-0.5f); +Vertex bbr(0.5f,-0.5f,-0.5f); +Vertex bbl(-0.5f,-0.5f,-0.5f); + +Vertex ftl(-0.5f,0.5f,0.5f); +Vertex ftr(0.5f,0.5f,0.5f); +Vertex fbr(0.5f,-0.5f,0.5f); +Vertex fbl(-0.5f,-0.5f,0.5f); + +Quad left(btl,ftl,bbl,fbl); +Quad top(btl,btr,ftl,ftr); +Quad right(ftr,btr,fbr,bbr); +Quad bottom(fbl,fbr,bbl,bbr); +Quad front(ftl,ftr,fbr,fbl); + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + //glTranslatef(0.0f,0.0f,0.0f); + //scale+=0.01f; + glBegin(GL_QUADS); + /* + left.setColor(myColor(RED_f4)); + top.setColor(myColor(GREEN_f4)); + right.setColor(myColor(BLUE_f4)); + bottom.setColor(myColor(PURPLE_f4)); + left.render(); + top.render(); + right.render(); + bottom.render(); + */ + front.setColor(myColor(1,0,1,1)); + front.render(); + glEnd(); + } +} + +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + printf("Succesfully initialized\n"); + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200512011542.cpp b/.history/src/main_20200512011542.cpp new file mode 100644 index 0000000..41e182b --- /dev/null +++ b/.history/src/main_20200512011542.cpp @@ -0,0 +1,164 @@ +#include +#include +#include +#include +#include +#include +#include "Quad.h" + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float a = 0.5f; +Vertex btl(-0.5f,0.5f,-0.5f); +Vertex btr(0.5f,0.5f,-0.5f); +Vertex bbr(0.5f,-0.5f,-0.5f); +Vertex bbl(-0.5f,-0.5f,-0.5f); + +Vertex ftl(-0.5f,0.5f,0.5f); +Vertex ftr(0.5f,0.5f,0.5f); +Vertex fbr(0.5f,-0.5f,0.5f); +Vertex fbl(-0.5f,-0.5f,0.5f); + +Quad left(btl,ftl,bbl,fbl); +Quad top(btl,btr,ftl,ftr); +Quad right(ftr,btr,fbr,bbr); +Quad bottom(fbl,fbr,bbl,bbr); +Quad front(ftl,ftr,fbr,fbl); + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + //glTranslatef(0.0f,0.0f,0.0f); + //scale+=0.01f; + glBegin(GL_QUADS); + /* + left.setColor(myColor(RED_f4)); + left.render(); + top.setColor(myColor(GREEN_f4)); + right.setColor(myColor(BLUE_f4)); + bottom.setColor(myColor(PURPLE_f4)); + top.render(); + right.render(); + bottom.render(); + (/) + front.setColor(myColor(1,0,1,1)); + front.render(); + glEnd(); + } +} + +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + printf("Succesfully initialized\n"); + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200512011547.cpp b/.history/src/main_20200512011547.cpp new file mode 100644 index 0000000..45b2a7b --- /dev/null +++ b/.history/src/main_20200512011547.cpp @@ -0,0 +1,164 @@ +#include +#include +#include +#include +#include +#include +#include "Quad.h" + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float a = 0.5f; +Vertex btl(-0.5f,0.5f,-0.5f); +Vertex btr(0.5f,0.5f,-0.5f); +Vertex bbr(0.5f,-0.5f,-0.5f); +Vertex bbl(-0.5f,-0.5f,-0.5f); + +Vertex ftl(-0.5f,0.5f,0.5f); +Vertex ftr(0.5f,0.5f,0.5f); +Vertex fbr(0.5f,-0.5f,0.5f); +Vertex fbl(-0.5f,-0.5f,0.5f); + +Quad left(btl,ftl,bbl,fbl); +Quad top(btl,btr,ftl,ftr); +Quad right(ftr,btr,fbr,bbr); +Quad bottom(fbl,fbr,bbl,bbr); +Quad front(ftl,ftr,fbr,fbl); + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + //glTranslatef(0.0f,0.0f,0.0f); + //scale+=0.01f; + glBegin(GL_QUADS); + /* + left.setColor(myColor(RED_f4)); + left.render(); + top.setColor(myColor(GREEN_f4)); + right.setColor(myColor(BLUE_f4)); + bottom.setColor(myColor(PURPLE_f4)); + top.render(); + right.render(); + bottom.render(); + */ + front.setColor(myColor(1,0,1,1)); + front.render(); + glEnd(); + } +} + +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + printf("Succesfully initialized\n"); + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200512011559.cpp b/.history/src/main_20200512011559.cpp new file mode 100644 index 0000000..fd69353 --- /dev/null +++ b/.history/src/main_20200512011559.cpp @@ -0,0 +1,164 @@ +#include +#include +#include +#include +#include +#include +#include "Quad.h" + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float a = 0.5f; +Vertex btl(-0.5f,0.5f,-0.5f); +Vertex btr(0.5f,0.5f,-0.5f); +Vertex bbr(0.5f,-0.5f,-0.5f); +Vertex bbl(-0.5f,-0.5f,-0.5f); + +Vertex ftl(-0.5f,0.5f,0.5f); +Vertex ftr(0.5f,0.5f,0.5f); +Vertex fbr(0.5f,-0.5f,0.5f); +Vertex fbl(-0.5f,-0.5f,0.5f); + +Quad left(btl,ftl,bbl,fbl); +Quad top(btl,btr,ftl,ftr); +Quad right(ftr,btr,fbr,bbr); +Quad bottom(fbl,fbr,bbl,bbr); +Quad front(ftl,ftr,fbr,fbl); + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + //glTranslatef(0.0f,0.0f,0.0f); + //scale+=0.01f; + glBegin(GL_QUADS); + /* + left.setColor(myColor(RED_f4)); + left.render(); + top.setColor(myColor(GREEN_f4)); + right.setColor(myColor(BLUE_f4)); + bottom.setColor(myColor(PURPLE_f4)); + top.render(); + right.render(); + bottom.render(); + */ + front.setColor(myColor(RED_f4)); + front.render(); + glEnd(); + } +} + +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + printf("Succesfully initialized\n"); + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200512011641.cpp b/.history/src/main_20200512011641.cpp new file mode 100644 index 0000000..0f75fe0 --- /dev/null +++ b/.history/src/main_20200512011641.cpp @@ -0,0 +1,164 @@ +#include +#include +#include +#include +#include +#include +#include "Quad.h" + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float a = 0.5f; +Vertex btl(-0.5f,0.5f,-0.5f); +Vertex btr(0.5f,0.5f,-0.5f); +Vertex bbr(0.5f,-0.5f,-0.5f); +Vertex bbl(-0.5f,-0.5f,-0.5f); + +Vertex ftl(-0.5f,0.5f,0.5f); +Vertex ftr(0.5f,0.5f,0.5f); +Vertex fbr(0.5f,-0.5f,0.5f); +Vertex fbl(-0.5f,-0.5f,0.5f); + +Quad left(btl,ftl,bbl,fbl); +Quad top(btl,btr,ftl,ftr); +Quad right(ftr,btr,fbr,bbr); +Quad bottom(fbl,fbr,bbl,bbr); +Quad front(ftl,ftr,fbr,fbl); + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + //glTranslatef(0.0f,0.0f,0.0f); + //scale+=0.01f; + glBegin(GL_QUADS); + /* + left.setColor(myColor(RED_f4)); + left.render(); + top.setColor(myColor(GREEN_f4)); + right.setColor(myColor(BLUE_f4)); + bottom.setColor(myColor(PURPLE_f4)); + top.render(); + right.render(); + bottom.render(); + */ + front.setColor(myColor(WHITE_f4)); + front.render(); + glEnd(); + } +} + +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + printf("Succesfully initialized\n"); + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200512011807.cpp b/.history/src/main_20200512011807.cpp new file mode 100644 index 0000000..d6373e4 --- /dev/null +++ b/.history/src/main_20200512011807.cpp @@ -0,0 +1,162 @@ +#include +#include +#include +#include +#include +#include +#include "Quad.h" + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float a = 0.5f; +Vertex btl(-0.5f,0.5f,-0.5f); +Vertex btr(0.5f,0.5f,-0.5f); +Vertex bbr(0.5f,-0.5f,-0.5f); +Vertex bbl(-0.5f,-0.5f,-0.5f); + +Vertex ftl(-0.5f,0.5f,0.5f); +Vertex ftr(0.5f,0.5f,0.5f); +Vertex fbr(0.5f,-0.5f,0.5f); +Vertex fbl(-0.5f,-0.5f,0.5f); + +Quad left(btl,ftl,bbl,fbl); +Quad top(btl,btr,ftl,ftr); +Quad right(ftr,btr,fbr,bbr); +Quad bottom(fbl,fbr,bbl,bbr); +Quad front(ftl,ftr,fbr,fbl); + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + //glTranslatef(0.0f,0.0f,0.0f); + //scale+=0.01f; + glBegin(GL_QUADS); + left.setColor(myColor(RED_f4)); + left.render(); + top.setColor(myColor(GREEN_f4)); + top.render(); + right.setColor(myColor(BLUE_f4)); + right.render(); + bottom.setColor(myColor(PURPLE_f4)); + bottom.render(); + front.setColor(myColor(WHITE_f4)); + front.render(); + glEnd(); + } +} + +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + printf("Succesfully initialized\n"); + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200512011831.cpp b/.history/src/main_20200512011831.cpp new file mode 100644 index 0000000..0307433 --- /dev/null +++ b/.history/src/main_20200512011831.cpp @@ -0,0 +1,162 @@ +#include +#include +#include +#include +#include +#include +#include "Quad.h" + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float a = 0.5f; +Vertex btl(-0.5f,0.5f,-0.5f); +Vertex btr(0.5f,0.5f,-0.5f); +Vertex bbr(0.5f,-0.5f,-0.5f); +Vertex bbl(-0.5f,-0.5f,-0.5f); + +Vertex ftl(-0.5f,0.5f,0.5f); +Vertex ftr(0.5f,0.5f,0.5f); +Vertex fbr(0.5f,-0.5f,0.5f); +Vertex fbl(-0.5f,-0.5f,0.5f); + +Quad left(btl,ftl,bbl,fbl); +Quad top(btl,btr,ftl,ftr); +Quad right(ftr,btr,fbr,bbr); +Quad bottom(fbl,fbr,bbl,bbr); +Quad front(ftl,ftr,fbr,fbl); + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + //glTranslatef(0.0f,0.0f,0.0f); + //scale+=0.01f; + glBegin(GL_QUADS); + left.setColor(myColor(RED_f4)); + left.render(); + top.setColor(myColor(GREEN_f4)); + top.render(); + right.setColor(myColor(BLUE_f4)); + right.render(); + bottom.setColor(myColor(PURPLE_f4)); + bottom.render(); + front.setColor(myColor(1,1,1,.5)); + front.render(); + glEnd(); + } +} + +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + printf("Succesfully initialized\n"); + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200512011844.cpp b/.history/src/main_20200512011844.cpp new file mode 100644 index 0000000..42ae6c3 --- /dev/null +++ b/.history/src/main_20200512011844.cpp @@ -0,0 +1,162 @@ +#include +#include +#include +#include +#include +#include +#include "Quad.h" + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float a = 0.5f; +Vertex btl(-0.5f,0.5f,-0.5f); +Vertex btr(0.5f,0.5f,-0.5f); +Vertex bbr(0.5f,-0.5f,-0.5f); +Vertex bbl(-0.5f,-0.5f,-0.5f); + +Vertex ftl(-0.5f,0.5f,0.5f); +Vertex ftr(0.5f,0.5f,0.5f); +Vertex fbr(0.5f,-0.5f,0.5f); +Vertex fbl(-0.5f,-0.5f,0.5f); + +Quad left(btl,ftl,bbl,fbl); +Quad top(btl,btr,ftl,ftr); +Quad right(ftr,btr,fbr,bbr); +Quad bottom(fbl,fbr,bbl,bbr); +Quad front(ftl,ftr,fbr,fbl); + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + //glTranslatef(0.0f,0.0f,0.0f); + //scale+=0.01f; + glBegin(GL_QUADS); + left.setColor(myColor(RED_f4)); + left.render(); + top.setColor(myColor(GREEN_f4)); + top.render(); + right.setColor(myColor(BLUE_f4)); + right.render(); + bottom.setColor(myColor(PURPLE_f4)); + bottom.render(); + front.setColor(myColor(1,1,1,.2)); + front.render(); + glEnd(); + } +} + +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + printf("Succesfully initialized\n"); + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200512011858.cpp b/.history/src/main_20200512011858.cpp new file mode 100644 index 0000000..70335ae --- /dev/null +++ b/.history/src/main_20200512011858.cpp @@ -0,0 +1,162 @@ +#include +#include +#include +#include +#include +#include +#include "Quad.h" + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float a = 0.5f; +Vertex btl(-0.5f,0.5f,-0.5f); +Vertex btr(0.5f,0.5f,-0.5f); +Vertex bbr(0.5f,-0.5f,-0.5f); +Vertex bbl(-0.5f,-0.5f,-0.5f); + +Vertex ftl(-0.5f,0.5f,0.5f); +Vertex ftr(0.5f,0.5f,0.5f); +Vertex fbr(0.5f,-0.5f,0.5f); +Vertex fbl(-0.5f,-0.5f,0.5f); + +Quad left(btl,ftl,bbl,fbl); +Quad top(btl,btr,ftl,ftr); +Quad right(ftr,btr,fbr,bbr); +Quad bottom(fbl,fbr,bbl,bbr); +Quad front(ftl,ftr,fbr,fbl); + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + //glTranslatef(0.0f,0.0f,0.0f); + //scale+=0.01f; + glBegin(GL_QUADS); + left.setColor(myColor(RED_f4)); + left.render(); + top.setColor(myColor(GREEN_f4)); + top.render(); + right.setColor(myColor(BLUE_f4)); + right.render(); + bottom.setColor(myColor(PURPLE_f4)); + bottom.render(); + front.setColor(myColor(0,0,0,0)); + front.render(); + glEnd(); + } +} + +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + printf("Succesfully initialized\n"); + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.history/src/main_20200512011906.cpp b/.history/src/main_20200512011906.cpp new file mode 100644 index 0000000..36cd6d7 --- /dev/null +++ b/.history/src/main_20200512011906.cpp @@ -0,0 +1,160 @@ +#include +#include +#include +#include +#include +#include +#include "Quad.h" + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float a = 0.5f; +Vertex btl(-0.5f,0.5f,-0.5f); +Vertex btr(0.5f,0.5f,-0.5f); +Vertex bbr(0.5f,-0.5f,-0.5f); +Vertex bbl(-0.5f,-0.5f,-0.5f); + +Vertex ftl(-0.5f,0.5f,0.5f); +Vertex ftr(0.5f,0.5f,0.5f); +Vertex fbr(0.5f,-0.5f,0.5f); +Vertex fbl(-0.5f,-0.5f,0.5f); + +Quad left(btl,ftl,bbl,fbl); +Quad top(btl,btr,ftl,ftr); +Quad right(ftr,btr,fbr,bbr); +Quad bottom(fbl,fbr,bbl,bbr); +Quad front(ftl,ftr,fbr,fbl); + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + //glTranslatef(0.0f,0.0f,0.0f); + //scale+=0.01f; + glBegin(GL_QUADS); + left.setColor(myColor(RED_f4)); + left.render(); + top.setColor(myColor(GREEN_f4)); + top.render(); + right.setColor(myColor(BLUE_f4)); + right.render(); + bottom.setColor(myColor(PURPLE_f4)); + bottom.render(); + glEnd(); + } +} + +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + printf("Succesfully initialized\n"); + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +} diff --git a/.kdev4/hs-cpp.kdev4 b/.kdev4/hs-cpp.kdev4 new file mode 100644 index 0000000..6ed5f8c --- /dev/null +++ b/.kdev4/hs-cpp.kdev4 @@ -0,0 +1,2 @@ +[Buildset] +BuildItems=@Variant(\x00\x00\x00\t\x00\x00\x00\x00\x01\x00\x00\x00\x0b\x00\x00\x00\x00\x01\x00\x00\x00\x0c\x00h\x00s\x00-\x00c\x00p\x00p) diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..e8abdf5 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,25 @@ +{ + "workbench.colorCustomizations": { + "activityBar.activeBackground": "#9000bd", + "activityBar.activeBorder": "#201800", + "activityBar.background": "#9000bd", + "activityBar.foreground": "#e7e7e7", + "activityBar.inactiveForeground": "#e7e7e799", + "activityBarBadge.background": "#201800", + "activityBarBadge.foreground": "#e7e7e7", + "statusBar.background": "#69008a", + "statusBar.border": "#69008a", + "statusBar.foreground": "#e7e7e7", + "statusBarItem.hoverBackground": "#9000bd", + "titleBar.activeBackground": "#69008a", + "titleBar.activeForeground": "#e7e7e7", + "titleBar.border": "#69008a", + "titleBar.inactiveBackground": "#69008a99", + "titleBar.inactiveForeground": "#e7e7e799" + }, + "peacock.color": "#69008a", + "cSpell.words": [ + "OPENGL", + "Translatef" + ] +} \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..aeb088a --- /dev/null +++ b/Makefile @@ -0,0 +1,4 @@ +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o +targets = $(patsubst bin/%.o, src/%.cpp, $(goals)) + +$(goals): $(targets) ; diff --git a/Makefile.bak b/Makefile.bak new file mode 100644 index 0000000..d373bdd --- /dev/null +++ b/Makefile.bak @@ -0,0 +1,40 @@ +LINK = -lstdc++ -lSDL2 -lOpenGL -lGLEW -lGLU +DBG = -Wall +CC := clang $(DBG) -c + +all: build ; + +goals = bin/main.o bin/Cube.o bin/Color.o bin/Quad.o bin/Vertex.o + +define pro = +$(CC) -c $^ -o $@ +endef + +#bin/main.o: src/main.cpp +# $(pro) +#bin/Cube.o: src/Cube.cpp +# $(pro) +#bin/Color.o: src/Color.cpp +# $(pro) +#bin/Quad.o: src/Quad.cpp +# $(pro) +#bin/Vertex.o: src/Vertex.cpp +# $(pro) +targets = $(patsubst bin/%.o,src/%.cpp,$(goals)) +$(goals): $(targets) ; + $(foreach goal,$(goals),$( \ + $(CC) $(patsubst bin/%.o, src/%.cpp, $(goal)) \ + echo $(goal) \ + )) + +build: $(targets) ; + + #$(CC) $(goals) -o ./bin/simulator $(LINK) + +.PHONY: clean +clean: + rm -rf ./bin/* + +.PHONY: run +run: build ; + ./bin/simulator \ No newline at end of file diff --git a/hs-cpp.kdev4 b/hs-cpp.kdev4 new file mode 100644 index 0000000..2e2c330 --- /dev/null +++ b/hs-cpp.kdev4 @@ -0,0 +1,4 @@ +[Project] +CreatedFrom=Makefile +Manager=KDevCustomMakeManager +Name=hs-cpp diff --git a/src/Color.cpp b/src/Color.cpp new file mode 100644 index 0000000..b4b3a3c --- /dev/null +++ b/src/Color.cpp @@ -0,0 +1,9 @@ +#include "Color.h" + +myColor::myColor(float r,float g,float b,float a) { + this->r=r; + this->g=g; + this->b=b; + this->a=a; +} +myColor::myColor() {} \ No newline at end of file diff --git a/src/Color.h b/src/Color.h new file mode 100644 index 0000000..481db58 --- /dev/null +++ b/src/Color.h @@ -0,0 +1,13 @@ +#define RED_f4 1.0f,0.0f,0.0f,1.0f +#define GREEN_f4 0.0f,1.0f,0.0f,1.0f +#define BLUE_f4 0.0f,0.0f,1.0f,1.0f +#define PURPLE_f4 1.0f,0.0f,1.0f,1.0f +#define WHITE_f4 1.0f,1.0f,1.0f,1.0f +#define BLACK_f4 0.0f,0.0f,0.0f,1.0f + +class myColor { + public: + float r,g,b,a; + myColor(); + myColor(float r,float g,float b,float a); +}; \ No newline at end of file diff --git a/src/Cube.cpp b/src/Cube.cpp new file mode 100644 index 0000000..f65b20c --- /dev/null +++ b/src/Cube.cpp @@ -0,0 +1,40 @@ +#include "Cube.h" + +Cube::Cube(Vertex backTopLeft, + Vertex backTopRight, + Vertex backBottomRight, + Vertex backBottomLeft, + Vertex frontTopLeft, + Vertex frontTopRight, + Vertex frontBottomRight, + Vertex frontBottomLeft +) { + this->btl=backTopLeft; + this->btr=backTopRight; + this->bbr=backBottomRight; + this->bbl=backBottomLeft; + this->ftl=frontTopRight; + this->ftl=frontTopRight; + this->fbl=frontBottomLeft; + this->fbr=frontBottomRight; +} + +Cube::Cube( + Quad left, + Quad top, + Quad right, + Quad bottom, + Quad front, + Quad back +) { + this->left=left; + this->top=top; + this->right=right; + this->bottom=bottom; + this->front=front; + this->back=back; +} + +void Cube::setColor(myColor c) { + this->color=c; +} \ No newline at end of file diff --git a/src/Cube.h b/src/Cube.h new file mode 100644 index 0000000..9ab9c7b --- /dev/null +++ b/src/Cube.h @@ -0,0 +1,26 @@ +#include "Quad.h" + +class Cube { + public: + myColor color; + Quad left,top,right,bottom,back,front; + Vertex btl,btr,bbr,bbl,ftl,ftr,fbr,fbl; + + Cube(Vertex backTopLeft, + Vertex backTopRight, + Vertex backBottomRight, + Vertex backBottomLeft, + Vertex frontTopLeft, + Vertex frontTopRight, + Vertex frontBottomRight, + Vertex frontBottomLeft + ); + Cube(Quad left, + Quad top, + Quad right, + Quad bottom, + Quad front, + Quad back + ); + void setColor(myColor c); +}; \ No newline at end of file diff --git a/src/Quad.cpp b/src/Quad.cpp new file mode 100644 index 0000000..2134b11 --- /dev/null +++ b/src/Quad.cpp @@ -0,0 +1,23 @@ +#include "Quad.h" +#include + +Quad::Quad(Vertex topL, Vertex topR, Vertex botR, Vertex botL) { + this->topL=topL; + this->topR=topR; + this->botR=botR; + this->botL=botL; +} + +Quad::Quad() {} + +void Quad::setColor(myColor c) { + this->color=c; +} + +void Quad::render() { + glColor4f(color.r,color.g,color.b,color.a); + glVertex3f(topL.x,topL.y,topL.z); + glVertex3f(topR.x,topR.y,topR.z); + glVertex3f(botR.x,botR.y,botR.z); + glVertex3f(botL.x,botL.y,botL.z); +} \ No newline at end of file diff --git a/src/Quad.h b/src/Quad.h new file mode 100644 index 0000000..c2b2a05 --- /dev/null +++ b/src/Quad.h @@ -0,0 +1,13 @@ +#include "Color.h" +#include "Vertex.h" +#include + +class Quad { + public: + myColor color; + Vertex topL,topR,botR,botL; + Quad(Vertex topL, Vertex topR, Vertex botR, Vertex botL); + Quad(); + void setColor(myColor c); + void render(); +}; \ No newline at end of file diff --git a/src/Vertex.cpp b/src/Vertex.cpp new file mode 100644 index 0000000..a2b8180 --- /dev/null +++ b/src/Vertex.cpp @@ -0,0 +1,11 @@ +#include "Vertex.h" +#include + +Vertex::Vertex(float x, float y, float z) { + this->x=x; + this->y=y; + this->z=z; + printf("Created a vertex at %f,%f,%f\n",x,y,z); +} + +Vertex::Vertex() {} \ No newline at end of file diff --git a/src/Vertex.h b/src/Vertex.h new file mode 100644 index 0000000..51c0c21 --- /dev/null +++ b/src/Vertex.h @@ -0,0 +1,6 @@ +class Vertex { + public: + float x,y,z; + Vertex(); + Vertex(float x, float y, float z); +}; \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..36cd6d7 --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,160 @@ +#include +#include +#include +#include +#include +#include +#include "Quad.h" + +SDL_Window *gWindow = NULL; +SDL_GLContext gContext; + +bool gRenderQuad = true; +int width=500,height=500; + +bool init() { + bool success = true; + if(SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "[ERROR] Could not initialize SDL video\n%s\n", SDL_GetError()); + success = false; + } else { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + gWindow = SDL_CreateWindow("Hydro Simulator", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + width, + height, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN + ); + if(gWindow == NULL) { + + fprintf(stderr, "[ERROR] Could not create an SDL window\n%s\n", SDL_GetError()); + success = false; + + } else { + gContext = SDL_GL_CreateContext(gWindow); + if(gContext == NULL) { + fprintf(stderr, "[ERROR]Could not create an SDL OpenGL context\n%s\n", SDL_GetError()); + success = false; + } else { + if(SDL_GL_SetSwapInterval(1) < 0) { + fprintf(stderr, "[ERROR] Could not set SDL vsync\n%s\n", SDL_GetError()); + success = false; + } + } + } + } + return success; +} + +bool initGL() { + bool success = true; + GLenum error = GL_NO_ERROR; + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix projection\n%s\n", + gluErrorString(error) + ); + success = false; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize OpenGL matrix modelview\n%s\n", + gluErrorString(error) + ); + success = false; + } + glClearColor(0,0,0,255); + error = glGetError(); + if(error != GL_NO_ERROR) { + fprintf(stderr, + "[ERROR] Could not initialize the OpenGL clear color\n%s\n", + gluErrorString(error) + ); + success = false; + } + return success; +} + +void handleKeys(unsigned char key, int x, int y) { + if(key == 'q') { + gRenderQuad = !gRenderQuad; + } else { + if(key==SDL_SCANCODE_ESCAPE) { + gRenderQuad = false; + } + } +} + +void update() { +} + +float a = 0.5f; +Vertex btl(-0.5f,0.5f,-0.5f); +Vertex btr(0.5f,0.5f,-0.5f); +Vertex bbr(0.5f,-0.5f,-0.5f); +Vertex bbl(-0.5f,-0.5f,-0.5f); + +Vertex ftl(-0.5f,0.5f,0.5f); +Vertex ftr(0.5f,0.5f,0.5f); +Vertex fbr(0.5f,-0.5f,0.5f); +Vertex fbl(-0.5f,-0.5f,0.5f); + +Quad left(btl,ftl,bbl,fbl); +Quad top(btl,btr,ftl,ftr); +Quad right(ftr,btr,fbr,bbr); +Quad bottom(fbl,fbr,bbl,bbr); +Quad front(ftl,ftr,fbr,fbl); + +float scale = -1.0f; +void render() { + glClear(GL_COLOR_BUFFER_BIT); + if(gRenderQuad) { + glLoadIdentity(); + //glTranslatef(0.0f,0.0f,0.0f); + //scale+=0.01f; + glBegin(GL_QUADS); + left.setColor(myColor(RED_f4)); + left.render(); + top.setColor(myColor(GREEN_f4)); + top.render(); + right.setColor(myColor(BLUE_f4)); + right.render(); + bottom.setColor(myColor(PURPLE_f4)); + bottom.render(); + glEnd(); + } +} + +int main() { + init(); + initGL(); + SDL_StartTextInput(); + bool quit = false; + SDL_Event e; + printf("Succesfully initialized\n"); + while(!quit) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + quit = true; + } else { + if(e.type == SDL_TEXTINPUT) { + int x=0,y=0; + SDL_GetMouseState(&x,&y); + handleKeys(e.text.text[0], x, y); + } + } + } + render(); + SDL_GL_SwapWindow(gWindow); + } + SDL_StopTextInput(); + return 0; +}