glsl

OpenGL : Bone Animation, Why Do I Need Inverse of Bind Pose When Working with GPU?

旧街凉风 提交于 2019-12-01 15:26:33
问题 I implemented an MD5 Loader with software skinning. Bind pose in md5 is final, absolute position and rotations, you just need to do computations for weights which are joint dependent. I tried to implement GPU skinning but i am stuck at a point. Since these coordinates are final, why can't i just convert my 3d vectors and quaternions into a matrix and just upload it to the shader ? As I have read here : http://3dgep.com/?p=1356 , i need to multiply my skeleton with inverse of the bind pose.

glsl infinity constant

南笙酒味 提交于 2019-12-01 15:16:13
Does GLSL have any pre-defined constants for +/-infinity or NaN? I'm doing this as a workaround but I wonder if there is a cleaner way: // GLSL FRAGMENT SHADER #version 410 <snip> const float infinity = 1. / 0.; void main () { <snip> } I am aware of the isinf function but I need to assign infinity to a variable so that does not help me. Jan Rüegg Like Nicol mentioned, there are no pre-defined constants. However, from OpenGL 4.1 on, your solution is at least guaranteed to work and correctly generate an infinite value. See for example in glsl 4.4 : 4.7.1 Range and Precision ... However, dividing

Noise Algorithm fails in Samsung Galaxy SIII (GLES)

假如想象 提交于 2019-12-01 15:02:36
问题 I am struggling to get the next simple algorithm working in the Samsung Galaxy SIII float rand(vec2 co) { return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453); } .... vec3 color = texture2D(u_texture, v_texcoord); gl_FragColor.rgb = color + vec3(rand(gl_FragCoord.xy + time / 1000.0)); .... The code generates perfectly the expected noise in Samsung Galaxy S1 and Google Nexus S. But it fails completely in the new smartphone which uses ARM's Mali-400/MP4. Anyone can spot anything

glsl infinity constant

[亡魂溺海] 提交于 2019-12-01 14:03:16
问题 Does GLSL have any pre-defined constants for +/-infinity or NaN? I'm doing this as a workaround but I wonder if there is a cleaner way: // GLSL FRAGMENT SHADER #version 410 <snip> const float infinity = 1. / 0.; void main () { <snip> } I am aware of the isinf function but I need to assign infinity to a variable so that does not help me. 回答1: Like Nicol mentioned, there are no pre-defined constants. However, from OpenGL 4.1 on, your solution is at least guaranteed to work and correctly

Speed of cos() and sin() function in GLSL shaders?

不问归期 提交于 2019-12-01 13:52:01
问题 I'm interested in information about the speed of sin() and cos() in Open GL Shader Language . The GLSL Specification Document indicates that: The built-in functions basically fall into three categories: ... ... They represent an operation graphics hardware is likely to accelerate at some point. The trigonometry functions fall into this category. EDIT: As has been pointed out, counting clock cycles of individual operations like sin() and cos() doesn't really tell the whole performance story.

GLSL: Built-in attributes not accessible for iPhone Apps?

天大地大妈咪最大 提交于 2019-12-01 13:04:18
I am getting really desperate here. I working with Xcode, trying to implement some OpenGL stuff on the iPhone. I have to write a Shader for Phong-Lighting. I got as far as declaring my geometry (vertices, indices, calculating etc.) and passing the respective arguments as attributes to the shader (written in GLSL). Using these attributes works fine, some really basic shader programs compile correctly and give the expected output. Now I'm trying to start with some more advanced calculations, for which I need to use some of the built-in attributes of GLSL, namely i.e. the "gl_NormalMatrix", but

OpenGL es 2.0 Gaussian blur on triangle

与世无争的帅哥 提交于 2019-12-01 12:22:31
I recently learn opengl es 2.0, and now I try to make a gaussian blur on triangles generate by myself. I have some difficult to understand examples on the web and most apply the blur on an image. I know I have to use framebuffer but I don't know how to draw triangle on this and apply blur. Is it possible to see a real and complete code in C++ with good explication ? EDIT : #include <stdio.h> #include <stdlib.h> #include <iostream> #define GLFW_INCLUDE_ES2 #include <GLFW/glfw3.h> #include "shaders.hpp" #include "camera.hpp" unsigned int vbo, cbo, tbo; GLuint _fbo, _fbo2, _tex, _tex2; static

GLSL: Built-in attributes not accessible for iPhone Apps?

為{幸葍}努か 提交于 2019-12-01 12:02:08
问题 I am getting really desperate here. I working with Xcode, trying to implement some OpenGL stuff on the iPhone. I have to write a Shader for Phong-Lighting. I got as far as declaring my geometry (vertices, indices, calculating etc.) and passing the respective arguments as attributes to the shader (written in GLSL). Using these attributes works fine, some really basic shader programs compile correctly and give the expected output. Now I'm trying to start with some more advanced calculations,

GPU ray casting (single pass) with 3d textures in spherical coordinates

好久不见. 提交于 2019-12-01 11:33:11
i' am implementing an algorithm of volume rendering "GPU ray casting single pass". For this, i used a float array of intensity values as 3d textures ( this 3d textures describes a regular 3d grid in spherical coordinates ). Here there are example of array values: 75.839354473071637, 64.083049468866022, 65.253933716444365, 79.992431196592577, 84.411485976957096, 0.0000000000000000, 82.020319431382831, 76.808403454586994, 79.974774618246158, 0.0000000000000000, 91.127273013466336, 84.009956557448433, 90.221356094672814, 87.567422484025627, 71.940263118478072, 0.0000000000000000, 0

GLSL Spinlock Never Terminates

北战南征 提交于 2019-12-01 11:21:32
I'm trying to implement a GLSL spinlock to be able to implement single-pass depth peeling. I'm having trouble because examples of locking texture use are scarce. I have to admit that I don't really know what I'm doing, here, so I describe probably more context than is necessary, just to be safe. I wrote a fragment program which should do effectively nothing: #version 420 core //The lock texture holds either 0 or 1. //0 means that the texture is available. //1 means that the texture is locked. layout(r32ui) coherent uniform uimage2D img2D_0; //locking texture layout(RGBA32F) coherent uniform