opengl

【GAMES101-现代计算机图形学课程笔记】Lecture 08 Shading 2 (着色管线)

人盡茶涼 提交于 2020-07-24 21:00:51
本节内容概要: Blinn-Phong reflectance model Specular and ambient terms Shading frequencies Graphics pipeline 1. Blinn-Phong reflectance model 1.1 漫反射项 在介绍本节内容之前首先回顾一下上一节的内容。 前面提到了光可以分成三种: 漫反射光、镜面反射光和环境光。 上一节主要介绍了漫反射,由下图我们知道着色点(shading point)的明暗程度与相机(观测)角度无关。具体的光线强度计算公式: \[L_{d}=k_{d}\left(I / r^{2}\right) \max (0, \mathbf{n} \cdot 1) \] 上面公式中的 \(k_d\) 表示漫反射系数,中间 \(I/r^2\) 表示理论上每个着色点对应的光强度,最后一项 \(\max (0, \mathbf{n} \cdot 1)\) 表示吸收的能量比例,可以看到只与法向和光的方向夹角有关。 1.2 高光项(Specular Term) 下面介绍一下高光(又称 镜面反射)项。根据日常生活经验我们可以发现这样一种规律,就是当我们去看一面镜子的时候,当我们的观察角度越接近光线的镜面反射方向,就越容易看到高光(就是那种闪瞎狗眼的情况)。以下图为例,就是当我们的观察方向 \(V\)

2020年腾讯C++面试题和答案持续更新中-内附视频讲解(10)

只谈情不闲聊 提交于 2020-07-24 19:07:31
大家好我是好好学习天天编程的天天 一个整天在互联网上种菜和砍柴的程序员~ 凭着自己多年的互联网从业经验和对校园招聘的研究,再结合自己当年校招找工作的经验, 今天写了一篇长文: 《计算机专业学生,大三了找技术岗,怎么写一份好简历?内附269份简历模板》 文章仔细介绍了,一份IT大学生如何做一份优秀的简历,以及注意事项。 后期再不断给大家分享:如何投递简历,如何准备面试等相关的话题吧。 接下来还是分享一份腾讯的面试题吧。 2020年腾讯C++面试题一面 来源:牛客 说一下c++语言特点 重载和重写(前者是参数可改,后者参数一样) vector array区别 tcp 三次握手,四次挥手 计网七层协议 tcp udp优缺点 网址访问过程,dns查询迭代,递归查询 http和https的区别,加密的工作原理 进程,线程区别 进程通信,说了个消费者生产者模式 shell脚本写过吗,然后问了具体命令,文件内修改字符命令,进程后台执行命令,还问了几个其他的命令 数据库用过吗,我说用过关系数据库,mysql有啥引擎,事务的四大特点,然后给了数据库表,两道sql题目 描述二叉树的遍历方式,写了个非递归的前序遍历 链表有环的问题 字典树,不知道,然后说子串匹配,我说kmp算法,也没问具体的细节 华为去年的软挑比赛讲了讲 项目中的难点 排序算法,时间复杂度,空间复杂度 然后继续问项目,问的我头皮发麻

Rendering transparent objects

房东的猫 提交于 2020-07-24 05:38:21
问题 I am trying to make a glass plane by adjusting the translucency of the object with alpha values. Currently, it is a black plane as my alpha values have no effect on my objects. Please have a look at the image: glEnable(GL_BLEND); does nothing and glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ZERO); makes all my objects disappear fragment shader: #version 330 core // interpolated values from the vertex shaders in vec3 vNormal; in vec3 vPosition; in vec2 vTexCoord; //

Rendering transparent objects

北慕城南 提交于 2020-07-24 05:36:11
问题 I am trying to make a glass plane by adjusting the translucency of the object with alpha values. Currently, it is a black plane as my alpha values have no effect on my objects. Please have a look at the image: glEnable(GL_BLEND); does nothing and glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ZERO); makes all my objects disappear fragment shader: #version 330 core // interpolated values from the vertex shaders in vec3 vNormal; in vec3 vPosition; in vec2 vTexCoord; //

why does my window doesn't work for on_draw?

♀尐吖头ヾ 提交于 2020-07-22 06:31:38
问题 I was watching a video about pyglet and I tried to create a triangle: import pyglet from pyglet.gl import * class mywindow(pyglet.window.Window): def __init__(self, *args,**kwargs): super().__init__(*args,**kwargs) self.set_minimum_size(300,300) window = mywindow(300,300,"deneme", True) def on_draw(): glBegin(GL_TRIANGLE) glColor3b(255,0,0) glVertex2f(-1,0) glColor3b(0,255,0) glVertex2f(1,0) glColor3b(0,0,255) glVertex2f(0,1) window.on_draw() pyglet.app.run() when I run this code; I get this

Pixel-path performance warning: Pixel transfer is synchronized with 3D rendering

老子叫甜甜 提交于 2020-07-20 08:08:13
问题 I am uploading image data into GL texture asynchronously. In debug output I am getting these warnings during the rendering: Source:OpenGL,type: Other, id: 131185, severity: Notification Message: Buffer detailed info: Buffer object 1 (bound to GL_PIXEL_UNPACK_BUFFER_ARB, usage hint is GL_DYNAMIC_DRAW) has been mapped WRITE_ONLY in SYSTEM HEAP memory (fast). Source:OpenGL,type: Performance, id: 131154, severity: Medium Message: Pixel-path performance warning: Pixel transfer is synchronized with

how to update vertex buffer data frequently (every frame) opengl

安稳与你 提交于 2020-07-19 05:29:24
问题 I have a simple 2d triangle displayed on the screen, I want to update the color buffer data every frame, so the color of the triangle changes constantly, but im not sure how to update the data efficiently. this is the code for the color buffer: GLfloat colourVert[] = { 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f }; GLuint colourBuffer; glGenBuffers(1, &colourBuffer); glBindBuffer(GL_ARRAY_BUFFER, colourBuffer); glBufferData(GL_ARRAY_BUFFER, sizeof(colourVert), colourVert, GL_DYNAMIC

PyOpenGL OpenGL Version on MacOs

假如想象 提交于 2020-07-19 04:41:30
问题 I've been told to switch legacy profile to core profile from other stackoverflow posts but I can't seem to find a way to do that. So I'm positing a more updated error post to help me figure out a way. CODE: import glfw, numpy from OpenGL.GL import * import OpenGL.GL.shaders def main(): if not glfw.init(): return window = glfw.create_window(800,600,"My OpenGL Window", None, None) if not window: glfw.terminate() return glfw.make_context_current(window) triangle = [-0.5, -0.5, 0.0, 0.5, -0.5, 0

OpenGL 3D GUI Engine and/or assets [closed]

丶灬走出姿态 提交于 2020-07-15 05:51:29
问题 Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 15 days ago . Improve this question Are there any OpenGL 3D GUI libraries? and/or Are there any 3D assets like windows, list boxes, etc. that can be used in a 3D game engine? Something like Age 3D is a great start, http://www.youtube.com/watch?v=Cq8Qs8lqqFA, but they aren't around anymore. 回答1:

OpenGL 3D GUI Engine and/or assets [closed]

自闭症网瘾萝莉.ら 提交于 2020-07-15 05:50:35
问题 Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 15 days ago . Improve this question Are there any OpenGL 3D GUI libraries? and/or Are there any 3D assets like windows, list boxes, etc. that can be used in a 3D game engine? Something like Age 3D is a great start, http://www.youtube.com/watch?v=Cq8Qs8lqqFA, but they aren't around anymore. 回答1: