English 中文(简体)
任何建议 • 如何用透镜实施西格马透镜
原标题:Any Idea How to Implement the Sigma lens with vertex shader

我正试图在开放式广播公司使用过滤器实施Sigma Lens,但有一些问题。

我把文字坐标通过至垂直的斜线,并试图为重点领域和转型区域进行空间转变。 但这只是表面上的形象。

这里是“垂直”法。

in vec4 vVertex;
in vec2 vTexCoord;
//in vec4 vNormal;

uniform mat4   mvpMatrix;
//uniform mat4   mvMatrix;
//uniform mat4   normalMatrix;
uniform float  mm;
uniform float  mouseX;
uniform float  mouseY;

// Texture Coordinate to fragment program
smooth out vec2 vVaryingTexCoord;
smooth out vec2 vVaryingcolorCoord;

void main(void) 
    {
    // Pass on the texture coordinates 
    //vVaryingTexCoord = vTexCoord;
    vec2 m = vec2(mouseX,mouseY);
    vec2 pos = vec2(vTexCoord.s,vTexCoord.t);
    if (distance(pos.xy, m.xy) <=0.1) {
        vVaryingcolorCoord.s = m.x + (pos.x-m.x)/mm;
        vVaryingcolorCoord.t = m.y + (pos.y-m.y)/mm;

    }
    else if(0.1 < distance(pos.xy, m.xy) && distance(pos.xy, m.xy) <= 0.2){
        vVaryingcolorCoord.s = m.x + (pos.x-m.x)/0.8;
        vVaryingcolorCoord.t = m.y + (pos.y-m.y)/0.8;

    }
    else {
     vVaryingcolorCoord.st=vTexCoord.st;

    }

    gl_Position = mvpMatrix * vVertex;
   }

如果没有一件事,我刚刚开始学习开放和自由职业学校,因此,请大家发表意见。

感谢

问题回答

如果没有使用《开放式利比里亚法典》,这种螺旋就没有什么意义。 我怀疑什么是错的,但我可以不作成法典。





相关问题
Modern OpenGL colors

I noticed old code has GL_AMBIENT, GL_DIFFUSE, GL_SPECULAR etc. inputs with glMaterialfv. How are those replaced in modern GLSL code? e.g. Assuming a library importing models (Assimp) gives direct ...

OpenGL 4.x learning resources [closed]

I know there are some question about learning OpenGL. Here is what I know: math for 3D 3D theory Here is what I want to know: - OpenGL 4.0 Core profile (or latter) - Shader Language 400 (or latter)...

Porting a project to OpenGL3

I m working on a C++ cross-platform OpenGL application (Windows, Linux and MacOS) and I am wondering if some of you could share some advices on porting a large application to OpenGL 3. The reason I am ...

Which OpenGL functions are not GPU-accelerated?

I was shocked when I read this (from the OpenGL wiki): glTranslate, glRotate, glScale Are these hardware accelerated? No, there are no known GPUs that execute this. The driver computes ...

New to OpenGL and deprecation [closed]

I ve begun playing around with OpenGL in Python using PyOpenGL 3.0.1b. I looked at some sample code and started running it and modifying it etc. All was well until I became a little less ignorant. ...

热门标签