shader

Failed to create shader cache entry- error while locating an element by its Css selector

匿名 (未验证) 提交于 2019-12-03 01:10:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am writing a simple script in Python using Selenium to detect an element by its Css selector. I am accessing the Google page, and am targeting the input, by its CSS selector, which is input[name=q] The Chrome page opens as planned, but the issue is that it closes without actually finding the input, and throws the following error in the terminal: ERROR:shader_disk_cache.cc(237)] Failed to create shader cache entry: -2 I tried running the script when Google Chrome is closed, and even went as far as to close all the Chrome processes in Task

OpenGL Lighting on texture plane is not working

匿名 (未验证) 提交于 2019-12-03 01:08:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I want to light to the texture plane but this is not work. Light on solid sphere is very well, but texture plane is not light. Whole Image Lighting on solid-sphere is working well. But, lighting on texture plane is not working. (GL_DECAL, GL_REPLACE; I also tried GL_MODULATE) This is a snippet of my rendering code. ( Whole code on GitHub ) Loading texture. sf::Image image; if (!image.loadFromFile(path)) return false; glGenTextures(1, &id); glBindTexture(GL_TEXTURE_2D, id); glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, image.getSize().x, image

Deferred Rendering Skybox OpenGL

匿名 (未验证) 提交于 2019-12-03 01:00:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I've just implemented deferred rendering and am having trouble getting my skybox working. I try rendering my skybox at the very end of my rendering loop and all I get is a black screen. Here's the rendering loop: //binds the fbo gBuffer.Bind(); //the shader that writes info to gbuffer geometryPass.Bind(); glDepthMask(GL_TRUE); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glEnable(GL_DEPTH_TEST); glDisable(GL_BLEND); //draw geometry geometryPass.SetUniform("model", transform.GetModel()); geometryPass.SetUniform("mvp", camera

Geometry shader doesn't do anything when fed GL_POINTS

匿名 (未验证) 提交于 2019-12-03 00:59:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to use geometry shaders to turn points into line segments (GL_POINTS to GL_LINE_STRIP), but no line segments appear. If I change the input to GL_LINES, and just repeat the vertex, then I get the behavior I'm expecting. What's going on? Here's a complete program that demonstrates the behavior. As-is, I get nothing but a black window. Setting USE_POINTS to False gets me the rotating psychedelic flashing lines I'm expecting. #!/usr/bin/python from OpenGL.GL import * from OpenGL.GLU import * from OpenGL.GLUT import * from OpenGL.GL

OpenGL shaders don't link with shader program

匿名 (未验证) 提交于 2019-12-03 00:58:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I am trying to add shaders with GLFW/GLEW. I am getting an error that the shaders are loaded but they don't have valid object code. This is the code I have for loading the shaders: class SHADER { public : void LoadShaders ( const char * vertexFile , const char * fragmentFile ); char * vertexShader ; char * fragmentShader ; private : int Load ( const char * filename , char *& shaderSource ); fstream file ; }; int SHADER :: Load ( const char * filename , char *& shaderSource ) { file . open ( filename , ios :: in ); if ( file . is

Use of the Gtk.GLArea in Pygobject GTK3

匿名 (未验证) 提交于 2019-12-03 00:44:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: The documentation for use of the python wrappers for GTk3 are somewhat limited. I have found several of the common widget examples. I am trying to use the Gtk.GLArea widget. The API documentation is for C and I have not had much luck guessing the equivalent python calls to use this widget. In the example the widget is created using the following C code: // create a GtkGLArea instance GtkWidget *gl_area = gtk_gl_area_new (); g_signal_connect (gl_area, "render", G_CALLBACK (render), NULL); Then the render function has openGL commands in it:

Fragment shader: No uniform with name in shader

匿名 (未验证) 提交于 2019-12-03 00:44:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I have problem with fragment shader in libgdx. Below is my fragment shader. #ifdef GL_ES precision mediump float ; #endif uniform float u_aspectRatio ; varying vec2 v_texCoords ; uniform sampler2D u_texture ; void main () { gl_FragColor = texture2D ( u_texture , v_texCoords ); } In program I do shader . setUniformi ( "u_texture" , 0 ); // work fine shader . setUniformf ( "u_aspectRatio" , 0.0f ); //no uniform with name 'u_aspectRatio' in shader shader.isCompiled() return true and first set work fine, but in second I have error "no

