I am currently new to webgl and learning shaders. My current project involves wrapping a texture around a sphere to create an earth globe image. However, I have encountered issues with the fragments and vertex GLSL code.
The error I am facing occurs when trying to load the texture:
three.module.js:17071 THREE.WebGLProgram: shader error: 0 35715 false gl.getProgramInfoLog Vertex shader is not compiled.
Here is the code snippet from main.js:
import './style.css'
import * as THREE from 'three'
import * as dat from 'dat.gui'
import vertexShader from './vertex.glsl'
import fragmentShader from './fragment.glsl'
// Rest of the code here...
Code for fragment.glsl:
uniform sampler2D globeTexture;
varying vec2 vertexUV;
void main() {
gl_FragColor = texture2D(globeTexture, vertexUV);
}
Code for vertex.glsl:
varying vec2 vertexUV;
void main(){
vertexUV = uv;
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
}
Thank you in advance for your help.