daily update on 20240213 by nitload youmu. 逐步弃用GLFW,正在使用wgl重写glfw底层,相关实现转移到C#实现,SSC彻底变成线性代数计算器。
This commit is contained in:
+17
-15
@@ -30,18 +30,19 @@ SSCAPI void _cdecl initGL(int majorVersion, int minorVersion)
|
||||
|
||||
|
||||
|
||||
SSCAPI unsigned int loadShaderCode(char* const shaderCode, GLint shadertype)
|
||||
SSCAPI unsigned int loadShaderCode(GladGLContext* context, char* const shaderCode, GLint shadertype)
|
||||
{
|
||||
if (currentContext != NULL)
|
||||
{
|
||||
unsigned int shader = currentContext->CreateShader(shadertype);
|
||||
currentContext->ShaderSource(shader, 1, &shaderCode, NULL);
|
||||
currentContext->CompileShader(shader);
|
||||
unsigned int shader = context->CreateShader(shadertype);
|
||||
context->ShaderSource(shader, 1, &shaderCode, NULL);
|
||||
context->CompileShader(shader);
|
||||
int success;
|
||||
currentContext->GetShaderiv(shader, GL_COMPILE_STATUS, &success);
|
||||
context->GetShaderiv(shader, GL_COMPILE_STATUS, &success);
|
||||
if (!success)
|
||||
{
|
||||
currentContext->GetShaderInfoLog(shader, 512, NULL, infolog);
|
||||
context->GetShaderInfoLog(shader, 512, NULL, infolog);
|
||||
infolog[511] = '\0';
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
@@ -55,15 +56,15 @@ SSCAPI unsigned int loadShaderCode(char* const shaderCode, GLint shadertype)
|
||||
}
|
||||
}
|
||||
|
||||
SSCAPI unsigned int linkShaderProgram(GLuint shaderProgram)
|
||||
SSCAPI unsigned int linkShaderProgram(GladGLContext* context, GLuint shaderProgram)
|
||||
{
|
||||
currentContext->LinkProgram(shaderProgram);
|
||||
context->LinkProgram(shaderProgram);
|
||||
|
||||
int success;
|
||||
currentContext->GetProgramiv(shaderProgram, GL_LINK_STATUS, &success);
|
||||
context->GetProgramiv(shaderProgram, GL_LINK_STATUS, &success);
|
||||
if (!success)
|
||||
{
|
||||
currentContext->GetProgramInfoLog(shaderProgram, 512, NULL, infolog);
|
||||
context->GetProgramInfoLog(shaderProgram, 512, NULL, infolog);
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
@@ -82,15 +83,16 @@ SSCAPI void SSCDECL loadImageData(char* location, Image* out, imageLoader loader
|
||||
out->pixelPtr = loader(location, &(out->width), &(out->height), &(out->channel), 0);
|
||||
}
|
||||
|
||||
SSCAPI void SSCDECL unloadImageData(Image* out)
|
||||
{
|
||||
free(out->pixelPtr);
|
||||
}
|
||||
|
||||
char* _cdecl readLog()
|
||||
{
|
||||
infolog[511] = '\0';
|
||||
return &infolog;
|
||||
}
|
||||
|
||||
SSCAPI void SSCDECL setCurrentGLContext(GLFWwindow* window, GladGLContext* contextPtr)
|
||||
{
|
||||
glfwMakeContextCurrent(window);
|
||||
currentContext = contextPtr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user