53 lines
1.3 KiB
HTML
53 lines
1.3 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8"/>
|
|
<title>WebGL Example</title>
|
|
|
|
<script id="vertex-shader" type="x-shader/x-vertex">#version 300 es
|
|
in vec4 vPosition;
|
|
in vec4 vColor;
|
|
out vec4 vfColor;
|
|
uniform mat4 viewMatrix;
|
|
uniform mat4 modelMatrix;
|
|
|
|
void main()
|
|
{
|
|
const mat4 projectionMatrix = mat4(
|
|
1.2071068286895752, 0, 0, 0,
|
|
0, 2.4142136573791504, 0, 0,
|
|
0, 0, -1.0100502967834473, -1,
|
|
0, 0, -1.0050251483917236, 0);
|
|
|
|
vfColor = vColor;
|
|
gl_Position = projectionMatrix * viewMatrix * modelMatrix * vPosition; //projectionMatrix eig auch
|
|
}
|
|
|
|
</script>
|
|
<script id="fragment-shader" type="x-shader/x-fragment">#version 300 es
|
|
precision mediump float;
|
|
|
|
in vec4 vfColor;
|
|
out vec4 fColor;
|
|
|
|
void main()
|
|
{
|
|
fColor = vfColor;
|
|
}
|
|
</script>
|
|
<script type="text/javascript" src="common/initShaders.js"></script>
|
|
<script type="text/javascript" src="common/objects3D.js"></script>
|
|
<script type="text/javascript" src="common/glMatrix.js"></script>
|
|
</head>
|
|
<body>
|
|
<h1>Lorem Ipsum</h1>
|
|
|
|
<canvas id="gl-canvas" width="1024" height="1024">
|
|
If you see this, your browser doesn't support WebGL.
|
|
</canvas>
|
|
|
|
<script src="main.js" type="text/javascript"></script>
|
|
|
|
</body>
|
|
</html>
|