shader

How can I add a uniform width outline to WebGL shader drawn circles/ellipses (drawn using edge/distance antialiasing)

笑着哭i 提交于 2019-12-12 05:26:55
问题 I am drawing circles/ellipses in WebGL using a single Quad and a fragment shader, in order to draw them in a resolution independent manner (Edge distance anti-aliasing) Here is my fragment shader currently: '#extension GL_OES_standard_derivatives : enable', 'precision mediump float;', 'varying vec2 coord;', 'vec4 circleColor = vec4(1.0, 0.5, 0.0, 1.0);', 'vec4 outlineColor = vec4(0.0, 0.0, 0.0, 1.0);', 'uniform float strokeWidth;', 'float outerEdgeCenter = 0.5 - strokeWidth;', 'void main(void

OpenGL Reflection shader showing only grey

偶尔善良 提交于 2019-12-12 05:25:15
问题 I'm very new to OpenGL and I've been working with setting up sky boxes, and finally fixed it thanks to some help here but now the reflection shader I've tried to set up by editing some I've found (so a sphere will have a basic reflection effect based on the cube map of my sky box) will not show any color but grey as shown in the image. http://i.imgur.com/Th56Phg.png I'm having no luck figuring out, here is my shader code: Vertex Shader #version 330 core attribute vec3 position; attribute vec2

iOS. OpenGL. Several views simultaneously

Deadly 提交于 2019-12-12 05:16:53
问题 a couple of days before i asked about filling space between two curve lines with gradient. Since that i've changed a lots of in my code - now i'm using shaders. The result is almost as i need. BUT! Again i have a problem with using several OpenGL views simultaneously in one controller but they must be absolutely independent between each other. So, thanks to unbelievable tutorial from raywenderlich.com and code example from bradley i have next situation: two custom objects of class

Incorrect reading from DataTextures in shader

一笑奈何 提交于 2019-12-12 04:47:11
问题 I have a program that works great when my POT DataTextures are 1:1 (width:height) in their texel dimensions, however when they are 2:1 or 1:2 in texel dimensions it appears that the texels are being incorrectly read and applied. I'm using continuous indexes (1,2,3,4,5...) to access the texels using the two functions below. I'm wondering if there is something wrong with how I am accessing the texel data, or perhaps if my use of a Float32Array for the integer indexes needs to be switched to a

OpenGL ES 2.0 Shader on Texture not working

隐身守侯 提交于 2019-12-12 04:25:19
问题 I copied the example from this site click It is working well after fixing some minor things and extending the shader for my purpose. Now i want to move/translate the texture to the right side of the screen. For that case i have to add a ModelViewProjection Matrix to my code and as well to the shader, right? After doing this the Texture is not showing up anymore :-( What am I doing wrong? So the code is working until i change in my shader gl_position from : gl_Position= a_position to gl

MAC OpenGL shader error: “version '150' is not supported ”

末鹿安然 提交于 2019-12-12 04:01:57
问题 I follow the book "OpenGL SuperBible 5th Edition" to study openGL, the capture 6th demo to create shader by hand all not work. Like the demo of "ShadedTriangle", to create a triangle but only create a black ground window. The error is "The shader at ShadedIdentity.vp failed to compile with the following error: ERROR: 0:5: '' : version '150' is not supported" and I change the GLSL version to 330,440, 150 etc, but all not work. and now my mac version is 10.12.5 (16F73) , and the version of code

LWJGL3 shader, triangle not showing up

China☆狼群 提交于 2019-12-12 03:58:33
问题 I'm new to OpenGL and LWJGL3 and I'm trying to render a triangle. However, it isn't showing up, only the white, empty window. I guess it's a pretty small piece that I somehow forgot or where I just made a mistake. I don't find it after searching for hours now though. Here's the code: MainLoop: import static org.lwjgl.opengl.GL11.*; import static org.lwjgl.opengl.GL15.*; import static org.lwjgl.opengl.GL20.*; import static org.lwjgl.opengl.GL30.*; import static org.lwjgl.glfw.GLFW.*; public

Is it possible to use 2 textures (one on top of the other) as a Material without using custom Shaders?

时光怂恿深爱的人放手 提交于 2019-12-12 03:42:52
问题 I'm learning three.js and I've done a few a examples on it and basic shaders (One being Codrop's "the aviator" tutorial), but right now I'm stumped trying to create a simple cube with 2 textures at once. I would like to use 2 transparent .png textures at the same time for each of the square's face. Is this possible without recurring to custom shaders? I already saw this answer, but I've had no success getting it to work correctly because of it's complexity and being rather new to shaders. For

Why is my webgl shader not changing pixel fragments correctly?

拜拜、爱过 提交于 2019-12-12 02:57:47
问题 I'm trying to get position of a fragment and change the color at positions, but when I try to do it, I get a weird effect where they don't want to be changed completely. Notice how there is a cyan color, but that part should be transparent. It seems like there's some weird rounding happening, and I'm not sure how to fix it. What is happening here? void main() { vec4 c0 = vec4(0,1,0,1); c0.a *= step(132.0,gl_FragCoord.x); gl_FragColor = c0; } 回答1: You need to show more code. Did you enable

Duplicate existing Three.js materials to add displacement calculations

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-12 02:36:18
问题 I need to do vertex displacements using a texture map in Three.js. Is there an existing material that supports that? If not, what is the best way to duplicate an existing Three.js shader so that I can add in some vertex displacement calculations? I would like to keep existing functionalities such as shadows and wireframe on the material. 回答1: Vertex displacements using a texture map are supported by THREE.ShaderTerrain[ "terrain" ] and THREE.ShaderLib[ "normalmap" ] . Examples of their use