diff --git a/.gitignore b/.gitignore index 29b215c..0117ac2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ # Verzeichnisse Mitschriften/ +build # Dateien *_Mitschrift.tex @@ -216,3 +217,51 @@ TSWLatexianTemp* # expex forward references with \gathertags *-tags.tex + + +# Cmake +CMakeCache.txt +CMakeFiles +CMakeScripts +Testing +Makefile +cmake_install.cmake +install_manifest.txt +compile_commands.json +CTestTestfile.cmake +CMakeLists.txt.user + +# C++ + +# Prerequisites +*.d + +# Compiled Object files +*.slo +*.lo +*.o +*.obj + +# Precompiled Headers +*.gch +*.pch + +# Compiled Dynamic libraries +*.so +*.dylib +*.dll + +# Fortran module files +*.mod +*.smod + +# Compiled Static libraries +*.lai +*.la +*.a +*.lib + +# Executables +*.exe +*.out +*.app diff --git a/Code/.clang-format b/Code/.clang-format new file mode 100644 index 0000000..ee38fa9 --- /dev/null +++ b/Code/.clang-format @@ -0,0 +1,6 @@ +--- +Language: Cpp +BasedOnStyle: WebKit +ColumnLimit: 100 +FixNamespaceComments: true +... diff --git a/Code/CMakeLists.txt b/Code/CMakeLists.txt new file mode 100644 index 0000000..6f06025 --- /dev/null +++ b/Code/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required (VERSION 3.8) + +if ( CMAKE_COMPILER_IS_GNUCC ) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra") +endif() + +find_package(OpenGL REQUIRED) +find_package(GLUT REQUIRED) + +add_subdirectory(hello_world) diff --git a/Code/hello_world/CMakeLists.txt b/Code/hello_world/CMakeLists.txt new file mode 100644 index 0000000..d59d88d --- /dev/null +++ b/Code/hello_world/CMakeLists.txt @@ -0,0 +1,5 @@ +cmake_minimum_required (VERSION 3.8) + +add_executable (hello_world helloWorld.c) +target_include_directories(hello_world PRIVATE ${OPENGL_INCLUDE_DIRS} ${GLUT_INCLUDE_DIRS} ) +target_link_libraries(hello_world ${OPENGL_LIBRARIES} ${GLUT_LIBRARY} ) diff --git a/Code/hello_world/helloWorld.c b/Code/hello_world/helloWorld.c new file mode 100644 index 0000000..098a592 --- /dev/null +++ b/Code/hello_world/helloWorld.c @@ -0,0 +1,53 @@ +#include +#include + +int width = 640; +int height = 480; + +void init(int argc, char** argv) +{ + glutInit(&argc, argv); // Initialisierung der GLUT Bibliothek + glutInitDisplayMode(GLUT_SINGLE); // Initialisierung des Single Buffer Modes + glutInitWindowSize(width, height); // Fenstergröße in Pixel (Breite, Hoehe) + glutInitWindowPosition( + 100, 100); // Fensterposition in Pixel, ausgehend vom Ursprung des Window Systems + glViewport(0, 0, width, height); + glutCreateWindow("Hello world"); // Erstellen des Fensters + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluOrtho2D(0, width, 0, height); + glMatrixMode(GL_MODELVIEW); + glClearColor(0.0f, 0.0f, 0.0f, 1.0f); +} + +void display(void) +{ + const char* myText = "Hello World!"; + int j; + + glClear(GL_COLOR); + glColor3f(1.0, 0.0, 0.0); + + glBegin(GL_POLYGON); + glVertex3f((width / 2) - (width / 4), (height / 2) - (height / 4), 0.0); + glVertex3f((width / 2) + (width / 4), (height / 2) - (height / 4), 0.0); + glVertex3f((width / 2) + (width / 4), (height / 2) + (height / 4), 0.0); + glVertex3f((width / 2) - (width / 4), (height / 2) + (height / 4), 0.0); + glEnd(); + + glColor3f(1.0, 1.0, 1.0); + glRasterPos2i((width / 2) - (width / 4) + 10, (height / 2) - (height / 4) + 10); + for (j = 0; j < strlen(myText); j++) { + glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18, myText[j]); + } + + glFlush(); +} + +int main(int argc, char** argv) +{ + init(argc, argv); + glutDisplayFunc(display); // Callback-Funktion für das Fenster + glutMainLoop(); // Abgabe der Kontrolle an GLUT-Bibliothek + return 0; +} diff --git a/Computergraphik_Hopp_Skript_AM.pdf b/Computergraphik_Hopp_Skript_AM.pdf index 11d4eda..08ac89d 100644 Binary files a/Computergraphik_Hopp_Skript_AM.pdf and b/Computergraphik_Hopp_Skript_AM.pdf differ diff --git a/Folien/Vorlesungsfolien_2018_10_10.pdf b/Folien/Vorlesungsfolien_2018_10_10.pdf new file mode 100644 index 0000000..e5ae4ef Binary files /dev/null and b/Folien/Vorlesungsfolien_2018_10_10.pdf differ