Git Product home page Git Product logo

glslcookbook's Issues

Error when running some examples

Hello

Hello does any one what this means.

genType glm::inversesqrt(const genType&) [with genType = float]: Assertion `x > genType(0)' failed.
Aborted (core dumped)

Error in bezcurve.tcs (OK in the book's text)

Hi!

    gl_TessLevelOuter[0] = float(NumSegments);
    gl_TessLevelOuter[1] = float(NumStrips);

should be:

    gl_TessLevelOuter[0] = float(NumStrips);
    gl_TessLevelOuter[1] = float(NumSegments);

Best regards!

LINK : fatal error LNK1104: cannot open file '..\ingredients\Debug\ingredients.lib'

Not sure if the git still being maintained. When I open GLSLCOOKBOOK.sln, and right click on ALL_BUILD and build, I keep receiving
LINK : fatal error LNK1104: cannot open file '..\ingredients\Debug\ingredients.lib'
and I didn't have this 'ingredients.lib' in the specified location. Any idea?
I am using visual studio 2015 with CMake 3.50

Forward Compatible Context

should Forward Compatible Context flag be really used?

I've found this answer at StackExchange and it says:

Never, ever, ever, EVER use FORWARD_COMPATIBLE for ANYTHING.

So maybe this line from main.cpp

    glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);

should be simply removed?

CMake unable to find GLFW3_LIBRARY

Hello I am stuck on step 10) of "Compiling for Windows with Visual Studio 2012". Specifically when I press configure on CMake, it can find the GLFW3_INCLUDE_DIR but cannot find GLFW3_LIBRARY. If it helps, cmake can find GLM_INCLUDE_DIR. I have placed all the files in "ProgramFiles(x86)" as stated in the instructions.

Errors

Hello, I encountered several errors after building the code. I used CodeBlocks 13.12 + GCC 4.8 on Linux for reference. The first error was that "stdio.h" or "cstdio" had not been declared in any of the main.cpp for all chapters -- so I just added the include and that resolved the error there. The second error I encountered involves Chapter 5 for both the 'blur' and 'oit' recipes. For 'oit' I receive a GLSL parser error, "syntax error", on line 74 concerning the 'frags' variable in oit.fs. Regarding the blur recipe, it says "line 63 in blur.fs -- built-in function parameter type check fail: offset must be a constant / literal in texture functions." The next error I encountered is more of a concern than an error in Chapter 7. The program runs fine, but I'm getting a 'Invalid operation' error message coming from GLUtils::checkForOpenGLError( ... ) method, but there doesn't appear to be any errors when the program runs (I just thought I should bring it up regardless). The next issue I came across is a Segmentation Fault in Chapter 10 for 'cloth' recipe and I think it might be the TGA loader. The program just opens and then seg faults. I didn't seem to have any issues with any of the other TGA loaded programs though. Lastly, I though I should mention that I had to make a minor adjustment for Chapters 9 and 10. When I clone the repository, the GL major / minor versions were 4.4 for chapters 9 and 10 (which kind of threw me off since all the others were 4.3). It's not really an issue since I can just change it, but it threw me off at first and it might be helpful to somebody that only has OpenGL 4.3 (especially since chapters 1-8 all use OpenGL 4.3).

shader files can't be opened

When I saw that most examples can run MasOs from this github page I was so interested in trying that immediately on my MasOs Sierria with Xcode 9.2.

With the latest glfw snapshot I did build all the examples successfully. When I tried the chapter 6 point sprite example, I got the runtime error message saying that the pointsprite.vs can't be opened.

Here is the code line: prog.compileShader("shader/pointsprite.vs");

I found the root cause issue is in Xcode debug, the current working directory is <...>/chapter06/Debug. However, in fact "shader" directory is at the same level as "Debug" directory. Further, "media" directory is at the same level as "chapter06" directory.

So if we follow the instructions in the github only we are not able to run any examples.

Please suggest any solution on this. Is there any Xcode setting for changing the working directory?

failed to build on windows and on linux

On Windows in visual studio express 2012 i get the error message:

Error 1 error LNK1107: invalid or corrupt file: cannot read at 0x1C196

and on Linux:

[ 22%] Linking CXX executable chapter01
/usr/local/lib/libglfw3.a(x11_init.c.o): In function initExtensions': x11_init.c:(.text+0x1ac5): undefined reference toXineramaQueryExtension'
x11_init.c:(.text+0x1adf): undefined reference to XineramaIsActive' /usr/local/lib/libglfw3.a(x11_init.c.o): In function_glfwCreateCursor':
x11_init.c:(.text+0x218d): undefined reference to XcursorImageCreate' x11_init.c:(.text+0x2264): undefined reference toXcursorImageLoadCursor'
x11_init.c:(.text+0x2274): undefined reference to `XcursorImageDestroy'

I'm using the latest verisions of cmake and glfw.

Issue when using vc++

Hi David,

Nice book and nice recipes! Unfortunately I could not wait for the new edition.

I had some problems to compile the code in VS 2010 because of glDebugMessageCallback(GLUtils::debugCallback, NULL).

I had to change "void GLUtils::debugCallback" to void APIENTRY debugCallback.

Thanks,
Eduardo

libdl linker error on linux

I know I've gotten this to build on linux before (Ubuntu I think), but I'm currently on Manjaro w/kernel 4.9.142-1-MANJARO. I've tried both clang (v:7.0.0) and gcc (v:8.2.1)., and my build command is

cmake -DCMAKE_CXX_COMPILER=clang -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_CXX_STANDARD_LIBRARIES="-lm" ../

and I got these linker errors.

