shader

Draw a dashed and dotted bezier curve in QML

浪子不回头ぞ 提交于 2019-12-03 02:08:01
I've seen there is an example implementation of a Bezier curve in QML , but I'm looking for a hint how to implement dashed or dotted bezier curve line. As far as I see, tha authors of Bezier curve example are using QSGGeometryNode to store inside QSGGeometry with a QSGFlatColorMaterial material applied on it. Then they simply create list of points and draw segments between them. Is it possible to write a shader and apply it to QSGFlatColorMaterial (to display line as dashed , dotted , etc)? Eventually, is it possible to store more than one QSGGeometry inside QSGGeometryNode ? UPDATE I would

Issue with ComposeShader on Android 4.1.1

匿名 (未验证) 提交于 2019-12-03 01:47:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm just trying to implement a color picker for my android application, and ran into a strange issue on Android 4.1.1. The following code does not create the expected gradients on Android 4.1.1, but it does on 2.3.7: Shader fadeInRight = new LinearGradient(0, 0, pWidth, 0, 0x00000000, 0xFF000000, Shader.TileMode.CLAMP); Shader blackToWhite = new LinearGradient(0, 0, 0, pHeight, 0xFF000000, 0xFFFFFFFF, Shader.TileMode.CLAMP); Shader whiteMask = new ComposeShader(blackToWhite, fadeInRight, PorterDuff.Mode.DST_IN); Shader blackToColor = new

GLSL/OpenGL shader tessellation flickering and failure

匿名 (未验证) 提交于 2019-12-03 01:47:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I just started with OpenGL tessellation and have run into a bit a trouble. I am tessellating series of patches formed by one vertex each. These vertices/patches are structured in a gridlike fashion to later form a terrain generated by Perlin Noise. The problem I have run into is that starting from the second patch, and every 5 th patch after that, sometimes have a lot of tessellation (not the way i configured) but most of the time it doesn't get tessellated at all. Like so: The two white circles mark the highly/over tessellated

THREE.lod and normalmap shader fail

匿名 (未验证) 提交于 2019-12-03 01:44:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I wanted to play with THREE lod system, and I applied normal mapped material on my meshes but it failed with GL errors : WebGLRenderingContext: GL ERROR :GL_INVALID_OPERATION : glDrawElements: attempt to access out of range vertices in attribute 2 Anyone can reproduce it quite easly I think, just edit the webgl_lod example, and instead of applying a MeshLambertMaterial use the normalmap ShaderMaterial provided in the misc_control_fly example. Am I missing something, isn't the normalmap shader supposed to work with LOD meshes ? edit: here is

Three.js: Objects intersected and shader material

匿名 (未验证) 提交于 2019-12-03 01:39:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a scene with objects intersected using Lambert material, like in this jsFiddle . Now I need/want to switch the material of that plane to a Shader material and the plane turns into a background thing, like here . The question is, can I use different materials in objects and still preserve the intersection effect? Is this a Three.js limitation or this is how shaders works? Or am I missing a parameter in the renderer/material? At the moment is not an option no switch all my work to shader materials in order to take advantage of shaders.

0:1(10): error: GLSL 3.30 is not supported. ubuntu 18.04 c++

匿名 (未验证) 提交于 2019-12-03 01:36:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am trying to draw a triangle on the window with openGL GLFW library. Here is my complete code #include <GL/glew.h> #include <GLFW/glfw3.h> #include <iostream> using namespace std; static unsigned int compileShader ( unsigned int type, const string& source ){ unsigned int id = glCreateShader ( type ); const char* src = source.c_str(); glShaderSource ( id, 1, &src, nullptr ); glCompileShader ( id ); int result = 0; glGetShaderiv ( id, GL_COMPILE_STATUS, &result ); if ( result == GL_FALSE ){ int length = 0; glGetShaderiv ( id, GL_INFO_LOG

QtOpenGLWidget drawing triangle

匿名 (未验证) 提交于 2019-12-03 01:36:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: How can I change the following code so that it actually draws the triangle? First is the shader, then the implementation of the glwiedget class which is derived from QOpenglWidget . // shaders here static const char * vertexShaderSource = "#version 330 core\n" "in vec3 posAttr;\n" //"attribute lowp vec3 colAttr;\n" //"varying lowp vec4 col;\n" //"uniform highp mat4 matrix;\n" "void main() {\n" //" col = colAttr;\n" " gl_Position = vec4(posAttr, 1) ;\n" "}\n" ; // fragment shader static const char * fragmentShaderSource = "#version 330 core\n

Vertex Shader Creating

匿名 (未验证) 提交于 2019-12-03 01:26:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am learning D3D and currently i am at shaders. I wrote the code and built it - succeed but when debug i get this error: ERROR Here is the line where debugger breake: dev->CreateVertexShader(VS->GetBufferPointer(), VS->GetBufferSize(), NULL, &pVS); And here is the whole function: void InitPipeline() { // load and compile the two shaders ID3D10Blob *VS, *PS; D3DX11CompileFromFile("Shaders.shader", 0, 0, "VShader", "vs_4_0", 0, 0, 0, &VS, 0, 0); D3DX11CompileFromFile("Shaders.shader", 0, 0, "PShader", "ps_4_0", 0, 0, 0, &PS, 0, 0); //

How to develop OpenGL ES (GLES) 2.0 applications on Linux?

匿名 (未验证) 提交于 2019-12-03 01:25:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I would like to develop OpenGL ES 2.0 apps on my Ubuntu machine. I could not find any libraries/emulators that support GLES 2.0 yet. Any suggestions? 回答1: You can use POWERVR SDK to emulate Opengl es on your PC. You can download the SDK here . The archive provides the necessary steps to install the emulation libraries as a documentation file and includes tutorials and demo applications with source codes. 回答2: GLFW, Mesa, Ubuntu 16.04 AMD64 This was not easy to setup on Ubuntu 14.04, but now it just works. sudo apt-get install libglfw3-dev

Unity3D - Shader for sprite clipping

匿名 (未验证) 提交于 2019-12-03 01:21:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am trying to create a shader that can be used to clip 2D sprites in a game, I found this shader in another question Shader "Sprites/ClipArea" { Properties { _MainTex ("Base (RGB), Alpha (A)", 2D) = "white" {} _Length ("Length", Range(0.0, 1.0)) = 1.0 _Width ("Width", Range(0.0, 1.0)) = 0.5 } SubShader { LOD 200 Tags { "Queue" = "Transparent" "IgnoreProjector" = "True" "RenderType" = "Transparent" } Pass { Cull Off Lighting Off ZWrite Off Offset -1, -1 Fog { Mode Off } ColorMask RGB Blend SrcAlpha OneMinusSrcAlpha CGPROGRAM #pragma vertex