您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ texture2D函数代码示例

51自学网 2021-06-03 08:47:28
  C++
这篇教程C++ texture2D函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中texture2D函数的典型用法代码示例。如果您正苦于以下问题:C++ texture2D函数的具体用法?C++ texture2D怎么用?C++ texture2D使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了texture2D函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: main

            void main(void)            {                vec4 origColor = texture2D(otex, gl_TexCoord[0].st);                vec4 raysColor = texture2D(rtex, gl_TexCoord[0].st);                if (lightDirDOTviewDir>0.0){                    float exposure	= 0.1/float(NUM_SAMPLES);                    float decay		= 1.0 ;                    float density	= 0.5;                    float weight	= 6.0;                    float illuminationDecay = 1.0;                    vec2 deltaTextCoord = vec2( gl_TexCoord[0].st - lightPositionOnScreen);                    vec2 textCoo = gl_TexCoord[0].st;                    deltaTextCoord *= 1.0 / float(NUM_SAMPLES) * density;                    for(int i=0; i < NUM_SAMPLES ; i++)                    {                        textCoo -= deltaTextCoord;                        vec4 tsample = texture2D(rtex, textCoo );                        tsample *= illuminationDecay * weight;                        raysColor += tsample;                        illuminationDecay *= decay;                    }                    raysColor *= exposure * lightDirDOTviewDir;                    float p = 0.3 *raysColor.g + 0.59*raysColor.r + 0.11*raysColor.b;                    gl_FragColor = origColor + p;                } else {                    gl_FragColor = origColor;                }            }
开发者ID:CLOUDS-Interactive-Documentary,项目名称:ofxPostProcessing,代码行数:33,


示例2: main