[ 13%] Built target ingredients
[ 16%] Linking CXX executable chapter03
[ 16%] Linking CXX executable chapter01
[ 16%] Linking CXX executable chapter02
[ 17%] Linking CXX executable chapter04
/usr/bin/ld: ../ingredients/libingredients.a(glad.c.o): undefined reference to symbol 'dlclose@@GLIBC_2.2.5'
/usr/bin/ld: /usr/lib/libdl.so.2: error adding symbols: DSO missing from command line
/usr/bin/ld: ../ingredients/libingredients.a(glad.c.o): undefined reference to symbol 'dlclose@@GLIBC_2.2.5'
/usr/bin/ld: /usr/lib/libdl.so.2: error adding symbols: DSO missing from command line
clang-7: error: linker command failed with exit code 1 (use -v to see invocation)
clang-7: error: linker command failed with exit code 1 (use -v to see invocation)
/usr/bin/ld: ../ingredients/libingredients.a(glad.c.o): undefined reference to symbol 'dlclose@@GLIBC_2.2.5'
/usr/bin/ld: /usr/lib/libdl.so.2: error adding symbols: DSO missing from command line
clang-7: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [chapter02/CMakeFiles/chapter02.dir/build.make:177: chapter02/chapter02] Error 1
make[1]: *** [CMakeFiles/Makefile2:201: chapter02/CMakeFiles/chapter02.dir/all] Error 2
make[2]: *** [chapter03/CMakeFiles/chapter03.dir/build.make:177: chapter03/chapter03] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/Makefile2:256: chapter03/CMakeFiles/chapter03.dir/all] Error 2
make[2]: *** [chapter01/CMakeFiles/chapter01.dir/build.make:162: chapter01/chapter01] Error 1
make[1]: *** [CMakeFiles/Makefile2:146: chapter01/CMakeFiles/chapter01.dir/all] Error 2
/usr/bin/ld: ../ingredients/libingredients.a(glad.c.o): undefined reference to symbol 'dlclose@@GLIBC_2.2.5'
/usr/bin/ld: /usr/lib/libdl.so.2: error adding symbols: DSO missing from command line
clang-7: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [chapter04/CMakeFiles/chapter04.dir/build.make:237: chapter04/chapter04] Error 1
make[1]: *** [CMakeFiles/Makefile2:311: chapter04/CMakeFiles/chapter04.dir/all] Error 2
make: *** [Makefile:84: all] Error 2

It appears the issue is with glad?

CMAKE not working right.

/usr/bin/ld: /lib/x86_64-linux-gnu/libdl.so.2: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status

did you even run the application after the changes you made ?

None of the application works properly, either getting a blank window, or the camera is inside the object. Even I had the issue with macros like #define uint unsigned int. It did not compile on my ubuntu system , had to get around with typedef unsigned int uint.

Please test the exaples if you really want to supprt the reader who spent resources on this.

The problem when you compile as correct ??!

The problem when you compile as correct ??!

make -f Makefile
[ 1%] Building CXX object ingredients/CMakeFiles/ingredients.dir/vbotorus.cpp.o
/home/hays/program/glslcookbook-master/ingredients/vbotorus.cpp: In member function ‘void VBOTorus::generateVerts(float_, float_, float_, unsigned int_, float, float)’:
/home/hays/program/glslcookbook-master/ingredients/vbotorus.cpp:80:21: error: ‘two_pi’ is not a member of ‘glm’
float ringFactor = glm::two_pi() / rings;
^
/home/hays/program/glslcookbook-master/ingredients/vbotorus.cpp:80:33: error: expected primary-expression before ‘float’
float ringFactor = glm::two_pi() / rings;
^
/home/hays/program/glslcookbook-master/ingredients/vbotorus.cpp:81:21: error: ‘two_pi’ is not a member of ‘glm’
float sideFactor = glm::two_pi() / sides;
^
/home/hays/program/glslcookbook-master/ingredients/vbotorus.cpp:81:33: error: expected primary-expression before ‘float’
float sideFactor = glm::two_pi() / sides;
^
/home/hays/program/glslcookbook-master/ingredients/vbotorus.cpp:98:20: error: ‘two_pi’ is not a member of ‘glm’
tex[tidx] = u / glm::two_pi();
^
/home/hays/program/glslcookbook-master/ingredients/vbotorus.cpp:98:32: error: expected primary-expression before ‘float’
tex[tidx] = u / glm::two_pi();
^
/home/hays/program/glslcookbook-master/ingredients/vbotorus.cpp:99:24: error: ‘two_pi’ is not a member of ‘glm’
tex[tidx + 1] = v / glm::two_pi();
^
/home/hays/program/glslcookbook-master/ingredients/vbotorus.cpp:99:36: error: expected primary-expression before ‘float’
tex[tidx + 1] = v / glm::two_pi();

Compile with what?

