glsl

Apply Projection on half of texture

我的梦境 提交于 2019-12-24 06:16:31
问题 I'm using three glcontrols say GlControl1, GlControl2, GlControl3. And I have two textures stexture1 and stexture2. Where stexture1 is displaying in glcontrol2. And right half portion of stexture2 is displaying on glcontrol1 and left half is dispalying on glcontrol3. Now I want to apply projection on these three glcontrols. Using this link I can apply it successfully on glcontrol2 since it is displaying the texture fully. But when applying on glcontrol1 and glcontrol3 it is not working well.

Algorithm for creating fisheye effect from a normal image

喜你入骨 提交于 2019-12-24 04:49:09
问题 I am trying to create an OpenGL fragment shader that converts a normal image to an image that contains fish eye effect. This is what i mean by fish eye affect (http://www.marcofolio.net/photoshop/create_a_fish_eye_lens_effect_in_photoshop.html). By normal image i mean a rendered image taken from a virtual camera in a 3d interactive environment, not an image taken from a real camera, but i guess that doesnt really make much difference in terms of this problem. Does anyone have any idea how

OpenGL Bindless Textures: Bind to uniform sampler2D array

血红的双手。 提交于 2019-12-24 03:02:15
问题 I am looking into using bindless textures to rapidly display a series of images. My reference is the OpenGL 4.5 redbook. The book says I can sample bindless textures in a shader with this fragment shader: #version 450 core #extension GL_ARB_bindless_texture : require in FS_INPUTS { vec2 i_texcoord; flat int i_texindex; }; layout (binding = 0) uniform ALL_TEXTURES { sampler2D fs_textures[200]; }; out vec4 color; void main(void) { color = texture(fs_textures[i_texindex], i_texcoord); }; I

GLSL: shader linking fail (but no log)

霸气de小男生 提交于 2019-12-24 01:54:16
问题 I'm trying to create a little shader for brightness and contrast of the window (that I've seen here). I can load the file, and compile the shader successfully. But I fail to link it. My problem is that the log has no output, so I can't see what's wrong with it. How can I check the linking problem? Where can I find informations about linking failing, and check why linking can fail (I'm new to shaders). I'm using Ubuntu 12.04. This is the initialization code if (GLEW_ARB_fragment_shader) { // I

GLSL: shader linking fail (but no log)

感情迁移 提交于 2019-12-24 01:54:14
问题 I'm trying to create a little shader for brightness and contrast of the window (that I've seen here). I can load the file, and compile the shader successfully. But I fail to link it. My problem is that the log has no output, so I can't see what's wrong with it. How can I check the linking problem? Where can I find informations about linking failing, and check why linking can fail (I'm new to shaders). I'm using Ubuntu 12.04. This is the initialization code if (GLEW_ARB_fragment_shader) { // I

Fragment shader without gl_FragColor explicitly set?

人盡茶涼 提交于 2019-12-24 01:54:09
问题 Is not writing anything to gl_FragColor defined as equivalent of doing a discard or simply setting gl_FragColor to vec4(0, 0, 0, 0) ? (For the record, I'm asking this as I'm creating shaders which only writes to gl_FragDepth, for lighting purposes.) 回答1: From the GLSL 4.5 specs... The following fragment output variables are available in a fragment shader when using the compatibility profile: out vec4 gl_FragColor; out vec4 gl_FragData[gl_MaxDrawBuffers]; Writing to gl_FragColor specifies the

Fragment shader without gl_FragColor explicitly set?

泄露秘密 提交于 2019-12-24 01:53:57
问题 Is not writing anything to gl_FragColor defined as equivalent of doing a discard or simply setting gl_FragColor to vec4(0, 0, 0, 0) ? (For the record, I'm asking this as I'm creating shaders which only writes to gl_FragDepth, for lighting purposes.) 回答1: From the GLSL 4.5 specs... The following fragment output variables are available in a fragment shader when using the compatibility profile: out vec4 gl_FragColor; out vec4 gl_FragData[gl_MaxDrawBuffers]; Writing to gl_FragColor specifies the

Problem with Parallax Normal Mapping in Opengl , GLSL

雨燕双飞 提交于 2019-12-24 00:36:54
问题 I've got a terrible issue with parallax normal mapping and I don't know what can be the problem. (OpenGL 2.0, C++, WinXP) My results: (green are normals, blue are tangents and red are binormals (bitangents) ) Normal mapping is working fine so I assume the tangent vectors are good. The weird thing is, on some walls of cube, parallax mapping is done correctly and in others it is not. I'm sure my GLSL code is OK because I copied it from http://www.dhpoware.com/demos/index.html where you can find

opengl texture mapping off by 5-8 pixels

爱⌒轻易说出口 提交于 2019-12-23 20:56:21
问题 I've got a bunch of thumbnails/icons packed right up next to each other in a texture map / sprite sheet. From a pixel to pixel relationship, these are being scaled up from being 145 pixels square to 238 screen pixels square. I was expecting to get +-1 or 2 pixel accuracy on the edges of the box when accessing the texture coordinates, so I'm also drawing a 4 pixel outline overtop of the thumbnail to hide this probable artifact. But I'm seeing huge variations in accuracy. Sometimes it's off in

How do I query the alignment/stride for an SSBO struct?

 ̄綄美尐妖づ 提交于 2019-12-23 18:48:04
问题 I'm not sure which structure layout is most suited for my application: shared , packed , std140 , std430 . I'm not asking for an explanation of each, that information is easy to find, it's just hard to figure out the impact each will have on vendor compatibility/performance. If shared is the default, I'm suspecting that's a good starting point. From what I can gather, I have to query the alignment/offsets when using shared or packed , because it's implementation specific. What's the API for