openglsuperbible / sb6code Goto Github PK
View Code? Open in Web Editor NEWSource code for OpenGL SupeBible 6th Edition examples
Source code for OpenGL SupeBible 6th Edition examples
Having the following error if i want to compile the "sb6mrender":
////////////////////////////////////////////////////////////////////////////
[ 71%] Building CXX object CMakeFiles/sb6mrender.dir/src/sb6mrender/sb6mrender.cpp.o
In file included from /home/sajjad/Downloads/OpenGL/SuperBible/code/sb6code/src/sb6mrender/sb6mrender.cpp:25:0:
/home/sajjad/Downloads/OpenGL/SuperBible/code/sb6code/include/vmath.h: In instantiation of ‘vmath::Tquaternion::’:
/home/sajjad/Downloads/OpenGL/SuperBible/code/sb6code/include/vmath.h:677:5: instantiated from ‘vmath::Tquaternion’
/home/sajjad/Downloads/OpenGL/SuperBible/code/sb6code/include/arcball.h:112:25: instantiated from here
/home/sajjad/Downloads/OpenGL/SuperBible/code/sb6code/include/vmath.h:682:25: error: member ‘vmath::Tvec3 vmath::Tquaternion::::::v’ with constructor not allowed in union
/home/sajjad/Downloads/OpenGL/SuperBible/code/sb6code/include/vmath.h:682:25: error: member ‘vmath::Tvec3 vmath::Tquaternion::::::v’ with copy assignment operator not allowed in union
/home/sajjad/Downloads/OpenGL/SuperBible/code/sb6code/include/vmath.h:682:25: note: unrestricted unions only available with -std=c++0x or -std=gnu++0x
make[2]: *** [CMakeFiles/sb6mrender.dir/src/sb6mrender/sb6mrender.cpp.o] Error 1
make[1]: *** [CMakeFiles/sb6mrender.dir/all] Error 2
make: *** [all] Error 2
///////////////////////////////////////////////////////////////////////////
Any way to get rid of it ? Do i have to edit the Makefile ?
Thanks
Hi ,
Under ubuntu 13.04 with nvidia 331.xx i get this compilation error.
/usr/bin/ld: /usr/local/lib/libglfw.so: undefined reference to symbol 'glXGetProcAddress'
/usr/bin/ld: note: 'glXGetProcAddress' is defined in DSO /usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/libGL.so so try adding it to the linker command line.
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/libGL.so: could not read symbols: Invalid operation
Which i guess isn't supported in the nvidia stuff?
what workaround i could have?
Similar to #15
hdrexposure.cpp assume's the exposure uniform location is 0 instead of getting it on load and storing it as a member variable.
https://github.com/openglsuperbible/sb6code/blob/master/src/hdrexposure/hdrexposure.cpp#L144
and
Both have #version 410 core at the top but use binding syntax that according to https://www.opengl.org/wiki/Sampler_(GLSL)#Version_4.20_binding is only for OpenGL 4.2 or later causing it to fail to compile on nvidia and not render.
Simple fix, bump the version to 420 core.
Does anyone know where a list of corrections is for this book?
I'm trying to build this with VS2015 but I got two Link error when I try to build up solution with 'SimpleClear project' as a start proejct.
Is there any instruction for build settings of VS2015 or VS Code?
I'm very new to OpenGL. I want to learn it from the Blue Book (OpenGL superbible 6th edition).
When I compile the first program with Visual Studio 2013, everything goe well, except that a white window appears and then the program quit with code 0.
The program is:
// Include the "sb6.h" header file
#include "sb6.h"
// Derive my_application from sb6::application
class my_application : public sb6::application
{
public:
// Our rendering function
void render(double currentTime)
{
// Simply clear the window with red
static const GLfloat red[] = { 1.0f, 0.0f, 0.0f, 1.0f };
glClearBufferfv(GL_COLOR, 0, red);
}
};
// Our one and only instance of DECLARE_MAIN
DECLARE_MAIN(my_application);
I think both the compiling and building process are working fine because the result code 0. But I cannot figure out why I don't see a red output window. Please help me.
Even though it says 10.9 is supported, after installing CMake and generating the Makefiles, I get:
[ 6%] Built target sb6 make[2]: *** No rule to make target
/usr/local/lib/libglfw.a', needed by bin/alienrain'. Stop. make[1]: *** [CMakeFiles/alienrain.dir/all] Error 2 make: *** [all] Error 2
line: https://github.com/openglsuperbible/sb6code/blob/master/src/tunnel/tunnel.cpp#L97
When getting shader info, I believe that fs
should be passed in instead of vs
, since we get vs
directly above.
I cannot find media/objects/~.sbm files..
I want to work the first example in the book .
I have the folowing code
class my_app:public sb6::application
{
public:
my_app(){}
void render(double currTime)
{
static const GLfloat red[] = { 1.0, 0.0f, 0.0f, 1.0f };
glClear(GL_CLEAR_BUFFER);
}
};
DECLARE_MAIN(my_app);
It give me error
c:\program files (x86)\microsoft visual studio 12.0\vc\include\string.h(112) : see declaration of 'strcpy'
1>MSVCRTD.lib(crtexe.obj) : error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup
I know its looking for main file so when I add the void main(){}
it builds but it flashes a console screen fast and that is it. I tried with different versions of vs and I get the same thing. I did attach include files sb6.h, and glfw.h and all the lib files. I also noticed the framework doesn't include 64 bit libraries . I am running windows 8 64 bit. Maybe that may be the issue. Please help thank you
Compile error on Ubuntu 13.10 Linux amd64:
rick@rick-W650SR:~/Documenten/sb6code$ make
[ 1%] Building C object CMakeFiles/sb6.dir/src/sb6/gl3w.c.o
In file included from /usr/include/GL/glx.h:332:0,
from /home/rick/Documenten/sb6code/src/sb6/gl3w.c:62:
/home/rick/Documenten/sb6code/include/GL/glxext.h:682:24: error: expected declaration specifiers or ‘...’ before ‘’ token
typedef GLXContextID ( * PFNGLXGETCONTEXTIDEXTPROC) (const GLXContext context);
^
/home/rick/Documenten/sb6code/include/GL/glxext.h:683:67: error: unknown type name ‘GLXContextID’
typedef GLXContext ( * PFNGLXIMPORTCONTEXTEXTPROC) (Display *dpy, GLXContextID contextID);
^
make[2]: ** [CMakeFiles/sb6.dir/src/sb6/gl3w.c.o] Fout 1
make[1]: *** [CMakeFiles/sb6.dir/all] Fout 2
make: *** [all] Fout 2
I searched on the internet for this and i found out that i needed to add this line before line 683 in file sb6code/include/GL/glxext.h:
typedef XID GLXContextID;
After that it compiles fine.
This error happened after some update on Ubuntu. It compiled fine last week. I just wanted to notify you on this.
The book says that there is a ktx file in the path "media/textures/.ktx" where is it?
In sb6code / src / spinnycube / spinnycube.cpp, around line #98:
glGenVertexArrays(1, &vao);
glBindVertexArray(vao);
then the code fills vertex_positions -> unrelated
glGenBuffers(1, &buffer);
glBindBuffer(GL_ARRAY_BUFFER, buffer);
It seems to me that the VA generated for vao is never used. (Or did i miss anything? - if i comment it out, the code works fine)
Second issue: (at around line #186)
vmath::mat4 mv_matrix = vmath::translate(0.0f, 0.0f, -6.0f) *
vmath::rotate((float)currentTime * 45.0f, 0.0f, 1.0f, 0.0f) *
vmath::rotate((float)currentTime * 21.0f, 1.0f, 0.0f, 0.0f) *
vmath::translate(sinf(2.1f * f) * 2.0f,
cosf(1.7f * f) * 2.0f,
sinf(1.3f * f) * cosf(1.5f * f) * 2.0f);
If i use the transformations in this order, the cube leaves the screen. If i flip the translations with rotations, the cube starts rotating around its local axes -> looks better
Many of the example look in media/objects for models. That folder does not exist though.
Can you add/upload it?
Hi, I recently re-discovered this article of yours: http://www.openglsuperbible.com/2013/12/09/vertex-array-performance/
In the Sodium renderer mod for Minecraft there are multiple reports of VAOs being slower than just dumb binding all attributes, so I was interested in rerunning the benchmark mentioned in your article again. I can't seem to find the source code for it here..
Thanks in advance
glfw3 changes quite a few of the api calls, but seems like they are moving away from the 2.x versions. Is there any development towards this? I don't mind forking and starting it, but just didn't want to overlap any current development.
Thanks!
Danny G
The code for the per pixel gloss sample requires a 3D texture called "mountains3d.ktx" which doesn't exist in the media folder. I have downloaded the separate media contents from http://openglsuperbible.com/files/sb6media_2013_11_10.zip but it does not come with it.
where is the definition of the function in shader.h?
GL_MAP_PERSISTENT_BIT
is not used in any of the examples and hence AZDO is never demonstrated in its entirety. I am very surprised the 6th edition does not include an example of this.
Unless I am missing something?
I simply double-clicked sb6.sln file and tried to build it.
It keeps failing when building in visual studio 2019
Several of the examples, such as alienrain and tunnel, try to load texture files from the bin/media/textures directory. For example, alienrain line number 151
tex_alien_array = sb6::ktx::file::load("media/textures/aliens.ktx");
The textures directory and the files in it are missing in github and also missing from the zip file on the superbible website. Without the texture files these examples just display a black screen. Does anybody have access to these texture files?
I am unable to get even the basics running in Ubuntu 16.04. I've also tried to edited the CMakeLists.txt according to #24 but the linker still complains
[ 4%] Built target sb6
[ 5%] Linking CXX executable bin/wrapmodes
CMakeFiles/wrapmodes.dir/src/wrapmodes/wrapmodes.cpp.o: In function `sb6::application::run(sb6::application*)':
wrapmodes.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x30): undefined reference to `glfwInit'
wrapmodes.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x89): undefined reference to `glfwOpenWindowHint'
wrapmodes.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x9f): undefined reference to `glfwOpenWindowHint'
wrapmodes.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0xae): undefined reference to `glfwOpenWindowHint'
wrapmodes.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0xbd): undefined reference to `glfwOpenWindowHint'
wrapmodes.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0xd3): undefined reference to `glfwOpenWindowHint'
CMakeFiles/wrapmodes.dir/src/wrapmodes/wrapmodes.cpp.o:wrapmodes.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0xfd): more undefined references to `glfwOpenWindowHint' follow
CMakeFiles/wrapmodes.dir/src/wrapmodes/wrapmodes.cpp.o: In function `sb6::application::run(sb6::application*)':
wrapmodes.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x13b): undefined reference to `glfwGetDesktopMode'
wrapmodes.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x193): undefined reference to `glfwOpenWindow'
wrapmodes.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x1b1): undefined reference to `glfwSwapInterval'
wrapmodes.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x1f1): undefined reference to `glfwOpenWindow'
wrapmodes.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x231): undefined reference to `glfwSetWindowTitle'
wrapmodes.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x23b): undefined reference to `glfwSetWindowSizeCallback'
wrapmodes.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x245): undefined reference to `glfwSetKeyCallback'
wrapmodes.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x24f): undefined reference to `glfwSetMouseButtonCallback'
wrapmodes.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x259): undefined reference to `glfwSetMousePosCallback'
wrapmodes.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x263): undefined reference to `glfwSetMouseWheelCallback'
wrapmodes.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x27a): undefined reference to `glfwEnable'
wrapmodes.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x281): undefined reference to `glfwDisable'
wrapmodes.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x292): undefined reference to `glfwGetWindowParam'
wrapmodes.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x376): undefined reference to `glfwGetTime'
wrapmodes.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x384): undefined reference to `glfwSwapBuffers'
wrapmodes.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x38e): undefined reference to `glfwGetKey'
wrapmodes.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x3ae): undefined reference to `glfwGetWindowParam'
wrapmodes.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x3e8): undefined reference to `glfwTerminate'
lib/libsb6.a(gl3w.c.o): In function `open_libgl':
gl3w.c:(.text+0xf): undefined reference to `dlopen'
lib/libsb6.a(gl3w.c.o): In function `close_libgl':
gl3w.c:(.text+0x2c): undefined reference to `dlclose'
lib/libsb6.a(gl3w.c.o): In function `get_proc':
gl3w.c:(.text+0x47): undefined reference to `glXGetProcAddress'
gl3w.c:(.text+0x68): undefined reference to `dlsym'
collect2: error: ld returned 1 exit status
CMakeFiles/wrapmodes.dir/build.make:95: recipe for target 'bin/wrapmodes' failed
make[2]: *** [bin/wrapmodes] Error 1
CMakeFiles/Makefile2:131: recipe for target 'CMakeFiles/wrapmodes.dir/all' failed
make[1]: *** [CMakeFiles/wrapmodes.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
Anyone any ideas how to fix this? Thanks!
I have issues getting the code to compile and need some help. Nothing I've tried has worked so far. I am using linux mint 16 and have been programming for a while with opengl and have not ran into any problems, yet can not get these examples to compile. I have install glfw via 'apt-get libgflw-dev' and it has worked fine for me when running other code. My error looks like the program is not linking glfw properly, does anyone have suggestions to help me compile these examples on linux? When I compile with make I get the following error:
[ 6%] Built target sb6 Linking CXX executable bin/alienrain CMakeFiles/alienrain.dir/src/alienrain/alienrain.cpp.o: In function sb6::application::run(sb6::application*)': alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x21): undefined reference to 'glfwInit'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.