In your readme, what are you meaning when you say " run 'make' "? Google came back with CMake(didn't work) and gnu Make (which seemed to require 3 other programs to work).

Make issue

Hello does any one what this mean.

genType glm::inversesqrt(const genType&) [with genType = float]: Assertion `x > genType(0)' failed.
Aborted (core dumped)

fail to compile on osx 10.9.2

cmake CMakeLists.txt

-- GLM_INCLUDE_DIR = /usr/local/include/glm/
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
RT_LIB
    linked by target "chapter01" in directory /Users/ragnarok/Works/Resource/opengl/glslcookbook/chapter01
    linked by target "chapter02" in directory /Users/ragnarok/Works/Resource/opengl/glslcookbook/chapter02
    linked by target "chapter03" in directory /Users/ragnarok/Works/Resource/opengl/glslcookbook/chapter03
    linked by target "chapter04" in directory /Users/ragnarok/Works/Resource/opengl/glslcookbook/chapter04
    linked by target "chapter05" in directory /Users/ragnarok/Works/Resource/opengl/glslcookbook/chapter05
    linked by target "chapter06" in directory /Users/ragnarok/Works/Resource/opengl/glslcookbook/chapter06
    linked by target "chapter07" in directory /Users/ragnarok/Works/Resource/opengl/glslcookbook/chapter07
    linked by target "chapter08" in directory /Users/ragnarok/Works/Resource/opengl/glslcookbook/chapter08
    linked by target "chapter09" in directory /Users/ragnarok/Works/Resource/opengl/glslcookbook/chapter09
    linked by target "chapter10" in directory /Users/ragnarok/Works/Resource/opengl/glslcookbook/chapter10

-- Configuring incomplete, errors occurred!
See also "/Users/ragnarok/Works/Resource/opengl/glslcookbook/CMakeFiles/CMakeOutput.log".

Then I commented out

find_library( RT_LIB rt )
list( APPEND GLSLCOOKBOOK_LIBS ${RT_LIB} )

in CMakeLists.txt, and successfully generate Makefile, but when I tried to compile the source:

make
[  1%] Building CXX object ingredients/CMakeFiles/ingredients.dir/vbomeshadj.cpp.o
In file included from /Users/ragnarok/Works/Resource/opengl/glslcookbook/ingredients/vbomeshadj.cpp:6:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/iostream:40:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/istream:156:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/ostream:133:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/locale:197:
In file included from /usr/include/nl_types.h:45:
/usr/include/sys/types.h:92:23: error: cannot combine with previous 'int' declaration specifier
typedef unsigned int            uint;           /* Sys V compatibility */
                                ^
/Users/ragnarok/Works/Resource/opengl/glslcookbook/ingredients/vbomeshadj.cpp:4:23: note: expanded from macro 'uint'
#define uint unsigned int
                      ^
1 error generated.
make[2]: *** [ingredients/CMakeFiles/ingredients.dir/vbomeshadj.cpp.o] Error 1
make[1]: *** [ingredient

How to fix this?

compile error in Visual Studio

hi,

I got this error when compiling the teapot object:
error C2719: 'lidTransform': formal parameter with __declspec(align('16')) won't be aligned

I'm using Visual Studio 2013. It can be fixed by changing the type from 'mat4' to 'mat4&', but I'm not sure if it is the best way to do it.

No projected texture

Projected texture example doesnt show a working projected texture, just a teapot. It is loading the flower.png texture without errors... I'm not sure why I can't see it working.

Compiled in VS2015

i am having errors in the make phase something about libX11.so.6, i think i got the package on my system

Linking CXX executable chapter01
/usr/bin/ld: /usr/local/lib/libglfw3.a(x11_window.c.o): undefined reference to symbol 'XConvertSelection'
//usr/lib/x86_64-linux-gnu/libX11.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[2]: *** [chapter01/chapter01] Error 1
make[1]: *** [chapter01/CMakeFiles/chapter01.dir/all] Error 2
make: *** [all] Error 2

crash

$ ./chapter02 ads
-------------------------------------------------------------
GL Vendor    : Intel Open Source Technology Center
GL Renderer  : Mesa DRI Intel(R) UHD Graphics 630 (Coffeelake 3x8 GT2) 
GL Version   : 4.5 (Core Profile) Mesa 18.2.8
GL Version   : 4.5
GLSL Version : 4.50
-------------------------------------------------------------
App:Marker[NOTIFY](0): Start debugging
ShaderCompiler:Other[NOTIFY](5): FS SIMD8 shader: 5 inst, 0 loops, 24 cycles, 0:0 spills:fills, Promoted 0 constants, compacted 80 to 64 bytes.
ShaderCompiler:Other[NOTIFY](6): FS SIMD16 shader: 5 inst, 0 loops, 34 cycles, 0:0 spills:fills, Promoted 0 constants, compacted 80 to 64 bytes.
ShaderCompiler:Other[NOTIFY](7): VS SIMD8 shader: 102 inst, 0 loops, 505 cycles, 0:0 spills:fills, Promoted 0 constants, compacted 1632 to 1152 bytes.
Ошибка сегментирования (стек памяти сброшен на диск)

The last line tells that there was a segfault.

Build fails due to GLM/GLX experimental flags missing

Compilation failed due to using glm/gtx/transform without proper enabling of the glm experimental extensions.

[ 24%] Building CXX object chapter02/CMakeFiles/chapter02.dir/scenetwoside.cpp.o
In file included from /home/marius/Downloads/glslcookbook-master/chapter02/scenetwoside.cpp:14:0:
/usr/local/include/glm/gtx/transform.hpp:23:3: error: #error "GLM: GLM_GTX_transform is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." # error "GLM: GLM_GTX_transform is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it."

To fix this I added this macro to the cookbookgl.h file (which seems to be included by all other main files)

#define GLM_ENABLE_EXPERIMENTAL

My system configuration:
OS: Ubuntu 14.04 64 bit
GLM: v0.9.9.0
GLFW3: v3.2.1

chapter09 (smoke) uses point sprites, but most hardware has very low limits on point sizes

I know this basically says "redo all of chapter 9", but this is a pretty real issue actually.

Apparently this method uses point sprites.

There are two big issues with using point sprites, as I took a week of debugging to finally find out :(

Apparently, (a) a lot of hardware has a point size limit of 64.0. This tutorial goes up to 200, and setting it to 64 is just really small.

The other big issue is that when the center of a point sprite goes off-screen, the whole thing is clipped.

It'd be really cool if you could make another version of this same approach using something like geometry shaders or whatever. I really want to have a "particles like smoke, fully on the gpu"

Support MacOS X (4.1 core)?

It should be possible to support OpenGL 4.1 core for many of the examples (excluding Chapter 10). This would enable MacOS users to run the examples.

  • Chapter 1
  • Chapter 2
  • Chapter 3
  • Chapter 4
  • Chapter 5
  • Chapter 6
  • Chapter 7
  • Chapter 8
  • Chapter 9

Remove transform2 headers

The GLM transform2.hpp header is no longer appropriate for this code, we should be using transform.hpp.

fails to compile on linux - ubuntu 13.10

cmake is fine

~/other_src/glslcookbook/build $ cmake ..

-- GLM_INCLUDE_DIR = /usr/include
-- Found GLFW3: /usr/lib/libglfw.so
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so - found
-- Looking for gethostbyname
-- Looking for gethostbyname - found
-- Looking for connect
-- Looking for connect - found
-- Looking for remove
-- Looking for remove - found
-- Looking for shmat
-- Looking for shmat - found
-- Looking for IceConnectionNumber in ICE
-- Looking for IceConnectionNumber in ICE - found
-- Found X11: /usr/lib/x86_64-linux-gnu/libX11.so
-- Found OpenGL: /usr/lib/x86_64-linux-gnu/libGL.so
-- Looking for include file pthread.h
-- Looking for include file pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Configuring done
-- Generating done
-- Build files have been written to: /home/stens/other_src/glslcookbook/build

however compile fails

stens@middleburg ~/other_src/glslcookbook/build $ make -j8
Scanning dependencies of target ingredients
[ 1%] [ 2%] [ 4%] [ 4%] [ 5%] Building CXX object ingredients/CMakeFiles/ingredients.dir/vboteapot.cpp.o
Building CXX object ingredients/CMakeFiles/ingredients.dir/vboteapotpatch.cpp.o
Building CXX object ingredients/CMakeFiles/ingredients.dir/vbomeshadj.cpp.o
Building CXX object ingredients/CMakeFiles/ingredients.dir/drawable.cpp.o
[ 6%] Building CXX object ingredients/CMakeFiles/ingredients.dir/vbotorus.cpp.o
[ 7%] Building CXX object ingredients/CMakeFiles/ingredients.dir/glutils.cpp.o
[ 8%] Building CXX object ingredients/CMakeFiles/ingredients.dir/vbomesh.cpp.o
Building CXX object ingredients/CMakeFiles/ingredients.dir/glslprogram.cpp.o
[ 10%] Building CXX object ingredients/CMakeFiles/ingredients.dir/vbocube.cpp.o
[ 11%] Building CXX object ingredients/CMakeFiles/ingredients.dir/vboplane.cpp.o
[ 12%] Building CXX object ingredients/CMakeFiles/ingredients.dir/vbosphere.cpp.o
[ 13%] Building CXX object ingredients/CMakeFiles/ingredients.dir/bmpreader.cpp.o
[ 14%] [ 15%] Building CXX object ingredients/CMakeFiles/ingredients.dir/tgaio.cpp.o
Building C object ingredients/CMakeFiles/ingredients.dir/gl_core_4_4.c.o
Linking CXX static library libingredients.a
[ 15%] Built target ingredients
Scanning dependencies of target chapter03
Scanning dependencies of target chapter01
Scanning dependencies of target chapter04
Scanning dependencies of target chapter05
Scanning dependencies of target chapter02
Scanning dependencies of target chapter07
[ 16%] Scanning dependencies of target chapter06
Scanning dependencies of target chapter08
Building CXX object chapter03/CMakeFiles/chapter03.dir/scenemultilight.cpp.o
[ 17%] [ 19%] [ 20%] Building CXX object chapter04/CMakeFiles/chapter04.dir/scenetexture.cpp.o
Building CXX object chapter02/CMakeFiles/chapter02.dir/main.cpp.o
[ 21%] [ 22%] [ 23%] Building CXX object chapter01/CMakeFiles/chapter01.dir/scenebasic.cpp.o
[ 24%] Building CXX object chapter06/CMakeFiles/chapter06.dir/scenebezcurve.cpp.o
Building CXX object chapter05/CMakeFiles/chapter05.dir/main.cpp.o
Building CXX object chapter07/CMakeFiles/chapter07.dir/frustum.cpp.o
Building CXX object chapter08/CMakeFiles/chapter08.dir/noisetex.cpp.o
[ 25%] Building CXX object chapter02/CMakeFiles/chapter02.dir/scenesubroutine.cpp.o
[ 26%] Building CXX object chapter04/CMakeFiles/chapter04.dir/main.cpp.o
[ 28%] Building CXX object chapter01/CMakeFiles/chapter01.dir/main.cpp.o
[ 29%] Building CXX object chapter08/CMakeFiles/chapter08.dir/main.cpp.o
[ 30%] Building CXX object chapter07/CMakeFiles/chapter07.dir/main.cpp.o
[ 31%] [ 32%] [ 33%] Building CXX object chapter03/CMakeFiles/chapter03.dir/sceneperfragment.cpp.o
Building CXX object chapter06/CMakeFiles/chapter06.dir/main.cpp.o
Building CXX object chapter05/CMakeFiles/chapter05.dir/sceneblur.cpp.o
[ 34%] Building CXX object chapter08/CMakeFiles/chapter08.dir/scenesky.cpp.o
[ 35%] Building CXX object chapter07/CMakeFiles/chapter07.dir/sceneao.cpp.o
[ 37%] Building CXX object chapter04/CMakeFiles/chapter04.dir/scenerendertotex.cpp.o
[ 38%] Building CXX object chapter01/CMakeFiles/chapter01.dir/scenebasic_uniformblock.cpp.o
[ 39%] Building CXX object chapter06/CMakeFiles/chapter06.dir/scenepointsprite.cpp.o
[ 40%] Building CXX object chapter02/CMakeFiles/chapter02.dir/scenediffuse.cpp.o
[ 41%] Building CXX object chapter03/CMakeFiles/chapter03.dir/main.cpp.o
[ 42%] Building CXX object chapter08/CMakeFiles/chapter08.dir/scenedecay.cpp.o
[ 43%] Building CXX object chapter01/CMakeFiles/chapter01.dir/scenebasic_attrib.cpp.o
[ 44%] [ 46%] Building CXX object chapter07/CMakeFiles/chapter07.dir/scenejitter.cpp.o
Building CXX object chapter05/CMakeFiles/chapter05.dir/scenedeferred.cpp.o
[ 47%] Building CXX object chapter04/CMakeFiles/chapter04.dir/scenemultitex.cpp.o
[ 48%] Building CXX object chapter06/CMakeFiles/chapter06.dir/scenequadtess.cpp.o
[ 49%] Building CXX object chapter03/CMakeFiles/chapter03.dir/scenefog.cpp.o
[ 50%] Building CXX object chapter02/CMakeFiles/chapter02.dir/scenetwoside.cpp.o
[ 51%] Building CXX object chapter08/CMakeFiles/chapter08.dir/scenenightvision.cpp.o
[ 52%] Building CXX object chapter01/CMakeFiles/chapter01.dir/scenebasic_uniform.cpp.o
[ 53%] Building CXX object chapter04/CMakeFiles/chapter04.dir/scenealphatest.cpp.o
[ 55%] Building CXX object chapter06/CMakeFiles/chapter06.dir/sceneshadewire.cpp.o
[ 56%] Building CXX object chapter02/CMakeFiles/chapter02.dir/sceneflat.cpp.o
[ 57%] Building CXX object chapter01/CMakeFiles/chapter01.dir/scenebasic_debug.cpp.o
[ 58%] Building CXX object chapter03/CMakeFiles/chapter03.dir/scenedirectional.cpp.o
[ 59%] [ 60%] Building CXX object chapter08/CMakeFiles/chapter08.dir/scenepaint.cpp.o
Building CXX object chapter05/CMakeFiles/chapter05.dir/sceneedge.cpp.o
[ 61%] Building CXX object chapter06/CMakeFiles/chapter06.dir/scenesilhouette.cpp.o
[ 62%] Building CXX object chapter04/CMakeFiles/chapter04.dir/scenereflectcube.cpp.o
Linking CXX executable chapter01
[ 64%] Building CXX object chapter07/CMakeFiles/chapter07.dir/scenepcf.cpp.o
[ 65%] Building CXX object chapter08/CMakeFiles/chapter08.dir/scenewood.cpp.o
CMakeFiles/chapter01.dir/main.cpp.o: In function mainLoop()': /home/stens/other_src/glslcookbook/chapter01/main.cpp:35: undefined reference toglfwWindowShouldClose'
CMakeFiles/chapter01.dir/main.cpp.o: In function main': /home/stens/other_src/glslcookbook/chapter01/main.cpp:56: undefined reference toglfwWindowHint'
/home/stens/other_src/glslcookbook/chapter01/main.cpp:57: undefined reference to glfwWindowHint' /home/stens/other_src/glslcookbook/chapter01/main.cpp:58: undefined reference toglfwWindowHint'
/home/stens/other_src/glslcookbook/chapter01/main.cpp:59: undefined reference to glfwWindowHint' /home/stens/other_src/glslcookbook/chapter01/main.cpp:60: undefined reference toglfwWindowHint'
CMakeFiles/chapter01.dir/main.cpp.o:/home/stens/other_src/glslcookbook/chapter01/main.cpp:61: more undefined references to glfwWindowHint' follow CMakeFiles/chapter01.dir/main.cpp.o: In functionmain':
/home/stens/other_src/glslcookbook/chapter01/main.cpp:65: undefined reference to glfwCreateWindow' /home/stens/other_src/glslcookbook/chapter01/main.cpp:70: undefined reference toglfwMakeContextCurrent'
collect2: error: ld returned 1 exit status
make[2]: *** [chapter01/chapter01] Error 1
make[1]: *** [chapter01/CMakeFiles/chapter01.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 66%] Building CXX object chapter08/CMakeFiles/chapter08.dir/scenenoise.cpp.o
[ 67%] Building CXX object chapter02/CMakeFiles/chapter02.dir/scenediscard.cpp.o
[ 68%] Building CXX object chapter06/CMakeFiles/chapter06.dir/scenetessteapot.cpp.o
[ 69%] Building CXX object chapter03/CMakeFiles/chapter03.dir/scenetoon.cpp.o
[ 70%] [ 71%] Building CXX object chapter04/CMakeFiles/chapter04.dir/skybox.cpp.o
Building CXX object chapter05/CMakeFiles/chapter05.dir/scenegamma.cpp.o
[ 73%] Building CXX object chapter05/CMakeFiles/chapter05.dir/scenemsaa.cpp.o
[ 74%] Building CXX object chapter04/CMakeFiles/chapter04.dir/scenenormalmap.cpp.o
[ 75%] Building CXX object chapter02/CMakeFiles/chapter02.dir/sceneads.cpp.o
[ 76%] Building CXX object chapter06/CMakeFiles/chapter06.dir/scenetessteapotdepth.cpp.o
Linking CXX executable chapter08
[ 77%] Building CXX object chapter03/CMakeFiles/chapter03.dir/scenespot.cpp.o
CMakeFiles/chapter08.dir/main.cpp.o: In function mainLoop()': /home/stens/other_src/glslcookbook/chapter08/main.cpp:27: undefined reference toglfwWindowShouldClose'
CMakeFiles/chapter08.dir/main.cpp.o: In function main': /home/stens/other_src/glslcookbook/chapter08/main.cpp:48: undefined reference toglfwWindowHint'
/home/stens/other_src/glslcookbook/chapter08/main.cpp:49: undefined reference to glfwWindowHint' /home/stens/other_src/glslcookbook/chapter08/main.cpp:50: undefined reference toglfwWindowHint'
/home/stens/other_src/glslcookbook/chapter08/main.cpp:51: undefined reference to glfwWindowHint' /home/stens/other_src/glslcookbook/chapter08/main.cpp:52: undefined reference toglfwWindowHint'
/home/stens/other_src/glslcookbook/chapter08/main.cpp:56: undefined reference to glfwCreateWindow' /home/stens/other_src/glslcookbook/chapter08/main.cpp:61: undefined reference toglfwMakeContextCurrent'
collect2: error: ld returned 1 exit status
make[2]: *** [chapter08/chapter08] Error 1
make[1]: *** [chapter08/CMakeFiles/chapter08.dir/all] Error 2
[ 78%] Building CXX object chapter04/CMakeFiles/chapter04.dir/sceneprojtex.cpp.o
[ 79%] Building CXX object chapter04/CMakeFiles/chapter04.dir/scenerefractcube.cpp.o
[ 80%] Building CXX object chapter05/CMakeFiles/chapter05.dir/scenetonemap.cpp.o
[ 82%] Building CXX object chapter04/CMakeFiles/chapter04.dir/scenesamplerobj.cpp.o
[ 83%] Building CXX object chapter07/CMakeFiles/chapter07.dir/sceneshadowmap.cpp.o
Linking CXX executable chapter06
Linking CXX executable chapter02
CMakeFiles/chapter06.dir/main.cpp.o: In function mainLoop()': /home/stens/other_src/glslcookbook/chapter06/main.cpp:28: undefined reference toglfwWindowShouldClose'
CMakeFiles/chapter06.dir/main.cpp.o: In function main': /home/stens/other_src/glslcookbook/chapter06/main.cpp:49: undefined reference toglfwWindowHint'
/home/stens/other_src/glslcookbook/chapter06/main.cpp:50: undefined reference to glfwWindowHint' /home/stens/other_src/glslcookbook/chapter06/main.cpp:51: undefined reference toglfwWindowHint'
/home/stens/other_src/glslcookbook/chapter06/main.cpp:52: undefined reference to glfwWindowHint' /home/stens/other_src/glslcookbook/chapter06/main.cpp:53: undefined reference toglfwWindowHint'
/home/stens/other_src/glslcookbook/chapter06/main.cpp:57: undefined reference to glfwCreateWindow' /home/stens/other_src/glslcookbook/chapter06/main.cpp:62: undefined reference toglfwMakeContextCurrent'
collect2: error: ld returned 1 exit status
make[2]: *** [chapter06/chapter06] Error 1
make[1]: *** [chapter06/CMakeFiles/chapter06.dir/all] Error 2
[ 84%] Building CXX object chapter07/CMakeFiles/chapter07.dir/sceneshadowvolume.cpp.o
CMakeFiles/chapter02.dir/main.cpp.o: In function mainLoop()': /home/stens/other_src/glslcookbook/chapter02/main.cpp:34: undefined reference toglfwWindowShouldClose'
CMakeFiles/chapter02.dir/main.cpp.o: In function main': /home/stens/other_src/glslcookbook/chapter02/main.cpp:55: undefined reference toglfwWindowHint'
/home/stens/other_src/glslcookbook/chapter02/main.cpp:56: undefined reference to glfwWindowHint' /home/stens/other_src/glslcookbook/chapter02/main.cpp:57: undefined reference toglfwWindowHint'
/home/stens/other_src/glslcookbook/chapter02/main.cpp:58: undefined reference to glfwWindowHint' /home/stens/other_src/glslcookbook/chapter02/main.cpp:59: undefined reference toglfwWindowHint'
CMakeFiles/chapter02.dir/main.cpp.o:/home/stens/other_src/glslcookbook/chapter02/main.cpp:60: more undefined references to glfwWindowHint' follow CMakeFiles/chapter02.dir/main.cpp.o: In functionmain':
/home/stens/other_src/glslcookbook/chapter02/main.cpp:64: undefined reference to glfwCreateWindow' /home/stens/other_src/glslcookbook/chapter02/main.cpp:69: undefined reference toglfwMakeContextCurrent'
collect2: error: ld returned 1 exit status
make[2]: *** [chapter02/chapter02] Error 1
make[1]: *** [chapter02/CMakeFiles/chapter02.dir/all] Error 2
[ 85%] Building CXX object chapter05/CMakeFiles/chapter05.dir/scenehdrbloom.cpp.o
Linking CXX executable chapter03
[ 86%] Building CXX object chapter05/CMakeFiles/chapter05.dir/sceneoit.cpp.o
CMakeFiles/chapter03.dir/main.cpp.o: In function mainLoop()': /home/stens/other_src/glslcookbook/chapter03/main.cpp:34: undefined reference toglfwWindowShouldClose'
CMakeFiles/chapter03.dir/main.cpp.o: In function main': /home/stens/other_src/glslcookbook/chapter03/main.cpp:55: undefined reference toglfwWindowHint'
/home/stens/other_src/glslcookbook/chapter03/main.cpp:56: undefined reference to glfwWindowHint' /home/stens/other_src/glslcookbook/chapter03/main.cpp:57: undefined reference toglfwWindowHint'
/home/stens/other_src/glslcookbook/chapter03/main.cpp:58: undefined reference to glfwWindowHint' /home/stens/other_src/glslcookbook/chapter03/main.cpp:59: undefined reference toglfwWindowHint'
CMakeFiles/chapter03.dir/main.cpp.o:/home/stens/other_src/glslcookbook/chapter03/main.cpp:60: more undefined references to glfwWindowHint' follow CMakeFiles/chapter03.dir/main.cpp.o: In functionmain':
/home/stens/other_src/glslcookbook/chapter03/main.cpp:64: undefined reference to glfwCreateWindow' /home/stens/other_src/glslcookbook/chapter03/main.cpp:69: undefined reference toglfwMakeContextCurrent'
collect2: error: ld returned 1 exit status
make[2]: *** [chapter03/chapter03] Error 1
make[1]: *** [chapter03/CMakeFiles/chapter03.dir/all] Error 2
Linking CXX executable chapter04
CMakeFiles/chapter04.dir/main.cpp.o: In function mainLoop()': /home/stens/other_src/glslcookbook/chapter04/main.cpp:44: undefined reference toglfwWindowShouldClose'
CMakeFiles/chapter04.dir/main.cpp.o: In function main': /home/stens/other_src/glslcookbook/chapter04/main.cpp:65: undefined reference toglfwWindowHint'
/home/stens/other_src/glslcookbook/chapter04/main.cpp:66: undefined reference to glfwWindowHint' /home/stens/other_src/glslcookbook/chapter04/main.cpp:67: undefined reference toglfwWindowHint'
/home/stens/other_src/glslcookbook/chapter04/main.cpp:68: undefined reference to glfwWindowHint' /home/stens/other_src/glslcookbook/chapter04/main.cpp:69: undefined reference toglfwWindowHint'
CMakeFiles/chapter04.dir/main.cpp.o:/home/stens/other_src/glslcookbook/chapter04/main.cpp:70: more undefined references to glfwWindowHint' follow CMakeFiles/chapter04.dir/main.cpp.o: In functionmain':
/home/stens/other_src/glslcookbook/chapter04/main.cpp:74: undefined reference to glfwCreateWindow' /home/stens/other_src/glslcookbook/chapter04/main.cpp:79: undefined reference toglfwMakeContextCurrent'
collect2: error: ld returned 1 exit status
make[2]: *** [chapter04/chapter04] Error 1
make[1]: *** [chapter04/CMakeFiles/chapter04.dir/all] Error 2
Linking CXX executable chapter07
Linking CXX executable chapter05
CMakeFiles/chapter07.dir/main.cpp.o: In function mainLoop()': /home/stens/other_src/glslcookbook/chapter07/main.cpp:33: undefined reference toglfwWindowShouldClose'
CMakeFiles/chapter07.dir/main.cpp.o: In function main': /home/stens/other_src/glslcookbook/chapter07/main.cpp:54: undefined reference toglfwWindowHint'
/home/stens/other_src/glslcookbook/chapter07/main.cpp:55: undefined reference to glfwWindowHint' /home/stens/other_src/glslcookbook/chapter07/main.cpp:56: undefined reference toglfwWindowHint'
/home/stens/other_src/glslcookbook/chapter07/main.cpp:57: undefined reference to glfwWindowHint' /home/stens/other_src/glslcookbook/chapter07/main.cpp:58: undefined reference toglfwWindowHint'
/home/stens/other_src/glslcookbook/chapter07/main.cpp:62: undefined reference to glfwCreateWindow' /home/stens/other_src/glslcookbook/chapter07/main.cpp:67: undefined reference toglfwMakeContextCurrent'
collect2: error: ld returned 1 exit status
make[2]: *** [chapter07/chapter07] Error 1
make[1]: *** [chapter07/CMakeFiles/chapter07.dir/all] Error 2
CMakeFiles/chapter05.dir/main.cpp.o: In function mainLoop()': /home/stens/other_src/glslcookbook/chapter05/main.cpp:50: undefined reference toglfwWindowShouldClose'
CMakeFiles/chapter05.dir/main.cpp.o: In function main': /home/stens/other_src/glslcookbook/chapter05/main.cpp:88: undefined reference toglfwWindowHint'
/home/stens/other_src/glslcookbook/chapter05/main.cpp:89: undefined reference to glfwWindowHint' /home/stens/other_src/glslcookbook/chapter05/main.cpp:90: undefined reference toglfwWindowHint'
/home/stens/other_src/glslcookbook/chapter05/main.cpp:91: undefined reference to glfwWindowHint' /home/stens/other_src/glslcookbook/chapter05/main.cpp:92: undefined reference toglfwWindowHint'
CMakeFiles/chapter05.dir/main.cpp.o:/home/stens/other_src/glslcookbook/chapter05/main.cpp:94: more undefined references to glfwWindowHint' follow CMakeFiles/chapter05.dir/main.cpp.o: In functionmain':
/home/stens/other_src/glslcookbook/chapter05/main.cpp:98: undefined reference to glfwCreateWindow' /home/stens/other_src/glslcookbook/chapter05/main.cpp:103: undefined reference toglfwMakeContextCurrent'
collect2: error: ld returned 1 exit status
make[2]: *** [chapter05/chapter05] Error 1
make[1]: *** [chapter05/CMakeFiles/chapter05.dir/all] Error 2
make: *** [all] Error 2
stens@middleburg ~/other_src/glslcookbook/build $

uname -a
Linux 3.11.0-15-generic #25-Ubuntu SMP Thu Jan 30 17:22:01 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

g++ --version
g++ (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1

probably incorrect code

hi

wondering if the code in scenebasic.cpp at line 134 is correct?

// Create and populate the buffer objects
GLuint vboHandles[2];
glGenBuffers(2, vboHandles);

here vboHandles is a local variable, while the variable with same type and name is member of scenebasic in header:

class SceneBasic : public Scene
{
private:
int width, height;
GLuint vboHandles[2];
GLuint vaoHandle;

although these are never referred directly afterwards.

printf undefined.

For some reason, I need to #include <stdio.h> to all main.cpp files in every chapter.
Compiled under Ubuntu 12.04 LTS.

Issue with the path to the shader files

When executing ./chapter01 basic (on linux), I get the following error message:
Error opening file: shader/basic.vert

A solution is to copy the directory from source path to build path. I suppose there is a more elegant solution using cmake...

Error when compile chapter 2 or 3 in file aabb.h

Hi!
System

glfw3.lib - compile ok x64
glm0.9.9.0 - just include folder
ingredients.lib - compile ok x64
Visual Studio 15 2017 Win64 - cmake configure & generate --- no problem
chapter 1 - compile ok
chapter 2 - compile error in aabb.h 24 error just in line 43 42

Severity Code Description Project File Line Suppression State
Error (active) E0040 expected an identifier chapter03 C:\GLSL\glslcookbook-master\ingredients\aabb.h 42
Error (active) E0040 expected an identifier chapter03 C:\GLSL\glslcookbook-master\ingredients\aabb.h 43
Error C2589 '(': illegal token on right side of '::' chapter03 c:\glsl\glslcookbook-master\ingredients\aabb.h 42
Error C2144 syntax error: 'unknown-type' should be preceded by ')' chapter03 c:\glsl\glslcookbook-master\ingredients\aabb.h 42
Error C2144 syntax error: 'unknown-type' should be preceded by ';' chapter03 c:\glsl\glslcookbook-master\ingredients\aabb.h 42
Error C2143 syntax error: missing ')' before '>' chapter03 c:\glsl\glslcookbook-master\ingredients\aabb.h 42
Error C2530 'pt': references must be initialized chapter03 c:\glsl\glslcookbook-master\ingredients\aabb.h 42
Error C2143 syntax error: missing ';' before '>' chapter03 c:\glsl\glslcookbook-master\ingredients\aabb.h 42
Error C2059 syntax error: '>' chapter03 c:\glsl\glslcookbook-master\ingredients\aabb.h 42
Error C2059 syntax error: ')' chapter03 c:\glsl\glslcookbook-master\ingredients\aabb.h 42
Error C2589 '(': illegal token on right side of '::' chapter03 c:\glsl\glslcookbook-master\ingredients\aabb.h 43
Error C2062 type 'unknown-type' unexpected chapter03 c:\glsl\glslcookbook-master\ingredients\aabb.h 43
Error C2059 syntax error: ')' chapter03 c:\glsl\glslcookbook-master\ingredients\aabb.h 43
Error C2589 '(': illegal token on right side of '::' chapter03 c:\glsl\glslcookbook-master\ingredients\aabb.h 42
Error C2144 syntax error: 'unknown-type' should be preceded by ')' chapter03 c:\glsl\glslcookbook-master\ingredients\aabb.h 42
Error C2144 syntax error: 'unknown-type' should be preceded by ';' chapter03 c:\glsl\glslcookbook-master\ingredients\aabb.h 42
Error C2143 syntax error: missing ')' before '>' chapter03 c:\glsl\glslcookbook-master\ingredients\aabb.h 42
Error C2530 'pt': references must be initialized chapter03 c:\glsl\glslcookbook-master\ingredients\aabb.h 42
Error C2143 syntax error: missing ';' before '>' chapter03 c:\glsl\glslcookbook-master\ingredients\aabb.h 42
Error C2059 syntax error: '>' chapter03 c:\glsl\glslcookbook-master\ingredients\aabb.h 42
Error C2059 syntax error: ')' chapter03 c:\glsl\glslcookbook-master\ingredients\aabb.h 42
Error C2589 '(': illegal token on right side of '::' chapter03 c:\glsl\glslcookbook-master\ingredients\aabb.h 43
Error C2062 type 'unknown-type' unexpected chapter03 c:\glsl\glslcookbook-master\ingredients\aabb.h 43
Error C2059 syntax error: ')' chapter03 c:\glsl\glslcookbook-master\ingredients\aabb.h 43
Warning C4003 not enough arguments for function-like macro invocation 'max' chapter03 c:\glsl\glslcookbook-master\ingredients\aabb.h 42
Warning C4003 not enough arguments for function-like macro invocation 'max' chapter03 c:\glsl\glslcookbook-master\ingredients\aabb.h 43
Warning C4003 not enough arguments for function-like macro invocation 'max' chapter03 c:\glsl\glslcookbook-master\ingredients\aabb.h 42
Warning C4003 not enough arguments for function-like macro invocation 'max' chapter03 c:\glsl\glslcookbook-master\ingredients\aabb.h 43

definition in minwindef.h

#ifndef max
#define max(a,b) (((a) > (b)) ? (a) : (b))
#endif

#ifndef min
#define min(a,b) (((a) < (b)) ? (a) : (b))
#endif

How to solve this problem?

License

What license is this code available under? (I grepped the files here and the book itself but couldn't find any mention of a license.)

sceneoit not complete

I try to compile "sceneoit", but the compiler not found setupFBO function in cpp file.

Could not find a package configuration file provided by "glm" with any of glmConfig.cmake

CMake Error at CMakeLists.txt:6 (find_package):
Could not find a package configuration file provided by "glm" with any of
the following names:

glmConfig.cmake
glm-config.cmake

Add the installation prefix of "glm" to CMAKE_PREFIX_PATH or set "glm_DIR"
to a directory containing one of the above files. If "glm" provides a
separate development package or SDK, be sure it has been installed.
Configuring incomplete, errors occurred!
See also "D:/glslcookbook_bin/CMakeFiles/CMakeOutput.log".

error

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.