|
@ -90,7 +90,7 @@ INT WINAPI WinMain(HINSTANCE hinstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine |
|
|
glewInit(); |
|
|
glewInit(); |
|
|
|
|
|
|
|
|
/*创建program*/ |
|
|
/*创建program*/ |
|
|
GLuint program = CreateGPUProgram("res/shader/UI FullScreemQuad.vs", "res/shader/UI.fs"); |
|
|
|
|
|
|
|
|
GLuint program = CreateGPUProgram("res/shader/PointSprite.vs", "res/shader/PointSprite.fs"); |
|
|
|
|
|
|
|
|
GLuint posLocation, texcoordLocation, normalLocation, MLocation, VLocation, PLocation, NMLocation, textureLocation; |
|
|
GLuint posLocation, texcoordLocation, normalLocation, MLocation, VLocation, PLocation, NMLocation, textureLocation; |
|
|
posLocation = glGetAttribLocation(program, "pos"); |
|
|
posLocation = glGetAttribLocation(program, "pos"); |
|
@ -115,6 +115,9 @@ INT WINAPI WinMain(HINSTANCE hinstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine |
|
|
printf("load obj model fail\n"); |
|
|
printf("load obj model fail\n"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
vertexes[0].position[0] = 0.0f; |
|
|
|
|
|
vertexes[0].position[1] = 0.0f; |
|
|
|
|
|
|
|
|
/*创建vbo*/ |
|
|
/*创建vbo*/ |
|
|
GLuint vbo = CreateBufferObject(GL_ARRAY_BUFFER, sizeof(VertexData) * vertexCount, GL_STATIC_DRAW, vertexes); |
|
|
GLuint vbo = CreateBufferObject(GL_ARRAY_BUFFER, sizeof(VertexData) * vertexCount, GL_STATIC_DRAW, vertexes); |
|
|
|
|
|
|
|
@ -125,8 +128,10 @@ INT WINAPI WinMain(HINSTANCE hinstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine |
|
|
GLuint mainTexture = CreateTextureFromFile("res/image/stone.jpg"); |
|
|
GLuint mainTexture = CreateTextureFromFile("res/image/stone.jpg"); |
|
|
GLuint secondTexture = CreateTextureFromDds("res/image/150001.dds"); |
|
|
GLuint secondTexture = CreateTextureFromDds("res/image/150001.dds"); |
|
|
|
|
|
|
|
|
glClearColor(0.0f, 0.0f, 0.0f, 1.0f); |
|
|
|
|
|
|
|
|
glClearColor(0.1f, 0.4f, 0.7f, 1.0f); |
|
|
glEnable(GL_DEPTH_TEST); |
|
|
glEnable(GL_DEPTH_TEST); |
|
|
|
|
|
glEnable(GL_POINT_SPRITE); |
|
|
|
|
|
glEnable(GL_PROGRAM_POINT_SIZE); |
|
|
glViewport(0,0, windowWidth, windowHeight); |
|
|
glViewport(0,0, windowWidth, windowHeight); |
|
|
|
|
|
|
|
|
//创建一个单位矩阵和一个投影矩阵,后面用来传递到shader
|
|
|
//创建一个单位矩阵和一个投影矩阵,后面用来传递到shader
|
|
@ -170,7 +175,7 @@ INT WINAPI WinMain(HINSTANCE hinstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine |
|
|
glBindBuffer(GL_ARRAY_BUFFER, 0); |
|
|
glBindBuffer(GL_ARRAY_BUFFER, 0); |
|
|
|
|
|
|
|
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ibo); |
|
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ibo); |
|
|
glDrawElements(GL_TRIANGLES, indexCount, GL_UNSIGNED_INT, 0); |
|
|
|
|
|
|
|
|
glDrawElements(GL_POINTS, 1, GL_UNSIGNED_INT, 0); |
|
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); |
|
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); |
|
|
glUseProgram(0); |
|
|
glUseProgram(0); |
|
|
}; |
|
|
}; |
|
@ -185,9 +190,6 @@ INT WINAPI WinMain(HINSTANCE hinstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); |
|
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); |
|
|
|
|
|
|
|
|
glEnable(GL_SCISSOR_TEST); |
|
|
|
|
|
glScissor(400,300, 100, 100); |
|
|
|
|
|
what(); |
|
|
what(); |
|
|
|
|
|
|
|
|
SwapBuffers(dc); |
|
|
SwapBuffers(dc); |
|
|