-2
ウィンドウのサイズが変更されるたびにウィンドウタイトルが更新されるようにしたいと思います。それは、タイトルが表示されるような形式でなければなりません ウィンドウのサイズ - [幅] x [高さ] しかし、その結果、私は_allocaが壊れていたというタイトルを得ました。 @NicoleBolasはすでにコメントで述べたようにサイズ変更時のタイトルのウィンドウサイズの更新
int main(void)
{
GLFWwindow *window = NULL; //initialise window with pointer to GLFW handle
glfwSetErrorCallback(error_callback);
//initialise GLFW
if (!glfwInit())
{
//if failed to initialise GLFW
exit(EXIT_FAILURE);
}
//minimum OpenGL version 3.3
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
//create the window here
window = glfwCreateWindow(WINDOW_WIDTH, WINDOW_HEIGHT, "Window Size - " + WINDOW_WIDTH + "x" + WINDOW_HEIGHT, NULL, NULL);
//if window fail, terminate GLFW
if (window == NULL)
{
glfwTerminate();
exit(EXIT_FAILURE);
}
glfwMakeContextCurrent(window); // set window context as the current context
glfwSwapInterval(1); // swap buffer interval
// initialise GLEW
if (glewInit() != GLEW_OK)
{
// if failed to initialise GLEW
cerr << "GLEW initialisation failed" << endl;
exit(EXIT_FAILURE);
}
//set key callback function
glfwSetKeyCallback(window, key_callback);
//render loop
while (!glfwWindowShouldClose(window))
{
glClear(GL_COLOR_BUFFER_BIT);
glfwSwapBuffers(window); //swap buffers
glfwPollEvents(); //poll for events
}
//close window, terminate GLFW
glfwDestroyWindow(window);
glfwTerminate();
exit(EXIT_SUCCESS);
}
だけではなく、投票ダウン私は、少なくとも私が間違って行っていること、それが何であったかを知っている可能性があります。ちょっと説明すると良いでしょう。 – Monomoni
ウィンドウサイズ - "+ WINDOW_WIDTH +" x "+ WINDOW_HEIGHT'これは問題です。あなたのコンパイラはあなたにエラーを与えていたはずです。 –
@NicolBolas: 'WINDOW_WIDTH'が' #define WINDOW_WIDTH 300'と似ていると仮定すると、これは完璧にコンパイルされます(VS2013でテストされます)。最初の部分は 'const char *'であるので、整数を追加することができます(ポインタ算術)。 – BDL