Skip to content
Snippets Groups Projects
Commit 1bcb5506 authored by pyjong1999's avatar pyjong1999
Browse files

save3

parent bfcb3ab2
No related branches found
No related tags found
No related merge requests found
......@@ -420,26 +420,6 @@ function cube(color)
gl.enableVertexAttribArray(vNormal);
}
/// 백그라운드 이미지용
var texture;
function configureTexture(image) {
texture = gl.createTexture();
gl.bindTexture(gl.TEXTURE_2D, texture);
gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image);
gl.generateMipmap(gl.TEXTURE_2D);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST_MIPMAP_LINEAR);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
}
function initTexture() {
var image = new Image();
image.onload = function() {
configureTexture(image);
}
image.src = 'D:\\vscode\\computergraphics\\example\\img.jpg'; // 배경 이미지 파일 경로
}
function renderBackground() {
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
......@@ -487,7 +467,6 @@ window.onload = function init() {
program = initShaders(gl, "vertex-shader", "fragment-shader");
gl.useProgram(program);
initTexture();
instanceMatrix = mat4();
......@@ -894,7 +873,6 @@ var render = function() {
walk();
//headmove();
}
renderBackground();
traverse(torsoId);
requestAnimFrame(render);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment