Function 如何将参数传递给回调函数下的函数
我想在changeShader函数中传递更多参数,该函数在回调函数key\u callback中调用。但是回调函数有固定的参数,那么我如何在changeShader()中传递参数呢Function 如何将参数传递给回调函数下的函数,function,Function,我想在changeShader函数中传递更多参数,该函数在回调函数key\u callback中调用。但是回调函数有固定的参数,那么我如何在changeShader()中传递参数呢 static void key_回调(GLFWwindow*window,int key,int scancode,int action,int mods) { 如果(glfwGetKey(窗口,GLFW_键_退出)==GLFW_按) glfwSetWindowShouldClose(窗口,真); int st
static void key_回调(GLFWwindow*window,int key,int scancode,int action,int mods)
{
如果(glfwGetKey(窗口,GLFW_键_退出)==GLFW_按)
glfwSetWindowShouldClose(窗口,真);
int state=glfwGetKey(窗口,GLFW_键向上);
如果(状态==GLFW_按)
{
changeShaderCoulor();
库特
static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)
{
if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)
glfwSetWindowShouldClose(window, true);
int state = glfwGetKey(window,GLFW_KEY_UP);
if (state == GLFW_PRESS)
{
changeShaderCoulor();
cout << "hello" << endl;
}
}
void changeShaderCoulor(GLuint shaderPro ,const char * name)