From 607165311e6477d816f115e151e47c46d0b029ec Mon Sep 17 00:00:00 2001 From: blobt Date: Sat, 20 Jun 2020 22:42:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=BF=E7=94=A8cpu=E5=88=9B=E5=BB=BA?= =?UTF-8?q?=E5=85=A8=E5=B1=8F=E7=94=BB=E5=B8=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vs/shader2/v14/.suo | Bin 40960 -> 37888 bytes main.cpp | 23 +---------------------- res/shader/UI FullScreemQuad.vs | 16 ++++++++++++++++ shader2.vcxproj | 1 + shader2.vcxproj.filters | 3 +++ 5 files changed, 21 insertions(+), 22 deletions(-) create mode 100644 res/shader/UI FullScreemQuad.vs diff --git a/.vs/shader2/v14/.suo b/.vs/shader2/v14/.suo index cefb1ec9ebb4554d46eac0e7d23095fe2bf5156d..ec3bdb4025a3ec2eb6a19927666fe30879318674 100644 GIT binary patch delta 1797 zcmcJQU2M};6u|HOx80hq+xoRFoh>UX;OzP>W3z_XtzDUX?2AZ1_OP;b3^N#XZ6n1& zk!1QHr0v-Y;iI7v!=vjTK?5c=GZEtlh|vdwx)&cIJg~$iX7!wI)v>q)W4!Q@Z=w+g z#DzG&3G+fX%nB}<4`oAeTyjEo30qfTL1Nx$z}7m%gls@$2rgVuU|o%PkXqcK4kB`0 zYEZgsBMRh515$|?5mKd8%CWy5X-1lm7Z3|#MQn&2c^+{fRit`qP%e8JJMFZKu>)JA zryuD=0?0O`3sEh7ewz$UJg5K5Q16nVx7RkbyrG4RTWKumD@7UUUWRqaSdx={S{h6B znTrOKuw<|r2b2iOsQixxYf1(yMwO&z35Y0m+GbFP93mpuk&loY2z~T1)}Ji5Z&3}$ zdb3sXdtVL)PzO!tQeTbdw;)3cc4t}jue4#K_FR+N6o`(E?H&q;LWldJ!C`w0a+z-UI->`@MGJ>4R;YFN8%9}_jk5tZ!A4nX zvF@PHC_lxnJ$mKW_rE*`_bxeeRzFv^;S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WPix6?tN7p(amR?B-Y diff --git a/main.cpp b/main.cpp index deaea6c..d476477 100644 --- a/main.cpp +++ b/main.cpp @@ -87,7 +87,7 @@ INT WINAPI WinMain(HINSTANCE hinstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine glewInit(); /*创建program*/ - GLuint program = CreateGPUProgram("res/shader/UI.vs", "res/shader/UI.fs"); + GLuint program = CreateGPUProgram("res/shader/UI FullScreemQuad.vs", "res/shader/UI.fs"); GLuint posLocation, texcoordLocation, normalLocation, MLocation, VLocation, PLocation, NMLocation, textureLocation; posLocation = glGetAttribLocation(program, "pos"); @@ -109,27 +109,6 @@ INT WINAPI WinMain(HINSTANCE hinstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine printf("load obj model fail\n"); } - float z = 4.0f; - float halfFOV = 22.5f; - float randianHalfFOV = 3.14 * halfFOV / 180.0f;//角度转弧度 - float tanHalfFOV = sinf(randianHalfFOV) / cosf(randianHalfFOV); - float y = tanHalfFOV * z; - float aspect = (float)windowWidth / (float)windowHeight; - float x = y * aspect; - - vertexes[0].position[0] = -x; - vertexes[0].position[1] = -y; - - vertexes[1].position[0] = x; - vertexes[1].position[1] = -y; - - vertexes[2].position[0] = -x; - vertexes[2].position[1] = y; - - vertexes[3].position[0] = x; - vertexes[3].position[1] = y; - - /*创建vbo*/ GLuint vbo = CreateBufferObject(GL_ARRAY_BUFFER, sizeof(VertexData) * vertexCount, GL_STATIC_DRAW, vertexes); diff --git a/res/shader/UI FullScreemQuad.vs b/res/shader/UI FullScreemQuad.vs new file mode 100644 index 0000000..6fdc552 --- /dev/null +++ b/res/shader/UI FullScreemQuad.vs @@ -0,0 +1,16 @@ +attribute vec3 pos; +attribute vec2 texcoord; +attribute vec3 normal; + +uniform mat4 M; +uniform mat4 V; +uniform mat4 P; +uniform mat4 NM; + +varying vec2 V_Texcoord; + +void main() { + vec4 position = vec4(pos.x*2,pos.y*2,pos.z,1.0); + V_Texcoord = texcoord; + gl_Position = position; +} \ No newline at end of file diff --git a/shader2.vcxproj b/shader2.vcxproj index dc94119..df7376d 100644 --- a/shader2.vcxproj +++ b/shader2.vcxproj @@ -157,6 +157,7 @@ + diff --git a/shader2.vcxproj.filters b/shader2.vcxproj.filters index 238dbbd..9c7e1f9 100644 --- a/shader2.vcxproj.filters +++ b/shader2.vcxproj.filters @@ -46,5 +46,8 @@ 婧愭枃浠 + + 婧愭枃浠 + \ No newline at end of file