![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
OpenGL
aa20274270
这个作者很懒,什么都没留下…
展开
-
OpenGL 注意事项
1.GL_ASSERT( glGenTextures(1, &textureId) ); 之后,最好设置Texture的属性,例如设置UV的平铺方式:GL_ASSERT(glTexParameteri(type, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE));GL_ASSERT(glTexParameteri(type, GL_TEXTUR原创 2016-09-13 20:00:22 · 362 阅读 · 0 评论 -
LearnOpenGL 总结记录<8> Stencil Testing And Object Outlining
The routine for outlining your objects is as follows:1. Set the stencil func to GL_ALWAYS before drawing the (to be outlined) objects, updating the stencil buffer with 1s wherever the objects’ fragm...原创 2019-01-28 17:31:11 · 172 阅读 · 0 评论 -
LearnOpenGL 总结记录<9> Framebuffers And Post-processing
we can’t use our framebuffer yet because it is not complete. For a framebuffer to be complete the following requirements have to be satisfied:• We have to attach at least one buffer (color, depth or...原创 2019-01-29 10:31:37 · 214 阅读 · 0 评论 -
LearnOpenGL 总结记录<15> Parallax Mapping
思路:(视觉看平面上的A点,其实我们想要得到的是 B点 在heightmap的值是多少,那么一个方法就是,先把cameraPos,和A点变换到切线空间中,求出A点的在heightmap的值H(A)(A点有自己的纹理坐标),然后利用H(A)来缩放V̄,得到P̄,通过A点纹理坐标偏移 P̄.x, P̄.y ,得到近似B点的在heightmap的纹理坐标 )The idea behind par...原创 2019-02-03 23:32:08 · 210 阅读 · 0 评论 -
LearnOpenGL 总结记录<16> HDR
1. To implement high dynamic range rendering we need some way to prevent color values getting clamped after each fragment shader run. When framebuffers use a normalized fixed-point color format (li...原创 2019-02-04 23:07:31 · 262 阅读 · 0 评论 -
LearnOpenGL 总结记录<17> Bloom
Let’s illustrate this process in a step by step fashion.1.(先正常渲染场景)We render a scene filled with 4 bright light sources visualized as colored cubes. The colored light cubes have a brightness val...原创 2019-02-05 13:12:01 · 244 阅读 · 0 评论 -
LearnOpenGL 总结记录<18> Deferred Shading
理论:(延迟渲染分为两个阶段,1 : geometry pass,生成所谓的G-buffer,其实就是一系列的texture,每一张texture保存了各种的信息,texture是基于屏幕空间的。2 : lighting pass, 利用G-buffer,也就是一系列texture,进行计算光照效果)Deferred shading consists of two passes...原创 2019-02-05 19:20:51 · 254 阅读 · 0 评论 -
LearnOpenGL 总结记录<19> SSAO
思路:(主要的目的就是计算 一张保存 每一个像素的 occlusion factor 的texture,occlusion factor的计算就是采样当前pixel 附近的 多个pixel对应的depth,对比深度值,统计有多少个sample pixel的深度值是比当前的深度值要大,直接返回 (统计个数 / 总采样数),[0,1] ,之后就利用这张texture,进行模拟ao效果)The ...原创 2019-02-05 23:42:11 · 323 阅读 · 0 评论 -
LearnOpenGL 总结记录<20> PBR
Shader Codevs:#version 330 corelayout (location = 0) in vec3 aPos;layout (location = 1) in vec2 aTexCoords;layout (location = 2) in vec3 aNormal;out vec2 TexCoords;out vec3 WorldPos;out ve...原创 2019-02-08 19:58:43 · 631 阅读 · 0 评论 -
LearnOpenGL 总结记录<10> MSAA
思路:(一个像素 有多个subsample,在光栅化的时候,看看三角形覆盖了一个pixel的多少个subsample,假设一共4个subsample,如果覆盖了2个,那么这2个subsample 都保存了这个三角形PS 返回的颜色,其余的2个没有被覆盖的subsample的颜色为黑色,但是最终 这个Pixel 的颜色由 4个subsample的平均值求出)What multisamplin...原创 2019-01-30 10:32:37 · 666 阅读 · 0 评论 -
LearnOpenGL 总结记录<21> IBL
Shader Codevs:#version 330 corelayout (location = 0) in vec3 aPos;layout (location = 1) in vec2 aTexCoords;layout (location = 2) in vec3 aNormal;out vec2 TexCoords;out vec3 WorldPos;out ve...原创 2019-02-09 17:08:20 · 785 阅读 · 0 评论 -
LearnOpenGL 总结记录<11> Gamma correction
Example:// render // ------ glClearColor(0.1f, 0.1f, 0.1f, 1.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // draw objects shader.use(); ...原创 2019-01-30 18:45:06 · 231 阅读 · 0 评论 -
LearnOpenGL 总结记录<7> Depth Value Precision
1. In practice however, a linear depth buffer like this is almost never used. For correct projection properties a non-linear depth equation is used that is proportional to 1/z. What this basically d...原创 2019-01-28 16:26:57 · 240 阅读 · 0 评论 -
LearnOpenGL 总结记录<6> Phong Lighting Model
Lighting in the real world is extremely complicated and depends on way too many factors, something we can’t afford to calculate on the limited processing power we have. Lighting in OpenGL is therefore...原创 2019-01-28 10:47:53 · 256 阅读 · 0 评论 -
OpenGL Blend 的一些坑
1. 如果发现 blendSrc = DST_ALPHA 的时候,发现获取的都是1,这个时候需要检查下GL_ALPHA_BITS的位数,判断输出到屏幕的像素是不是带有Alpha通道。(int alphaBit = 1;glGetIntegerv(GL_ALPHA_BITS, &alphaBit);)2. 如果发现alphaBit是0的话,那么就表示,输出原创 2016-11-26 18:52:09 · 1340 阅读 · 0 评论 -
opengl常见问题
1.没有glDisable(GL_TEXTURE_2D),导致基本几何作图全部失败。 2.镜头位置没调好,导致所有物体不可见. 3.物体位置数据错误,导致物体大大超出镜头显示范围. 4.纹理没有GL_CLAMP导致边界拼接出现缝线. 5.纹理没有GL_REPEAT导致使用超出1.0纹理坐标技巧失败,显示单色插值. 6.没有glEnable(GL_TEXTURE_2D)导致全白纹转载 2017-02-21 21:40:29 · 976 阅读 · 0 评论 -
OpenGL Rendering Pipeline
OpenGL Rendering PipelineOpenGL Pipeline has a series of processing stages in order. Two graphical information, vertex-based data and pixel-based data, are processed through the pipeline, combined转载 2017-03-26 00:44:16 · 421 阅读 · 0 评论 -
LearnOpenGL 总结记录<1> Graphics Pipeline, NDC, VAO
Graphics PipelineThe first part of the pipeline is the vertex shader that takes as input a single vertex. The main purpose of the vertex shader is to transform 3D coordinates into different 3D coo...原创 2019-01-26 10:40:51 · 417 阅读 · 0 评论 -
LearnOpenGL 总结记录<2> Texture
// load and create a texture // ------------------------- unsigned int texture1, texture2; // texture 1 // --------- glGenTextures(1, &texture1); glBindTexture(GL_TEXT...原创 2019-01-26 14:22:54 · 591 阅读 · 0 评论 -
LearnOpenGL 总结记录<3> Matrices, Coordinate Systems
OpenGL 的 矩阵乘法矩阵在左边。 坐标系To transform the coordinates in one space to the next coordinate space we’ll use several transformation matrices of which the most important are the model, view and pr...原创 2019-01-26 15:52:59 · 278 阅读 · 0 评论 -
LearnOpenGL 总结记录<4> Camera , View Matrix
// camera/view transformation glm::mat4 view = glm::mat4(1.0f); // make sure to initialize matrix to identity matrix first float radius = 10.0f; float camX = sin(glfwGetTime...原创 2019-01-26 17:20:02 · 394 阅读 · 0 评论 -
LearnOpenGL 总结记录<13> Point Shadows
生成depth cubemap1. 绑定cubemap 到 framebuffer 上。Again, note the call to glDrawBuffer and glReadBuffer: we only care about depth values when generating a depth cubemap so we have to explicitly tell Ope...原创 2019-01-31 15:51:01 · 255 阅读 · 0 评论 -
LearnOpenGL 总结记录<14> Normal Mapping
Tangent space(切线空间)Normal vectors in a normal map are expressed in tangent space where normals always point roughly in the positive z direction.Calculating the tangent and bitangent vectors is not...原创 2019-01-31 17:47:11 · 525 阅读 · 0 评论 -
LearnOpenGL 总结记录<5> Normal Matrix
As of now we’ve been passing the normal vectors directly from the vertex shader to the fragment shader. However, the calculations we’ve been doing in the fragment shader are all done in world space co...原创 2019-01-28 10:40:34 · 271 阅读 · 0 评论 -
LearnOpenGL 总结记录<12> Shadow Mapping
Shadow Mapping的基本思路就不进行记录了,可以直接看 :https://learnopengl.com/Advanced-Lighting/Shadows/Shadow-Mapping这里记录一些值得注意的地方1. FrameBuffer 绑定了 GL_DEPTH_ATTACHMENT 为 depthMap,渲染场景生成depthMap的时候,没有写入任何颜色,只是写入了...原创 2019-01-31 11:38:22 · 237 阅读 · 0 评论