daily update on 20240226 by nitload youmu

This commit is contained in:
YoumuLiu
2024-02-27 00:43:29 +08:00
parent a2241a5a58
commit 06e39f7a31
543 changed files with 230273 additions and 21423 deletions
+32 -42
View File
@@ -1,19 +1,11 @@
// StgShqrpGraphic.cpp : 定义 DLL 的导出函数。
//
#include "./include/ssgc_framework.h"
#include "./include/glad_gl.h"
#include "./include/glfw3.h"
#include "./include/StgSharpC.h"
#include "ssgc_framework.h"
#include "gl.h"
#include "glfw3.h"
#include "StgSharpC.h"
#include <stdio.h>
GladGLContext* currentContext;
extern char* infolog[512] = { 0 };
void printShaderCode(char* const* code)
{
printf(*code);
}
extern char infolog[512] = { 0 };
SSCAPI void _cdecl initGL(int majorVersion, int minorVersion)
{
@@ -21,41 +13,43 @@ SSCAPI void _cdecl initGL(int majorVersion, int minorVersion)
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, majorVersion);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, minorVersion);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
#ifdef __APPLE__
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
#endif
}
SSCAPI unsigned int loadShaderCode(GladGLContext* context, char* const shaderCode, GLint shadertype)
{
if (currentContext != NULL)
unsigned int shader = context->CreateShader(shadertype);
context->ShaderSource(shader, 1, &shaderCode, NULL);
context->CompileShader(shader);
int success;
context->GetShaderiv(shader, GL_COMPILE_STATUS, &success);
if (!success)
{
unsigned int shader = context->CreateShader(shadertype);
context->ShaderSource(shader, 1, &shaderCode, NULL);
context->CompileShader(shader);
int success;
context->GetShaderiv(shader, GL_COMPILE_STATUS, &success);
if (!success)
{
context->GetShaderInfoLog(shader, 512, NULL, infolog);
infolog[511] = '\0';
return 0;
}
else
{
return shader;
}
context->GetShaderInfoLog(shader, 512, NULL, infolog);
infolog[511] = '\0';
return 0;
}
else
{
return 0;
return shader;
}
}
SSCAPI GLFWglproc SSCDECL loadGlfuncDefault(char* procName)
{
void* ret = glfwGetProcAddress(procName);
printf("%llu\n", (uint64_t)ret);
if (ret = NULL)
{
*infolog = "Failed to load OpenGL api:";
for (size_t i = 0; i < sizeof(procName); i++)
{
infolog[30 + i] = procName[i];
}
printf("%s\n", infolog);
}
return (GLFWglproc)ret;
}
SSCAPI unsigned int linkShaderProgram(GladGLContext* context, GLuint shaderProgram)
{
context->LinkProgram(shaderProgram);
@@ -71,7 +65,6 @@ SSCAPI unsigned int linkShaderProgram(GladGLContext* context, GLuint shaderProgr
{
return shaderProgram;
}
}
SSCAPI void SSCDECL loadImageData(char* location, Image* out, imageLoader loader)
@@ -92,7 +85,4 @@ char* _cdecl readLog()
{
infolog[511] = '\0';
return &infolog;
}
}