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

save3

parent bfcb3ab2
Branches
No related tags found
No related merge requests found
...@@ -420,26 +420,6 @@ function cube(color) ...@@ -420,26 +420,6 @@ function cube(color)
gl.enableVertexAttribArray(vNormal); 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() { function renderBackground() {
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT); gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
...@@ -487,7 +467,6 @@ window.onload = function init() { ...@@ -487,7 +467,6 @@ window.onload = function init() {
program = initShaders(gl, "vertex-shader", "fragment-shader"); program = initShaders(gl, "vertex-shader", "fragment-shader");
gl.useProgram(program); gl.useProgram(program);
initTexture();
instanceMatrix = mat4(); instanceMatrix = mat4();
...@@ -894,7 +873,6 @@ var render = function() { ...@@ -894,7 +873,6 @@ var render = function() {
walk(); walk();
//headmove(); //headmove();
} }
renderBackground();
traverse(torsoId); traverse(torsoId);
requestAnimFrame(render); requestAnimFrame(render);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment