daily update on 20230511 by nitlod youmu
This commit is contained in:
@@ -0,0 +1,75 @@
|
||||
// StgSharpGraphics.c : 定义 DLL 的导出函数。
|
||||
//
|
||||
|
||||
#include "StgSharpGraphics.h"
|
||||
#include "glad/glad.h"
|
||||
#include "GLFW/glfw3.h"
|
||||
#include "framework.h"
|
||||
#include "stdio.h"
|
||||
#include "internal.h"
|
||||
|
||||
int version[4] = { 0,0,0,0 };
|
||||
STGSHARPGRAPHICS_API int* versionInfo = &version;
|
||||
|
||||
|
||||
// 这是导出函数的一个示例。
|
||||
STGSHARPGRAPHICS_API int fnStgSharpGraphics(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
STGSHARPGRAPHICS_API IOpackage initPackage(void)
|
||||
{
|
||||
IOpackage pack;
|
||||
pack.InitWindow = initWindow;
|
||||
return pack;
|
||||
}
|
||||
|
||||
STGSHARPGRAPHICS_API int initWindow(int width, int height)
|
||||
{
|
||||
glfwInit();
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
|
||||
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
|
||||
|
||||
#ifdef __APPLE__
|
||||
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
|
||||
#endif // __APPLE__
|
||||
|
||||
GLFWwindow* window = glfwCreateWindow(width, height, "LearnOpenGL", NULL, NULL);
|
||||
if (window == NULL)
|
||||
{
|
||||
printf("Failed to create GLFW window");
|
||||
glfwTerminate();
|
||||
return -1;
|
||||
}
|
||||
glfwMakeContextCurrent(window);
|
||||
|
||||
if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))
|
||||
{
|
||||
printf("Failed to initialize GLAD");
|
||||
return -1;
|
||||
}
|
||||
|
||||
while (!glfwWindowShouldClose(window))
|
||||
{
|
||||
// input
|
||||
// -----
|
||||
|
||||
// render
|
||||
// ------
|
||||
glClearColor(0.2f, 0.3f, 0.3f, 1.0f);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
// glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)
|
||||
// -------------------------------------------------------------------------------
|
||||
glfwSwapBuffers(window);
|
||||
glfwPollEvents();
|
||||
}
|
||||
|
||||
// glfw: terminate, clearing all previously allocated GLFW resources.
|
||||
// ------------------------------------------------------------------
|
||||
glfwTerminate();
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user