Unity Shader - Flat, Gouraud, Phong Shading

匿名 (未验证) 提交于 2019-12-03 00:43:02
Shading mode 只要三角面的代表点(如:三角面中的第一个index点)被光照到什么颜色,就决定了该三角面的整个面的颜色。 某特殊情况,大家应该可以想象到: 如果一个很大的三角面中,第一个index点一个聚光灯照到,那么整个大三角面绘制出来的就是光源色 如果一个很大的三角面中,几乎被一个聚光灯照射到整个面,但就没照射到代表点(第一个index点),那么整个大三角面绘制出来的光源色就没有这个聚光灯的光源色 与Flat相比,仅仅是三角面所有像素颜色是根据三个顶点的光源色插值算出来的,所以上述Flat shading的某特殊情况,Gouraud shading也有类似的问题(顶点没被关照到时的颜色问题) 相比前两者的shading mode,该模式处理光照数据是在fragment阶段处理的,所以能精确控制到没个像素上,当然开销就比较大,像素处理光照时,每个像素的所在的三角面计算光照时的法线都会插值计算一下(根据三角面三顶点插值),所以每个像素处理出来的光照效果是最平滑的。 Flat, Gouraud shading 都是在vertex阶段处理光照数据的 Phong shading是在fragment阶段处理光照数据的 所以如果我们用到了这三种光源处理shading,就按我们需要的风格来选择。 工程下载 (u3d ver : 2017.4.3f1, vs : vs2017

Shader与ShaderToy开篇

匿名 (未验证) 提交于 2019-12-03 00:43:02
写在前面 Unity从学习到工作至今已经有三个年头了,开发中每次遇到难点第一件事就是百度搜索,从来没有自己的想法,甚是惭愧。想着不能再这样浑浑噩噩下去了,也决定开个博客,记录一下开发中自己觉得有用的东西,希望日后某一天回顾起来不会觉得日子白过,如果还能帮助到有需要有同学那就再好不过了。 关于Shader candycat 这个博主。工作后陆续遇到了shader方面的问题,基本都是无法个人解决的,带我的人就向我推荐了这个博主。当时连个CSDN账号都懒得登录,就这样一篇一篇的看着她的文章学习起了shader,期间还买了她出过的shader书籍,不过现在都还没看完,十分惭愧。学习到现在,虽然说无法吃透shader,但起码阅读起shader的代码,写一些简单的shader效果是没多大问题的。说起来 candycat 还是女生,年纪比我还小,无意识间敬佩又增加了一分。 正文 这里 看看。因为我是学Unity的,所以还是偏向于Shadertoy转Unity的Shaderlab之后的运用。首先要说的是 candycat 的那个shadertoy转shaderlab的模板。下面是这位博主的原代码。 //Design By candycat(https://blog.csdn.net/candycat1992) Shader "Shadertoy/Template" { Properties{

【Shader与ShaderToy】画一个圆

匿名 (未验证) 提交于 2019-12-03 00:43:02
写在前面 Unity部分 Shader "Custom/circle" { Properties { //xy表示圆心在屏幕中的uv值,z为半径,w为圆边缘的平滑值 _parameters("circleParameter",Vector)=(0.5,0.5,10,0) _Color("circleColor",COLOR)=(1,1,1,1) } SubShader { Tags { "RenderType"="Opaque" } LOD 200 Pass{ CGPROGRAM #include "UnityCG.cginc" #pragma fragmentoption ARB_precision_hint_fastest #pragma target 3.0 #pragma vertex vert #pragma fragment frag #define vec2 float2 #define vec3 float3 #define vec4 float4 #define mat2 float2 #define mat3 float3 #define mat4 float4 #define iGlobalTime _Time.y #define mod fmod #define mix lerp #define fract frac #define Texture2D