OpenGL 学习笔记

Colors and Materials

  1. material is about
  2. ambient
  3. specular
  4. diffuse
  5. Transparency
  6. caustics

Light

  1. AmbientLight //it is
  2. DiffuseLight //Direction
    角度不同,光强不同
    Phong Shading
  3. Specular Light //The Direction of Light and the Position of the Viewer
    1. Why can see in another angle
    2. Blinn-Phong Reflection
    3. Gouraud Shading
  4. Normal
    1. Vertex Normal
    2. Surface Normal
  5. Shadow
    • ShadowMapping
    • Light Perspective
    • Depth test
    • Depth Buffer
    • shadow factor

Texture

  • glGenTextures(n, &m_shadowMap); //分配n个Texture, 并且设置其Handle
  • glBindTexture(GL_TEXTURE_2D, m_shadowMap); //GL_TEXTURE_2D应该是设置变量类型
  • glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, WindowWidth, WindowHeight, 0, GL_DEPTH_COMPONENT, GL_FLOAT, NULL);
     - GL_DEPTH_COMPONENT表明只有深度属性
     - NULL表示?
  • glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);//设置Texture的属性
  • glActiveTexture(TextureUnit);//????

数据结构

  • GLuint VBO;//定义内存
  • glGenBuffers(1, &VBO);//分配内存
  • VBO
  • Vector
  • 内存
  • 数据存储

Other

  • Space?
  • local space
  • clip space
  • NDC space
  • texture space
  • depth test
  • WVP matrix

DrawCall

  • ordered draw
  • indexed draw
glDrawArrays(GL_TRIANGLES, 0, 3);
glDrawArray(GL_POINTS, index, count);//GL_POINTS is the type, index is the index to draw, count is how many to draw
glDrawElements(GL_TRIANGLES, 12, GL_UNSIGNED_INT, 0);//draw elements depending on IBO, GL_TRIANGLE is the image type, GL_UNSIGNED_INT is the elements type, 12 = 3*4 means there are 4 triangles, 0 is the index to draw 

Buffer

  • Buffer
Vector3f Vertex[1];//define a vertex array
Vertex[0] = [1, 1, 1]//set the value of 0
glGenBuffer(n, &VBO);//generate n buffers and set the handle to buffer
glBindBuffer(GL_ARRAY_BUFFER, VBO)://GL_ARRAY_BUFFER as the type and VBO is the handle
glBufferData(GL_ARRAY_BUFFER, VBO, sizeof(Vertex), Vertex, GL_STATIC_DRAW);//GL_STATIC_DRAW means we will not change the content
glEnableVertexAttribArray(i);//i是给Shader用的,表示接下来的VertexAttribPointer中的值可以被OPENGL使用。
glVertexAttribPointer(index, 3, GL_FLOAT, GL_FALSE, stride, 0);//如何处理数组中的元素,index表示数组的开头,3表示每个数组中向量的长度,GL_FLOAT表示向量中元素的类型,GL_FALSE表示如何是否normalized,stride表示数组元素之间的偏移量
  • RenderBuffer

  • FrameBuffer

    • Depth Buffer
    • Color Buffer
    • ways of attachments
    • COLOR_ATTACHMENTi
    • DEPTH_ATTACHMENT
    • DEPTH_STENCIL_ATTACHMENT
    • APIS
    • glBindFramebuffer(GL_FRAMEBUFFER, m_fbo);//绑定以后所有操作都会进行到这个FrameBuffer上
        - 其他参数有 GL_DRAW_FRAMEBUFFER,GL_READ_FRAMEBUFFER,
        + glBindFramebuffer(GL_FRAMEBUFFER, 0); //设置为默认屏幕缓冲区
  • VertexBuffer

  • Mipmapping

一个Sphere的着色

UV_mapping
Texturing a Sphere
GLSL Programming/GLUT/Textured Spheres
Unfolding the Earth: Myriahedral Projections
Spherical Mapping with Normals

ShadowMapping

DepthTest

Learn CubeMap

描述

  • 有6个texture
  • 每个有mipmap
  • 大多数情况下,是用来做反射的
  • it is an environment map

资料

Learn HeightField

资料

Cube

问题

  • 如何使用
  • 与普通Texture的区别

Learn Texture

description

分解

  • genTexture
  • glBindTexture
  • glActiveTexture
  • glTexParameterf
  • glTexImage2D
  • TextureCoordinates
  • Sampler

资料

Questions

  • uv值的起点坐标是

Learn Ray marching

Learn GL variables

  • Built-in Variable
  • uniform
  • 是在一次render过程中不变的
  • attribute
  • 顶点的属性
  • 只能在Vertex.glsl中
  • varying
  • 在fragment和vertex之间传输

WEBGL retina

var devicePixelRatio = window.devicePixelRatio || 1; //     Evaluates to 2 if Retina
renderer.setSize( canvasWidth/devicePixelRatio,     canvasHeight/devicePixelRatio);
renderer.setClearColorHex( 0xffffff, 1.0 );

Learn GL expressions

学习资料

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • 1.初始化gl setEGLContextClientVersion(2);//申明使用版本号 setRender...
    Lock_gc阅读 842评论 0 0
  • 头条好申请以后,鉴于我对于原创文章不太了解的情况下,自己一直没有动笔创作。 第一步先做悟空问答吧,小试牛刀一下。从...
    昕城阅读 442评论 4 4
  • 临时取消今天的版纳瑜伽游学活动,改为飞回老家山西临汾,陪老妈。老妈住院了,因为感冒咳嗽导致胸积水严重,胸闷难受。我...
    劲汶阅读 262评论 0 0

友情链接更多精彩内容