daily update on 20230927 by nitload youmu, all polygon4 display available, optimizing on C/C# interoperation

This commit is contained in:
Nitload
2023-09-28 01:43:27 +08:00
parent 5d701bce0c
commit 6c3349f5a2
130 changed files with 3280 additions and 25074 deletions
@@ -8,6 +8,12 @@
#include <stdio.h>
#include "StgSharpGraphic.h"
extern char* infolog[512] = { 0 };
void printShaderCode(char* const* code)
{
printf(*code);
}
SSGC_API void initGL(int majorVersion, int minorVersion)
{
@@ -26,3 +32,47 @@ SSGC_API int initGLAD(void)
{
return gladLoadGLLoader((GLADloadproc)glfwGetProcAddress);
}
SSGC_API unsigned int loadShaderCode(char* const shaderCode, GLint shadertype)
{
unsigned int shader = glCreateShader(shadertype);
glShaderSource(shader, 1, &shaderCode, NULL);
glCompileShader(shader);
int success;
glGetShaderiv(shader, GL_COMPILE_STATUS, &success);
if (!success)
{
glGetShaderInfoLog(shader, 512, NULL, infolog);
infolog[511] = '\0';
printf(infolog);
return 0;
}
else
{
return shader;
}
}
SSGC_API unsigned int linkShaderProgram(GLuint shaderProgram)
{
glLinkProgram(shaderProgram);
int success;
glGetProgramiv(shaderProgram, GL_LINK_STATUS, &success);
if (!success)
{
glGetProgramInfoLog(shaderProgram, 512, NULL, infolog);
printf(infolog);
return 0;
}
else
{
return shaderProgram;
}
}
char* _cdecl readLog()
{
return infolog[0];
}