This is a demonstration of WebGL in html5.

Source: Internet
Author: User

This is a demonstration of WebGL in html5.

 

This is a demonstration of WebGL in html5. Let's share it with others and send short messages to you. Every time you enter it and use different locations, new love points are added to the world. Share the brighter world with your friends!

Source file:
Some code:
<! DOCTYPE html>
<Html>
<Head>
<Title> Geolocation love </title>
<Meta charset = "UTF-8">
<Script src = "js/jquery-1.8.2.min.js"> </script>
<Script src = "js/three. js"> </script>

<Script src = "js/Detector. js"> </script>
<Script src = "js/Stats. js"> </script>

<Script src = "js/Tween. js"> </script>

<Script src = "js/ShaderExtras. js"> </script>
<Script src = "js/javastcomposer. js"> </script>
<Script src = "js/ShaderPass. js"> </script>
<Script src = "js/MaskPass. js"> </script>
<Script src = "js/RenderPass. js"> </script>
<Script src = "js/BloomPass. js"> </script>
<Script src = "js/FilmPass. js"> </script>

<Script type = "text/javascript" src = "js/main. js"> </script>

<Link href = "style.css" rel = "stylesheet" type = "text/css"/>
</Head>

<Body>

<Div id = "container"> </div>

<Section class = "box" id = "messageBox">
<Div id = "message"> No matter where you are, always make the world brighter place </div>
<Div id = "dist"> </div>
<Div id = "shareSwitcher"> <a> Click to share your love with others! </A> </div>
<Div id = "likeIt"> <a href = "https://developer.mozilla.org/en-US/demos/detail/geolocation-love"> Like this demo on DevDerby </a> </div>
</Section>

<Section class = "box" id = "product_box">
<Div id = "form">
<H1> Type your message to the world <Textarea id = "messageArea"> </textarea>
<Input id = "submitShare" type = "button" value = "get share link"/>
</Div>
</Section>
</Div>

</Div>

<Script type = "x-shader/x-vertex" id = "earthVertex">
Varying vec3 vNormal;
Varying vec2 vUv;
Void main (){
Gl_Position = projectionMatrix * modelViewMatrix * vec4 (position, 1.0 );
VNormal = normalize (normalMatrix * normal );
VUv = uv;
}
</Script>
<Script type = "x-shader/x-fragment" id = "earthFragment">
Uniform sampler2D texture;
Varying vec3 vNormal;
Varying vec2 vUv;
Void main (){
Vec3 diffuse = texture2D (texture, vUv). xyz;
Float intensity = 1.15-dot (vNormal, vec3 (0.0, 0.0, 1.0 ));
Vec3 atmosphere = vec3 (1.0, 1.0, 1.0) * pow (intensity, 3.0 );
Gl_FragColor = vec4 (diffuse + atmosphere, 1.0 );
}
</Script>


<Script type = "x-shader/x-vertex" id = "atmosphereVertex">
Varying vec3 vNormal;
Void main (){
VNormal = normalize (normalMatrix * normal );
Gl_Position = projectionMatrix * modelViewMatrix * vec4 (position, 1.0 );
}
</Script>

<Script type = "x-shader/x-fragment" id = "atmosphereFragment">
Varying vec3 vNormal;
Void main (){
Float intensity = pow (0.8-dot (vNormal, vec3 (0, 0, 1.0), 10.0 );
Gl_FragColor = vec4 (1.0, 1.0, 1.0, 1.0) * intensity;
}
</Script>
</Body>
</Html>

Http://html5.662p.com/thread-9-1-1.html

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.