openglredbook / examples Goto Github PK
View Code? Open in Web Editor NEWExamples for the OpenGL Red Book
Examples for the OpenGL Red Book
Hello.
I'm using ubuntu 14.04.5 and the code cannot be compiled.
First i did cmake on build/ folder.
$ cmake ..
Then make fails:
$ make
[ 14%] Built target glfw
[ 15%] Building CXX object CMakeFiles/vermilion.dir/lib/LoadShaders.cpp.o
/home/usuario/workspace/src/opengl/opg_pdf/OGLPG-9th-Edition/OGLPG-9th-Edition/lib/LoadShaders.cpp: In function ‘const GLchar* ReadShader(const char*)’:
/home/usuario/workspace/src/opengl/opg_pdf/OGLPG-9th-Edition/OGLPG-9th-Edition/lib/LoadShaders.cpp:26:42: error: ‘fopen’ was not declared in this scope
FILE* infile = fopen( filename, "rb" );
^
/home/usuario/workspace/src/opengl/opg_pdf/OGLPG-9th-Edition/OGLPG-9th-Edition/lib/LoadShaders.cpp:36:23: error: ‘SEEK_END’ was not declared in this scope
fseek( infile, 0, SEEK_END );
^
/home/usuario/workspace/src/opengl/opg_pdf/OGLPG-9th-Edition/OGLPG-9th-Edition/lib/LoadShaders.cpp:36:32: error: ‘fseek’ was not declared in this scope
fseek( infile, 0, SEEK_END );
^
/home/usuario/workspace/src/opengl/opg_pdf/OGLPG-9th-Edition/OGLPG-9th-Edition/lib/LoadShaders.cpp:37:29: error: ‘ftell’ was not declared in this scope
int len = ftell( infile );
^
/home/usuario/workspace/src/opengl/opg_pdf/OGLPG-9th-Edition/OGLPG-9th-Edition/lib/LoadShaders.cpp:38:23: error: ‘SEEK_SET’ was not declared in this scope
fseek( infile, 0, SEEK_SET );
^
/home/usuario/workspace/src/opengl/opg_pdf/OGLPG-9th-Edition/OGLPG-9th-Edition/lib/LoadShaders.cpp:42:35: error: ‘fread’ was not declared in this scope
fread( source, 1, len, infile );
^
/home/usuario/workspace/src/opengl/opg_pdf/OGLPG-9th-Edition/OGLPG-9th-Edition/lib/LoadShaders.cpp:43:20: error: ‘fclose’ was not declared in this scope
fclose( infile );
^
make[2]: *** [CMakeFiles/vermilion.dir/lib/LoadShaders.cpp.o] Error 1
make[1]: *** [CMakeFiles/vermilion.dir/all] Error 2
There is no license information given for the source code in this repository which means that it is fully copyrighted and you must not even execute it. Does anyone know anything about the license status?
The code can be compiled by vs 2015, but many project was crash when the start running those exe. Any suggest for this?
Book users from China, Perry, 2016/10/09
Hi,
Figure 9.1 show a Tessellation Quad based on the example given in Example 9.3.
The Example states
gl_TessLevelOuter[0] = 2.0;
gl_TessLevelOuter[1] = 3.0;
gl_TessLevelOuter[2] = 2.0;
gl_TessLevelOuter[3] = 5.0;
While the example states that gl_TessLevelOuter[3] is 5, based on the image it should be equal to 4.0.
I noticed that many of your examples go back and forth between setting up using glGen and glCreate is there a preferred method?
(VM/WSL2 both happen) glfwWindowShouldClose: Assertion `window != NULL' failed.
In most case, the code is following the order "glVertexAttribPointer" first and then "glEnableVertexAttribArray". I think the interface "glVertexAttribPointer" is used to connect the buffer (managed by OpenGL) and the attrib (shader mananged by the pipeline), while the "glEnableVertexAttribArray" is used to submit the attachment to VAO then VAO can dispatch the buffer to related attribute, or vise vista.
But in Line 94 of "09-teapot.cpp"(and also the code for chapter 12 has the inverse order), the program is arranged in the inverse order
"void TeapotExample::Initialize(const char * title)
{
....
Line 94:
glEnableVertexAttribArray( vPosition );
glVertexAttribPointer( vPosition, 3, GL_FLOAT, GL_FALSE, 0,
BUFFER_OFFSET(0) );
"
well, is the latter usage correct, or what happen when glEnableVertexAttribArray is called?
Look uncomfortable, not all examples look uncomfortable.Vbm file where I can't find
I just tried to clone the repository and the build/media folder doesn't get downloaded. I also tried the zip file and the same result.
The 9th edition introduces the opengl 4.5 and prefers to use DSA methods (such as glCreate*).
But these demo codes are still not updated and do not match source codes on the 9th edtion redbook.
can anyone make this repo can build under osx
"layout (triangle_strip, max_vertices = 240) out;\n"
240 exceeds my gpu limit
it's only 120 in the book, 120 works
I run make, on Unix Makefile on Ubuntu,
I got this error:
lib/vdds.cpp:645:1: error: jump to label ‘done_close_file’ [-fpermissive]
How can I avoid it?, please help
void DoubleWriteExample::Initialize(const char * title) ... glBindImageTexture(0, output_texture, 0, GL_TRUE, 0, GL_READ_WRITE, GL_RGBA32F); ...
while 0 refers to the image unit (in fragment shader) which used as input and should be initialized by the render pipeline. what does this statement mean?
Excited to receive the book. Disappointed to clone the examples and find that they simply did not build at all.
There are several errors in which memset or memcpy is not declared in scope. Can be fixed by including . I was also required to include <time.h> or <sys/time.h> here and there because some struct was declared but not defined.
There are several errors in which goto by passes the initialisation of local variables in a vglLoadDDS(). This might be legal C but is not C++, and the file is called vdds.cpp. I moved the declarations. But seriously? I haven't used goto in thirty years, if ever.
The particle simulator shader program made use of a STRINGIZE macro, which totally failed on the #version directive. All other examples appear to simply concatenate quoted strings.
My changes were just hacked in, so I won't submit a pull request.
-(n + f) / (f - n)
1>gl3w.obj : error LNK2019: 无法解析的外部符号 __imp__wglGetProcAddress@4,该符号在函数 _get_proc 中被引用
1>C:\Users\zhongUUA\Documents\Visual Studio 2015\project\Red book TH9\第一章 OpenGL 概述\1 - 1 初识OpenGL程序\Debug\1 - 1 初识OpenGL程序.exe : fatal error LNK1120: 1 个无法解析的外部命令!
lib and include are configured,
gl3w and glfw are configured,
how to solve this problem?
WTF
03-drawingcommands shows two triangles, one is black and other is white.
There is not a file named gl.h in include/GL/, how to fix it?
To the best of my knowledge, there is no such correspondence description in the text/RedBook except the first program. The only hint is the two digits prefixing the directory and file names in the src
folder. The remaining is guesswork. Although all my guess are correct so far, I still hope there is an official document that gives me such a correspondence between the source and textbook. For example, 01-keypress.cpp corresponds to what section(s) of the RedBook. Or, if such a doc exists but I missed it, please kindly let me know. I would appreciate this doc.
I'd appreciate it if you can provide the source code for the 8e, GLFW is good but I'm using freeGlut and don't want to change each source file manually...
03-pointsprites
displays white squares instead of texture data of sprite2.tga
.
I found that adding the following lines to the vermilion.cpp
fixes the problem.
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
Can someone look into this please?
Thank you.
There is a problem in vmath.h:1060.
template
static inline Tmat4 lookat(const vecN<T,3>& eye, const vecN<T,3>& center, const vecN<T,3>& up)
{
const Tvec3 f = normalize(center - eye);
const Tvec3 upN = normalize(up);
const Tvec3 s = cross(f, upN);
const Tvec3 u = cross(s, f);
const Tmat4 M = Tmat4(Tvec4(s[0], u[0], -f[0], T(0)),
Tvec4(s[1], u[1], -f[1], T(0)),
Tvec4(s[2], u[2], -f[2], T(0)),
Tvec4(T(0), T(0), T(0), T(1)));
return M * translate<T>(-eye);
}
I think we must guarantee that vector s and vector u are normalized, otherwise we cannot ensure matrix M is correct.(And in fact in some cases, M is incorrect).
So I changed them into:
const Tvec3 s = normalize(cross(f, upN));
const Tvec3 u = normalize(cross(s, f));
I want to know what is the vbm file (the suffix is vbm) and how to open it?
Could anyone tell me how to build this project in ubuntu? Can I build in the traditional way as "mkdir build cd build cmake .. make"? I did this .But a lot of errors happen.I don"t know why.
when I compile this code in linux CENTOS7
/home/wangwei/1编程指南-master/lib/LoadShaders.cpp:26:42: 错误:‘fopen’在此作用域中尚未声明
FILE* infile = fopen( filename, "rb" );
^
/home/wangwei/1编程指南-master/lib/LoadShaders.cpp:36:23: 错误:‘SEEK_END’在此作用域中尚未声明
fseek( infile, 0, SEEK_END );
^
/home/wangwei/1编程指南-master/lib/LoadShaders.cpp:36:32: 错误:‘fseek’在此作用域中尚未声明
fseek( infile, 0, SEEK_END );
The title of error
How come the code is different from the book than it is here? It makes it very difficult to follow. Was there a reason for this?
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.