diff --git a/.vs/shader2/v14/.suo b/.vs/shader2/v14/.suo index cefb1ec..ec3bdb4 100644 Binary files a/.vs/shader2/v14/.suo and b/.vs/shader2/v14/.suo differ 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