OpenGL4.6着色语言精通_第三版_源码

所属分类:OpenGL
开发工具:C/C++
文件大小:16259KB
下载次数:3
上传日期:2020-05-13 11:08:39
上 传 者jts
说明:  这源码是OpenGL4.6着色语言精通_第三版的全部源代码, 利用GLSL 4.6和C++ 17构建高质量实时三维图形。 主要重点是OpenGL着色 语言(GLSL)。因此,我们不花时间 讨论用OpenGL编程的基础。在这个 我认为读者对在OpenGL中编程,理解三维渲染 模型坐标、视图坐标、剪裁等概念 坐标、透视变换和其他 关联的转换。没有任何假设 但是,有着色编程的经验,所以如果 对GLSL来说,这是一个很好的开始。
(OpenGL 4 Shading Language Cookbook Third Edition, All source code Build high-quality, real-time 3D graphics with OpenGL 4.6, GLSL 4.6 and C++17 The primary focus of this book is the OpenGL Shading Language (GLSL). Therefore, we don't spend any time discussing the basics of programming with OpenGL. In this book I assume that the reader has some experience with programming in OpenGL, and understands 3D rendering concepts such as model coordinates, view coordinates, clip coordinates, perspective transforms, and the other associated transformations. There's no assumption of any experience with shader programming, however, so if you're new to GLSL, this is a great place to start.)

文件列表:
chapter01\CMakeLists.txt (428, 2019-10-19)
chapter01\main.cpp (523, 2019-10-19)
chapter01\scenebasic.cpp (11777, 2019-10-19)
chapter01\scenebasic.h (655, 2019-10-19)
chapter01\shader\basic.frag.glsl (149, 2019-10-19)
chapter01\shader\basic.vert.glsl (238, 2019-10-19)
chapter02\CMakeLists.txt (507, 2019-10-19)
chapter02\main.cpp (1181, 2019-10-19)
chapter02\scenebasic_attrib.cpp (2967, 2019-10-19)
chapter02\scenebasic_attrib.h (447, 2019-10-19)
chapter02\scenebasic_uniform.cpp (3139, 2019-10-19)
chapter02\scenebasic_uniform.h (516, 2019-10-19)
chapter02\scenebasic_uniformblock.cpp (4849, 2019-10-19)
chapter02\scenebasic_uniformblock.h (544, 2019-10-19)
chapter02\sceneseparable.cpp (7355, 2019-10-19)
chapter02\sceneseparable.h (839, 2019-10-19)
chapter02\shader\basic.frag.glsl (149, 2019-10-19)
chapter02\shader\basic.vert.glsl (238, 2019-10-19)
chapter02\shader\basic_uniform.frag (130, 2019-10-19)
chapter02\shader\basic_uniform.vert (374, 2019-10-19)
chapter02\shader\basic_uniformblock.frag (498, 2019-10-19)
chapter02\shader\basic_uniformblock.vert (230, 2019-10-19)
chapter02\shader\basic_uniformblock_41.frag (477, 2019-10-19)
chapter02\shader\basic_uniformblock_41.vert (230, 2019-10-19)
chapter02\shader\separable.vert.glsl (366, 2019-10-19)
chapter02\shader\separable1.frag.glsl (139, 2019-10-19)
chapter02\shader\separable2.frag.glsl (244, 2019-10-19)
chapter03\CMakeLists.txt (472, 2019-10-19)
chapter03\main.cpp (1391, 2019-10-19)
chapter03\scenediffuse.cpp (1758, 2019-10-19)
chapter03\scenediffuse.h (490, 2019-10-19)
chapter03\scenediscard.cpp (2073, 2019-10-19)
chapter03\scenediscard.h (467, 2019-10-19)
chapter03\sceneflat.cpp (2107, 2019-10-19)
chapter03\sceneflat.h (487, 2019-10-19)
chapter03\scenephong.cpp (2279, 2019-10-19)
chapter03\scenephong.h (414, 2019-10-19)
chapter03\scenesubroutine.cpp (2854, 2019-10-19)
chapter03\scenesubroutine.h (502, 2019-10-19)
... ...

Example code from the [OpenGL 4 Shading Language Cookbook, 3rd Edition][cookbook] ========================================================= The example code from the [OpenGL 4 Shading Language Cookbook, 3rd Edition][cookbook], by David Wolff and published by Packt Publishing. Requirements ------------- To compile these examples, you'll need the following: * The [GLM Mathematics Library][GLM] version 0.9.6 or later. Note that versions prior to 0.9.6 may not work properly because of a switch from degrees to radians. GLM 0.9.5 will work, but you'll need to add `#define GLM_FORCE_RADIANS` prior to including the glm header files. * [GLFW][] version 3.0 or later. Compiling the examples ---------------------- The example code builds with [CMake][]. Note that the examples for Chapter 10 will not function on MacOS due to lack of support for compute shaders on that platform. 1. Install [GLFW][] by following the instructions on their [web site][GLFW]. 2. Install the latest version of [GLM][]. Note that for [CMake][] to find GLM correctly, you need to run the install "build" (e.g. `make install`) or install GLM from your favorite package manager. Otherwise, the CMake config files will not be created/available. 3. Download this example code from [github][ghcookbook], or clone using git. 4. Run cmake. If cmake has difficulties finding the GLFW or GLM installations, set the variable [`CMAKE_PREFIX_PATH`][cmake_prefix] to help cmake find them. It can be tricky to get CMake to find the GLM libraries, unfortunately. See below for tips. 5. Compile by running `make`. Any problems, [create an issue](https://github.com/PacktPublishing/OpenGL-4-Shading-Language-Cookbook-Third-Edition/issues) on [github][ghcookbook]. Tips for getting CMake to find GLM ----------------------------------------- When searching for GLM, CMake looks for the files `glmConfig.cmake` and `glmConfigVersion.cmake`. If you install GLM using a package manager such as Homebrew on macOS, or a Linux package manager the cmake files should already be included. Otherwise, if you're using the GLM source distribution, you'll have to run GLM through CMake to get it to generate the `glmConfig.cmake` and `glmConfigVersion.cmake` files. It is frustrating, I wish that the GLM maintainers didn't require this. 1. Download GLM and extract it to some location: `GLM_SRC` 1. `cd $GLM_SRC` 1. `mkdir build` 1. `cd build` 1. `cmake -D GLM_TEST_ENABLE=OFF -D CMAKE_INSTALL_PREFIX=MY_GLM_LOCATION ..` 1. `cmake --build . --target install` Replace `GLM_SRC` above with the place where you extracted the GLM zip file, and replace `MY_GLM_LOCATION` with the location where you want to install GLM. This should generate the needed cmake files and install all of GLM to `MY_GLM_LOCATION`. Tips for compiling for Windows with Visual Studio --------------------------------------------- * Use the Visual Studio target in [CMake][]: `-G "Visual Studio..."`, open the Visual Studio solution. You should see one project per chapter. * Each chapter requires a command line argument to choose a recipe. When running in VS, be sure to set the 'Command Argument' under 'Properties' for the appropriate recipe. OpenGL Function Loading ----------------------- An OpenGL header file and a function loader for a 4.3 core profile are included with this project. They were generated using [GLAD][]. This loader should also work on MacOS under a 4.1 core profile, but of course not all functions will load. The code has been tested with OpenGL 4.3 on Windows/Linux and OpenGL 4.1 on MacOS. [GLM]: http://glm.g-truc.net [GLFW]: http://glfw.org [ghcookbook]: https://github.com/PacktPublishing/OpenGL-4-Shading-Language-Cookbook-Third-Edition [cookbook]: http://www.packtpub.com/ [GLLoadGen]: https://bitbucket.org/alfonse/glloadgen/wiki/Home [CMake]: http://www.cmake.org/ [GLAD]: https://github.com/Dav1dde/glad [cmake_prefix]: https://cmake.org/cmake/help/latest/variable/CMAKE_PREFIX_PATH.html # OpenGL 4 Shading Language Cookbook - Third Edition This is the code repository for [OpenGL 4 Shading Language Cookbook - Third Edition](https://www.packtpub.com/game-development/opengl-4-shading-language-cookbook-third-edition?utm_source=GitHub&utm_medium=repository&utm_campaign=9781789342253), published by Packt. **Build high-quality, real-time 3D graphics with OpenGL 4.6, GLSL 4.6 and C++17** ## What is this book about? OpenGL 4 Shading Language Cookbook, Third Edition provides easy-to-follow recipes that first walk you through the theory and background behind each technique, and then proceed to showcase and explain the GLSL and OpenGL code needed to implement them. This book covers the following exciting features: * Compile, debug, and communicate with shader programs * Use compute shaders for physics, animation, and general computing * Learn about features such as shader storage buffer objects and image load/store * Utilize noise in shaders and learn how to use shaders in animations * Use textures for various effects including cube maps for reflection or refraction If you feel this book is for you, get your [copy](https://www.amazon.com/dp/1789342252) today! https://www.packtpub.com/ ## Instructions and Navigations All of the code is organized into folders. For example, Chapter02. The code will look like the following: ``` glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 6); glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); GLFWwindow *window = glfwCreateWindow(800, 600, "Title", nullptr, nullptr); ``` **Following is what you need for this book:** If you are a graphics programmer looking to learn the GLSL shading language, this book is for you. A basic understanding of 3D graphics and programming experience with C++ are required. With the following software and hardware list you can run all code files present in the book (Chapter 1-11). ### Software and Hardware List | Chapter | Software required | OS required | | --------| ------------------------------------| -----------------------------------| | All | GLM Mathematics Library | Windows, Mac OS X, and Linux (Any) | | | GLFW | Windows, Mac OS X, and Linux (Any) | | | CMake | Windows, Mac OS X, and Linux (Any) | | | Visual Studio 2017 | Windows, Mac OS X, and Linux (Any) | We also provide a PDF file that has color images of the screenshots/diagrams used in this book. [Click here to download it](https://www.packtpub.com/sites/default/files/downloads/9781789342253_ColorImages.pdf). ### Related products * Godot Engine Game Development Projects [[Packt]](https://www.packtpub.com/game-development/godot-game-engine-projects) [[Amazon]](https://www.amazon.com/Godot-Engine-Game-Development-Projects-ebook/dp/B079HZD1S7) * Mastering C++ Game Development [[Packt]](https://www.packtpub.com/game-development/mastering-c-game-development) [[Amazon]](https://www.amazon.com/Mastering-Game-Development-professional-realistic/dp/1788629221) ## Get to Know the Author **David Wolff** is a professor in the computer science department at Pacific Lutheran University (PLU). He received a PhD in Physics and an MS in computer science from Oregon State University. He has been teaching computer graphics to undergraduates at PLU for over 17 years, using OpenGL. ## Other books by the author * [OpenGL 4.0 Shading Language Cookbook](https://www.packtpub.com/game-development/opengl-40-shading-language-cookbook?utm_source=GitHub&utm_medium=repository&utm_campaign=9781849514767) * [OpenGL 4.0 Shading Language Cookbook, Second Edition](https://www.packtpub.com/game-development/opengl-4-shading-language-cookbook-second-edition?utm_source=GitHub&utm_medium=repository&utm_campaign=9781782167020) ### Suggestions and Feedback [Click here](https://docs.google.com/forms/d/e/1FAIpQLSdy7dATC6QmEL81FIUuymZ0Wy9vH1jHkvpY57OiMeKGqib_Ow/viewform) if you have any feedback or suggestions.

近期下载者

相关文件


收藏者