glsl

OpenGL : thick and smooth/non-broken lines *in 3D*

那年仲夏 提交于 2020-02-26 10:34:58
问题 I have a 3D CAD-like application for which I use OpenGL wrapper library (OpenSceneGraph). For the application I am trying to come up with the best strategy on how to render thick and smooth lines in 3D . By thick and smooth I mean: line thickness can be more than OpenGL maximum linewidth value (it seems to be 10.f on my machine) when composing polylines I want to avoid the look of "broken lines" (see example image below) At the moment I render my polylines by using GL_LINE_STRIP_ADJACENCY . I

C++ GLSL shaders: “error: GLSL 3.30 is not supported. Supported versions are: 1.10, 1.20, 1.30, 1.00 ES, and 3.00 ES” or black window

青春壹個敷衍的年華 提交于 2020-02-25 06:13:06
问题 I'm added in my simple OpenGL project very simple GLSL shaders, and it not working. #include <python3.6m/Python.h> #include <iostream> #include <GL/glew.h> #include <GLFW/glfw3.h> #include <glm/glm.hpp> #include <vector> #include <fstream> #include <sstream> using namespace glm; GLuint LoadShaders(const char * vertex_file_path, const char * fragment_file_path){ // Создаем шейдеры GLuint VertexShaderID = glCreateShader(GL_VERTEX_SHADER); GLuint FragmentShaderID = glCreateShader(GL_FRAGMENT

How to fix this OpenGL error? “unexpected tokens following preprocessor directive - expected a newline”

梦想的初衷 提交于 2020-02-25 05:41:51
问题 I am trying to complete my first JOGL OpenGL program using shaders. I am just starting with a simple Vertex shader which does a compilation error. The shader is expected to receive a vec2(0.5, 0.5) which is basically (x,y) coordinates and it generates a proper vec4(x-1.0,y-1.0,0.0,1.0) pixel. The program actually displays the pixel, but it is not using the shader as the shader gives compilation error. How can I get more information on what is failing? Nowhere in the JOGL API code is specified

How to fix this OpenGL error? “unexpected tokens following preprocessor directive - expected a newline”

有些话、适合烂在心里 提交于 2020-02-25 05:41:06
问题 I am trying to complete my first JOGL OpenGL program using shaders. I am just starting with a simple Vertex shader which does a compilation error. The shader is expected to receive a vec2(0.5, 0.5) which is basically (x,y) coordinates and it generates a proper vec4(x-1.0,y-1.0,0.0,1.0) pixel. The program actually displays the pixel, but it is not using the shader as the shader gives compilation error. How can I get more information on what is failing? Nowhere in the JOGL API code is specified

Pack depth information in a RGBA texture using mediump precison

陌路散爱 提交于 2020-02-24 21:53:16
问题 Trying to understand the many issues related to the WebGL development for a generic mobile target, now I need to store depth information in a texture attachment for later retrieval and post-processing. JavaScript: var depthRB = gl.createRenderbuffer(); gl.bindRenderbuffer(gl.RENDERBUFFER, depthRB); gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_COMPONENT16, w, h); gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.RENDERBUFFER, depthRB); gl.bindRenderbuffer(gl.RENDERBUFFER,

Pack depth information in a RGBA texture using mediump precison

做~自己de王妃 提交于 2020-02-24 21:51:33
问题 Trying to understand the many issues related to the WebGL development for a generic mobile target, now I need to store depth information in a texture attachment for later retrieval and post-processing. JavaScript: var depthRB = gl.createRenderbuffer(); gl.bindRenderbuffer(gl.RENDERBUFFER, depthRB); gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_COMPONENT16, w, h); gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.RENDERBUFFER, depthRB); gl.bindRenderbuffer(gl.RENDERBUFFER,

Pack depth information in a RGBA texture using mediump precison

ぐ巨炮叔叔 提交于 2020-02-24 21:50:21
问题 Trying to understand the many issues related to the WebGL development for a generic mobile target, now I need to store depth information in a texture attachment for later retrieval and post-processing. JavaScript: var depthRB = gl.createRenderbuffer(); gl.bindRenderbuffer(gl.RENDERBUFFER, depthRB); gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_COMPONENT16, w, h); gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.RENDERBUFFER, depthRB); gl.bindRenderbuffer(gl.RENDERBUFFER,

Differing floating point behaviour between uniform and constants in GLSL

五迷三道 提交于 2020-02-24 10:23:41
问题 I am trying to implement emulated double-precision in GLSL, and I observe a strange behaviour difference leading to subtle floating point errors in GLSL. Consider the following fragment shader, writing to a 4-float texture to print the output. layout (location = 0) out vec4 Output uniform float s; void main() { float a = 0.1f; float b = s; const float split = 8193.0; // = 2^13 + 1 float ca = split * a; float cb = split * b; float v1a = ca - (ca - a); float v1b = cb - (cb - b); Output = vec4(a

Differing floating point behaviour between uniform and constants in GLSL

孤街浪徒 提交于 2020-02-24 10:23:26
问题 I am trying to implement emulated double-precision in GLSL, and I observe a strange behaviour difference leading to subtle floating point errors in GLSL. Consider the following fragment shader, writing to a 4-float texture to print the output. layout (location = 0) out vec4 Output uniform float s; void main() { float a = 0.1f; float b = s; const float split = 8193.0; // = 2^13 + 1 float ca = split * a; float cb = split * b; float v1a = ca - (ca - a); float v1b = cb - (cb - b); Output = vec4(a

Is it possible to express “t” variable from Cubic Bezier Curve equation?

南楼画角 提交于 2020-02-24 05:45:48
问题 I want draw bezier curve only by fragment shader to connect nodes in my editor. I know all 4 points that define Bezier Curve. And Fragment Shader is called for every pixel, so i can just check: if "t" for gl_Coord.x is between 0 and 1 then set frag_color to Red for example. I want to avoid loops in shader that's inefficient. Best way, i think, is check for points that lay on the curve. But how to do it for Bezier Curves? Is it possible to express "t" variable from cubic bezier equation? x = (