void main()	{		vec4 heightRT = texture2D( u_Texture0, v_TexCoords );	vec4 normRT = texture2D( u_Texture1, v_TexCoords );	vec3 baseNorm = (normRT.rgb-0.5)*2.0;	baseNorm.z = 0.0;	baseNorm = normalize(baseNorm);	vec3 faceNorm = vec3(0.0,0.0,1.0);	float curDis = heightRT.b;	float maxDis = 128.0/255.0;	float startZ = 0.0;	float endZ = 1.0;	float lerpPow = 2.0;	float lerpAmount = max(maxDis-curDis,0.0)/maxDis;		/*	// sharp bevel	lerpAmount = 0.5;	if (curDis >= 80.0/255.0) {		lerpAmount = 0.0;	}*/	if (curDis <= 16.0/255.0) {		lerpAmount = 1.0;	}	vec3 finalNorm = mix(faceNorm, baseNorm, lerpAmount );	finalNorm = normalize(finalNorm);	float alphaVal = heightRT.g;		if (alphaVal == 0.0) {		discard;	}		vec4 gIdRGBA;	float groupId = v_Data0.z;	gIdRGBA.rg = pack16(groupId);	//gIdRGBA.r = floor(groupId/256.0)/255.0;	//gIdRGBA.g = mod(groupId,256.0)/255.0;	float matId = v_Data0.w;	gIdRGBA.ba = pack16(matId);	//gIdRGBA.b = floor(matId/256.0)/255.0;	//gIdRGBA.a = mod(matId,256.0)/255.0;		gl_FragColor = gIdRGBA;		}
开发者ID:BrendanBuono,项目名称:voxelquestiso,代码行数:60,


示例3: main

void main() {    // pages    vec4 tex0 = texture2D(Texture0, TexCoord0 );    vec4 tex1 = texture2D(Texture1, TexCoord0 );    // geom    vec4 tex2 = texture2D(Texture2, TexCoord0 );    vec4 tex3 = texture2D(Texture3, TexCoord0 );    float bh1 = unpack16(tex0.rg);    float bh2 = unpack16(tex2.rg);    vec4 res0 = vec4(0.0);    vec4 res1 = vec4(0.0);    if (bh2 > bh1) {        res0 = tex2;        res1 = tex3;    }    else {        res0 = tex0;        res1 = tex1;    }    gl_FragData[0] = res0;    gl_FragData[1] = res1;}
开发者ID:CodeMason,项目名称:voxelquestiso,代码行数:32,


示例4: main

void main()/n/{/n/	vec4 diffuse = texture2D(texture1, st);/n/	vec4 position = texture2D(texture2, st);/n/	vec4 normal = texture2D(texture3, st);/n/	vec3 light = vec3(50,100,50);/n/	vec3 lightDir = light - position.xyz ;/n/	/n/	float blurSize_x = 1.0/100.0;/n/	float blurSize_y = 1.0/80.0;/n//n/	vec4 sum = vec4(0);/n/	vec2 size = vec2(800,600);/n/int samples = 20; /n/float quality =4.0; /n/  int diff = (samples - 1) / 2;/n/  vec2 sizeFactor = vec2(1) / size * quality;/n/  /n/  for (int x = -diff; x <= diff; x++)/n/  {/n/    for (int y = -diff; y <= diff; y++)/n/    {/n/      vec2 coordinate = st + vec2(x, y) * sizeFactor;/n/      coordinate.x = clamp(coordinate.x, 0.0, 1.0);/n/      coordinate.y = clamp(coordinate.y, 0.0, 1.0);/n/      sum += texture2D(texture4, coordinate);/n/    }/n/  }/n/  sum = sum / (samples*samples);/n//n/	diffuse = diffuse*(1.0 - sum.a);/n/	finalColor = diffuse+sum;/n/}";
开发者ID:jonasstrandstedt,项目名称:infvisGL,代码行数:33,


示例5: main

void main () {        vec4  texel  = texture2D(sampler, gl_FragCoord.xy / resolution);    vec2 coords  = vec2(gl_FragCoord.x, (resolution.y - gl_FragCoord.y)) / resolution;        if( (coords.x >= clip.s && coords.y >= clip.t) &&        (coords.x <= clip.p && coords.y <= clip.q) )    {        vec4 clap = clip; clap.tq -= offset.y / count.t;                vec2 coords  = (coords - clap.st) / (clap.pq - clap.st);                vec4 glyph   = texture2D(text, vec2(            coords.x,            (coords.y * ( count.t / count.p))        ));                texel        = texture2D(glyphs, vec2(                        ( glyph.p - glyph.s ) * fract( (coords.x + offset.x) * count.s ) + glyph.s,                        ( glyph.q - glyph.t ) * fract( coords.y * count.t ) + glyph.t                      ));                gl_FragColor = vec4(1., 1., 1., texel.a);            }    else        gl_FragColor = texture2D(texture, gl_FragCoord.xy / resolution);    }
开发者ID:oddmarthon-lende,项目名称:vrt,代码行数:29,


示例6: QT_STRINGIFY

    const char *fragmentShader() const {        return QT_STRINGIFY(            const int numberOfLights = 5;            varying mediump vec2 qt_TexCoord0;            varying mediump vec3 lightVecTangent[numberOfLights];            uniform mediump float qt_Opacity;            uniform mediump float lightIntensities[numberOfLights];            uniform sampler2D sourceImage;            uniform sampler2D normalsImage;            void main(void) {                mediump vec2 pixPos = qt_TexCoord0;                mediump vec4 pix = texture2D(sourceImage, pixPos.st);                mediump vec4 pix2 = texture2D(normalsImage, pixPos.st);                mediump vec3 normal = vec3(pix2.rg * 2.0 - 1.0, pix2.b);                mediump float diffuse = 0.66;                // Unroll the loop, my HD3000 doesn't like non-const array lookups.                mediump vec3 relVec;                relVec = normalize(lightVecTangent[0]);                diffuse += lightIntensities[0] * 0.4 * dot(normal, relVec);                relVec = normalize(lightVecTangent[1]);                diffuse += lightIntensities[1] * 0.4 * dot(normal, relVec);                relVec = normalize(lightVecTangent[2]);                diffuse += lightIntensities[2] * 0.4 * dot(normal, relVec);                relVec = normalize(lightVecTangent[3]);                diffuse += lightIntensities[3] * 0.4 * dot(normal, relVec);                relVec = normalize(lightVecTangent[4]);                diffuse += lightIntensities[4] * 0.4 * dot(normal, relVec);                diffuse = clamp(diffuse, 0.0, 1.0);                mediump vec4 color = vec4(diffuse * pix.rgb, pix.a);                gl_FragColor = color * qt_Opacity;            }
开发者ID:MidoriYakumo,项目名称:touchockey,代码行数:35,


示例7: GLSL_STRING

string GaussianBlurFilter::_getFragSrc() {    return GLSL_STRING(120,        uniform sampler2D texture0;        uniform float blurSize;        uniform float bloom;        uniform float texelWidthOffset;        uniform float texelHeightOffset;        void main() {        float v;        float pi = 3.141592653589793;        float radius = blurSize;        if ( radius < 0 ) radius = 0;        int steps = int(min(radius * 0.7, sqrt(radius) * pi));        float r = radius / steps;        float t = bloom / (steps * 2 + 1);        float x = gl_TexCoord[0].x;        float y = gl_TexCoord[0].y;        vec4 sum = texture2D(texture0, vec2(x, y)) * t;        int i;        for(i = 1; i <= steps; i++){            v = (cos(i / (steps + 1) / pi) + 1) * 0.5;            sum += texture2D(texture0, vec2(x + i * texelWidthOffset * r, y + i * texelHeightOffset * r)) * v * t;            sum += texture2D(texture0, vec2(x - i * texelWidthOffset * r, y - i * texelHeightOffset * r)) * v * t;        }        gl_FragColor = sum;    }
开发者ID:chemabc,项目名称:ofxFilterLibrary,代码行数:29,


示例8: main

            void main(void){                float dxtex = 1.0 / textureSizeX;                float dytex = 1.0 / textureSizeY;                vec2 st = gl_TexCoord[0].st;                // access center pixel and 4 surrounded pixel                vec3 center = getNormal(st).rgb;                vec3 left = getNormal(st + vec2(dxtex, 0.0)).rgb;                vec3 right = getNormal(st + vec2(-dxtex, 0.0)).rgb;                vec3 up = getNormal(st + vec2(0.0, -dytex)).rgb;                vec3 down = getNormal(st + vec2(0.0, dytex)).rgb;                // discrete Laplace operator                vec3 laplace = abs(-4.0*center + left + right + up + down);                // if one rgb-component of convolution result is over threshold => edge                vec4 line = texture2D(normalImage, st);                if(laplace.r > normalEdgeThreshold                || laplace.g > normalEdgeThreshold                || laplace.b > normalEdgeThreshold){                    line = vec4(0.0, 0.0, 0.0, 1.0); // => color the pixel green                } else {                    line = vec4(1.0, 1.0, 1.0, 1.0); // black                }                //end Line;                //start Phong                //vec3 lightPosition = vec3(100.0, 100.0, 50.0);                vec3 lightPosition = gl_LightSource[0].position.xyz;                vec3 L = normalize(lightPosition - v);                vec3 E = normalize(-v);                vec3 R = normalize(-reflect(L,N));                // ambient term                vec4 Iamb = ambient;                // diffuse term                vec4 Idiff = texture2D( normalImage, gl_TexCoord[0].st) * diffuse;                //vec4 Idiff = vec4(1.0, 1.0, 1.0, 1.0) * diffuse;                Idiff *= max(dot(N,L), 0.0);                Idiff = clamp(Idiff, 0.0, 1.0);                // specular term                vec4 Ispec = specular;                Ispec *= pow(max(dot(R,E),0.0), shinyness);                Ispec = clamp(Ispec, 0.0, 1.0);                                 vec4 color = Iamb + Idiff;                if ( bSpecular == 1 ) color += Ispec;                // store previous alpha value                float alpha = color.a;                // quantize process: multiply by factor, round and divde by factor                color = floor(0.5 + (qLevel * color)) / qLevel;                // set fragment/pixel color                color.a = alpha;                gl_FragColor = color * line;            }
开发者ID:0401morita,项目名称:ofxPostProcessing,代码行数:60,


示例9: main

void main(void)/{/ vec4 shared=texture2D(TexUnit2, vec2(gl_TexCoord[2]));/ vec4 pantalla=texture2D(TexUnit0, vec2(gl_TexCoord[0]));/ vec4 blur=texture2D(TexUnit1, vec2(gl_TexCoord[1]))*producto*shared.rrrr;/ gl_FragColor = pantalla*blur*addormultiply + ((pantalla+blur)*(1.0-addormultiply));/}";
开发者ID:imclab,项目名称:rgba,代码行数:7,


示例10: main

void main (void) {  vec4 texcolor=gl_Color;  vec4 finalcolor;  float fShadowFactor=1.0;  float specfactor=1.0;  #ifdef ENABLE_TEXTURES  #ifdef ENABLE_WATER  ApplyWaterEffect(Texture0,gl_TexCoord[0].xy,texcolor.xyz);  #else    texcolor*= texture2D(Texture0, gl_TexCoord[0].xy);  #endif	#if TEXTURE_UNITS > 1		#ifdef ENABLE_WATER			vec3 temptexunit1;			ApplyWaterEffect(Texture1,gl_TexCoord[1].xy,temptexunit1);			texcolor.rgb*=temptexunit1;		#else		texcolor*= texture2D(Texture1, gl_TexCoord[1].xy);		#endif	#endif#endif    #ifdef ENABLE_SHADOWS	fShadowFactor=shadow2DProj(ShadowMap, gl_TexCoord[SHADOW_TEXTURE_LEVEL]).r;	#ifdef ENABLE_SOFT_SHADOWS		float offset=3.0;		fShadowFactor+=shadow2DProj(ShadowMap,gl_TexCoord[SHADOW_TEXTURE_LEVEL]+vec4(-offset,-offset,0,0)).g;		fShadowFactor+=shadow2DProj(ShadowMap,gl_TexCoord[SHADOW_TEXTURE_LEVEL]+vec4(offset,-offset,0,0)).g;		fShadowFactor+=shadow2DProj(ShadowMap,gl_TexCoord[SHADOW_TEXTURE_LEVEL]+vec4(-offset,offset,0,0)).g;		fShadowFactor+=shadow2DProj(ShadowMap,gl_TexCoord[SHADOW_TEXTURE_LEVEL]+vec4(offset,offset,0,0)).g;		fShadowFactor/=5.0;	#endif  #endif	  #ifdef ENABLE_LIGHTING	  vec4 sunambdiffspec=g_sunambdiffspec;      #ifdef ENABLE_SKY_SHADOW		sunambdiffspec*=1.0-(texture2D(SkyShadowMap, gl_TexCoord[SKY_TEXTURE_LEVEL].xy)*SkyData.a);	  #endif	  finalcolor.rgb=clamp(g_ambdiffspec.rgb+sunambdiffspec.rgb*fShadowFactor,0.0,LIGHTING_SATURATION);	  finalcolor.rgb*=texcolor.rgb;	  finalcolor.a=texcolor.a;  #else	#ifdef ENABLE_SKY_SHADOW	  fShadowFactor*=1.0-(texture2D(SkyShadowMap, gl_TexCoord[SKY_TEXTURE_LEVEL].xy)*SkyData.a).r;	#endif	finalcolor=texcolor*fShadowFactor;  #endif	    #ifdef ENABLE_FOG	finalcolor= vec4(clamp(finalcolor.rgb, 0.0, 1.0),finalcolor.a);	finalcolor.rgb=mix(finalcolor.rgb,gl_Fog.color.rgb,g_fFogFactor);  #endif	gl_FragColor=finalcolor;}
开发者ID:theclai,项目名称:friking-shark,代码行数:59,


示例11: dHdxy_fwd

// Derivative maps - bump mapping unparametrized surfaces by Morten Mikkelsen//	http://mmikkelsen3d.blogspot.sk/2011/07/derivative-maps.html// Evaluate the derivative of the height w.r.t. screen-space using forward differencing (listing 2)vec2 dHdxy_fwd() {  vec2 dSTdx = dFdx( vUv );  vec2 dSTdy = dFdy( vUv );  float hll = bumpScale * texture2D( tDisplacement, vUv ).x;  float dBx = bumpScale * texture2D( tDisplacement, vUv + dSTdx ).x - hll;  float dBy = bumpScale * texture2D( tDisplacement, vUv + dSTdy ).x - hll;  return vec2( dBx, dBy );}
开发者ID:jeremy-brooks,项目名称:ng-3d-vis,代码行数:11,


示例12: main

	void main()	{		vec4 redColor   = texture2D(texture, fragmentTextureCoordinate.xy - redOffset   + vec2(0.5,0.5));		vec4 greenColor = texture2D(texture, fragmentTextureCoordinate.xy - greenOffset + vec2(0.5,0.5));		vec4 blueColor  = texture2D(texture, fragmentTextureCoordinate.xy - blueOffset  + vec2(0.5,0.5));		gl_FragColor = vec4(redColor.r, greenColor.g, blueColor.b, (redColor.a + greenColor.a + blueColor.a)/3.);	}
开发者ID:AlexanderMazaletskiy,项目名称:vuo,代码行数:8,


示例13: main

void main(void){    float toneFactor = 1.0;///2.0;        vec4 mapC = texture2D(uMapKd, vTexCoordinate);    vec4 shad = texture2D(uMapShadow, vTexCoordinate)*toneFactor;       gl_FragColor = mapC * shad + shad * (shad.w - 1.0)*mapC.w; } 
开发者ID:arkhael,项目名称:hyperion-renderer,代码行数:9,


示例14: main

	void main(void)	{		vec4 color = texture2D(texture, fragmentTextureCoordinate.xy);		vec4 maskColor = texture2D(mask, fragmentTextureCoordinate.xy);		float maskAmount = maskColor.a * rgbToHsl(maskColor.rgb).z;		color.rgb *= maskAmount;		color.a = maskAmount;		gl_FragColor = color;	}
开发者ID:AlexanderMazaletskiy,项目名称:vuo,代码行数:9,


示例15: main

void main(void){     vec4 tv4Position = texture2D(uMapPosition, vTexCoordinate);            vec4 shadowProj =  uShadowMatrix * vec4(tv4Position.xyz, 1.0);        shadowProj /= shadowProj.w;				if ( abs(shadowProj.x) < 1.0 && abs(shadowProj.y) < 1.0 && abs(shadowProj.z) < 1.0 )	{        vec2 shadowSample = vec2( (shadowProj.x+1.0)/2.0, (shadowProj.y+1.0)/2.0 );        float shadowVal = 0.0;        float count = 0.0;        //float x, y;                for (float y = -1.5; y <= 1.5; y += 1.0)        {            for (float x = -1.5; x <= 1.5; x += 1.0)            {                vec4 t4Shadow    = texture2D(uMapShadow,                                              vec2( shadowSample.x + x/1024.0,                                                    shadowSample.y + y/1024.0) ); // assuming a 1024 by 1024 shadow map                                if ( t4Shadow.x - shadowProj.z > -0.0000 )                {                    shadowVal += 1.0;                 }                 else                {                    float variance = t4Shadow.y - (t4Shadow.x*t4Shadow.x);                    variance = max(variance,0.0000002);                                        float d = shadowProj.z - t4Shadow.x;                    float p_max = variance / (variance + d*d);                                    shadowVal += p_max;                }                                 count += 1.0;            }        }                shadowVal = shadowVal/count;                gl_FragColor = vec4(shadowVal);    }    else    {        vec4 pingColor   = texture2D( uMapPing,    vTexCoordinate);        gl_FragColor = pingColor;    }} 
开发者ID:arkhael,项目名称:hyperion-renderer,代码行数:56,


示例16: main

void main()	{	vec2 newTC = mod(v_TexCoords*4.0,2.0)/2.0;	vec2 newTC2 = v_TexCoords;	newTC2.y = 1.0-newTC2.y;	vec4 baseval = texture2D( u_Texture0, newTC );	vec4 basevalo = texture2D( u_Texture0, v_TexCoords );		float res;	vec4 res2;	if (u_Section == 0.0) {		if (newTC2.x < 0.5 && newTC2.y < 0.5 ) {			res = baseval.r;			res2 = vec4(1.0,0.0,0.0,1.0);		}		if (newTC2.x >= 0.5 && newTC2.y < 0.5 ) {			res = baseval.g;			res2 = vec4(0.0,1.0,0.0,1.0);		}		if (newTC2.x < 0.5 && newTC2.y >= 0.5 ) {			res = baseval.b;			res2 = vec4(0.0,0.0,1.0,1.0);		}		if (newTC2.x >= 0.5 && newTC2.y >= 0.5 ) {			res = baseval.a;			res2 = vec4(1.0,1.0,0.0,1.0);		}		gl_FragColor = mix(vec4(res,res,res,1.0),res2,0.3);	}	if (u_Section == 1.0) {		gl_FragColor = vec4(basevalo.rrr,1.0);	}	if (u_Section == 2.0) {		gl_FragColor = vec4(basevalo.ggg,1.0);	}	if (u_Section == 3.0) {		gl_FragColor = vec4(basevalo.bbb,1.0);	}	if (u_Section == 4.0) {		gl_FragColor = vec4(basevalo.aaa,1.0);	}	if (u_Section == 5.0) {		gl_FragColor = vec4(basevalo.rgb,1.0);	}		}
开发者ID:BrendanBuono,项目名称:voxelquestiso,代码行数:55,


示例17: main

void main(){																											/n/																														/n/	vec2 diff=gl_TexCoord[0].st-origin;																					/n/	float distSq=dot(diff,diff);																						/n/	float t=radius*radius*texScaled*texScaled;																			/n/	if(distSq<t){																										/n/		gl_FragColor=vec4(impulseColor*impulseStrength+texture2D(tex,gl_TexCoord[0].st).xyz*(1.0-impulseStrength),1.0);	/n/	}else{																												/n/		gl_FragColor=vec4(texture2D(tex,gl_TexCoord[0].st).xyz,1.0);													/n/	}																													/n/}																														/n/
开发者ID:yluo1,项目名称:Liquidus,代码行数:11,


示例18: main

void main()	{	vec4 baseval00 = texture2D( u_Texture0, v_TexCoords );	vec4 baseval01 = texture2D( u_Texture0, v_TexCoords+vec2(0.0/u_TexResolution.x,1.0/u_TexResolution.y) );	vec4 baseval10 = texture2D( u_Texture0, v_TexCoords+vec2(1.0/u_TexResolution.x,0.0/u_TexResolution.y) );	vec4 baseval11 = texture2D( u_Texture0, v_TexCoords+vec2(1.0/u_TexResolution.x,1.0/u_TexResolution.y) );    gl_FragColor = (baseval00+baseval01+baseval10+baseval11)/4.0;}
开发者ID:BrendanBuono,项目名称:voxelquestiso,代码行数:11,


示例19: main

void main() {    vec3 pos = texture2D(tPositions, vUv).xyz;    vec3 vel = texture2D(tVelocities, vUv).xyz;    pos.x += vel.x;    pos.y += vel.y;    pos.z += vel.z;    // Write new position out    gl_FragColor = vec4(pos, 1.0);}
开发者ID:jacqt,项目名称:audioviz,代码行数:11,


示例20: main

	void main()	{		vec4 base = texture2D(background, fragmentTextureCoordinate.xy);		vec4 blend = texture2D(foreground, fragmentTextureCoordinate.xy);		vec3 result = vec3( mix(base.r, blend.r, blend.a),							mix(base.g, blend.g, blend.a),							mix(base.b, blend.b, blend.a) );		gl_FragColor = vec4( mix(base.rgb, result, foregroundOpacity), base.a + blend.a * foregroundOpacity);	}
开发者ID:bradparks,项目名称:vuo,代码行数:11,


示例21: main

void main() {        vec4 tex0 = texture2D( Texture0, (TexCoord0.xy + paramArrMap[8].xy) );    vec4 tex1 = texture2D( Texture1, (TexCoord0.xy + paramArrMap[9].xy)*mapSampScale );    vec4 tex2 = texture2D( Texture2, (TexCoord0.xy + paramArrMap[10].xy)*mapSampScale );    float[6] sv;    float[6] vals;    vals[0] = tex1.r;    vals[1] = tex1.g;    vals[2] = tex1.b;    vals[3] = tex2.r;    vals[4] = tex2.g;    vals[5] = tex2.b;    int i;    int j;    int curInd = -1;    for (i = 0; i < 6; i++) {        sv[i] = vals[int(paramArrMap[i].x)];    }    float v0 = sv[0]*tex0.r;//*tex0.r;    float v1 = sv[1]*tex0.g;//*tex0.g;    float v2 = sv[2]*tex0.b;//*tex0.b;    //float h = sqrt(v0 + v1 + v2);    float h = pow(max(max(v0,v1),v2),0.4);    //h *= 2.0;    //(v0*v1*v2)*0.75+0.25;//            // if (h > 1.0) {    //     h = 2.0-h;    // }    h = pow(h,1.5);    h = clamp(h, 0.0, 1.0);        gl_FragData[0] = vec4(h,0.0,0.0,0.0);}
开发者ID:BrendanBuono,项目名称:voxelquestiso,代码行数:53,


示例22: main

 void main() {/     if (isDepth) {/         float n = clipPlanes.x;/         float f = clipPlanes.y;/         float z = texture2D(texture, texCoord).x;/         z = (2.0 * n) / (f + n - z * (f - n));/         gl_FragColor = vec4(z,z,z,1.0);/     }/     else {/         gl_FragColor = texture2D(texture, texCoord);/     }/ }/0";
开发者ID:gszauer,项目名称:Shaders,代码行数:12,


示例23: main

void main(void)/n/{/n/    vec3 yuv;/n/    vec3 rgb;/n/    yuv.x = texture2D(tex_y, vec2(TexCoordOut.x*yborder,TexCoordOut.y)).r;/n/    yuv.y = texture2D(tex_u, vec2(TexCoordOut.x*uborder,TexCoordOut.y)).r - 0.5;/n/    yuv.z = texture2D(tex_v, vec2(TexCoordOut.x*vborder,TexCoordOut.y)).r - 0.5;/n/    rgb = mat3( 1,       1,         1,/n/               0,       -0.39465,  2.03211,/n/               1.13983, -0.58060,  0) * yuv;/n/    gl_FragColor = vec4(rgb, 1);/n/}";
开发者ID:JohnCrash,项目名称:ffplayer,代码行数:12,


示例24: main

 void main() / { /     mediump vec3 yuv; /     lowp vec3 rgb; /     yuv.x = texture2D(u_texture,   v_texCoord).r; /     yuv.yz = texture2D(u_texture_u, v_texCoord).ar - 0.5; /     rgb = mat3( 1,        1,       1, /                 0,       -0.39465, 2.03211, /                 1.13983, -0.58060, 0) * yuv; /     gl_FragColor = vec4(rgb, 1); /     gl_FragColor *= u_modulation; / } /
开发者ID:0-wiz-0,项目名称:mame,代码行数:12,


示例25: GLSL_STRING

string DisplacementFilter::_getFragSrc() {    return GLSL_STRING(120,                       uniform float texelWidth;                       uniform float texelHeight;                                              uniform sampler2D inputImageTexture;                       uniform sampler2D inputImageTexture2;                                              void main() {                           vec2 uv = gl_TexCoord[0].xy;                           vec2 offset = texture2D(inputImageTexture2, uv ).xy * vec2(texelWidth, texelHeight);                           gl_FragColor = texture2D(inputImageTexture, uv + offset.xy);                       }
开发者ID:Mat-Loz,项目名称:ofxFilterLibrary,代码行数:13,


示例26: main

			void main()															   /n/			{																	   /n/				if (g_useLighting)												   /n/				{																   /n/					float l = length(v_position.xyz - g_light);					   /n/					float atten = min(2.0, 10.0 / (1.0 + l*1.0 + 0.8*l*l));		   /n/					gl_FragColor = texture2D(s_texture, v_texcoord) * atten;	   /n/				}																   /n/				else															   /n/				{																   /n/					gl_FragColor = texture2D(s_texture, v_texcoord);			   /n/				}																   /n/			}";
开发者ID:AlexMartinelle,项目名称:PicoEngine,代码行数:13,


示例27: main

void main(void){    float toneFactor = 1.0/6.0;///2.0;        vec4 mapC = texture2D(uMapKd, vTexCoordinate);    vec4 light= texture2D(uMapLight, vTexCoordinate);    vec4 shad = texture2D(uMapShadow, vTexCoordinate);        vec4 ambient = mapC * shad * 0.2;        vec4 lightf = light * toneFactor * shad;       gl_FragColor = mapC * lightf + light * (light.w - 1.0)*mapC.w*toneFactor + ambient; } 
开发者ID:AnnaChaldysheva,项目名称:hyperion-renderer,代码行数:14,


示例28: main

void main(void)/{/  if (v[0][1] < 0.5) {/    vec2 n=vec2(fract(sin(dot(z.xy+v[0][0],vec2(12.9898,78.233)))*43758.5453));/	gl_FragColor=texture2D(t,.5*z.xy+.5+.0007*n)+n.x*.02;/  } else {/	vec2 pos = vTexCoord + vec2(-0.000, 0.0);/	gl_FragColor = vec4(0.0);/	for (int i = -0; i <= 0; i++) {/		gl_FragColor += texture2D(t, pos)/1.0;/		pos += vec2(0.000/1.0, 0.0);/	}/  }/}";
开发者ID:chock-mostlyharmless,项目名称:mostlyharmless,代码行数:14,


示例29: GLSL_STRING

string SobelEdgeDetectionFilter::_getFragSrc() {    return GLSL_STRING(120,                       varying vec2 textureCoordinate;                       varying vec2 leftTextureCoordinate;                       varying vec2 rightTextureCoordinate;                                              varying vec2 topTextureCoordinate;                       varying vec2 topLeftTextureCoordinate;                       varying vec2 topRightTextureCoordinate;                                              varying vec2 bottomTextureCoordinate;                       varying vec2 bottomLeftTextureCoordinate;                       varying vec2 bottomRightTextureCoordinate;                                              uniform sampler2D inputImageTexture;                       uniform float edgeStrength;                                              void main() {                           float bottomLeftIntensity = texture2D(inputImageTexture, bottomLeftTextureCoordinate).r;                           float topRightIntensity = texture2D(inputImageTexture, topRightTextureCoordinate).r;                           float topLeftIntensity = texture2D(inputImageTexture, topLeftTextureCoordinate).r;                           float bottomRightIntensity = texture2D(inputImageTexture, bottomRightTextureCoordinate).r;                           float leftIntensity = texture2D(inputImageTexture, leftTextureCoordinate).r;                           float rightIntensity = texture2D(inputImageTexture, rightTextureCoordinate).r;                           float bottomIntensity = texture2D(inputImageTexture, bottomTextureCoordinate).r;                           float topIntensity = texture2D(inputImageTexture, topTextureCoordinate).r;                           float h = -topLeftIntensity - 2.0 * topIntensity - topRightIntensity + bottomLeftIntensity + 2.0 * bottomIntensity + bottomRightIntensity;                           float v = -bottomLeftIntensity - 2.0 * leftIntensity - topLeftIntensity + bottomRightIntensity + 2.0 * rightIntensity + topRightIntensity;                                                      float mag = length(vec2(h, v)) * edgeStrength;                                                      gl_FragColor = vec4(vec3(mag), 1.0);                       }
开发者ID:Mat-Loz,项目名称:ofxFilterLibrary,代码行数:33,


示例30: main

void main(){  vec4 splatRec = texture2D(splat, gl_TexCoord[0].xy);  vec3 splatColor = splatRec.rgb/(splatRec.a);  vec4 directRec = texture2D(direct, gl_TexCoord[0].xy);    //vec4 outCol = 0.75*directRec + vec4(splatColor, 1.0);  //gl_FragColor = vec4(outCol.rgb, 1.0);  gl_FragColor = vec4(splatColor, 1.0) + .5*directRec;}
开发者ID:benjones,项目名称:radianceCacheSplatting,代码行数:14,



注:本文中的texture2D函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ tf函数代码示例
C++ texture函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。