Dạ em mới học OpenGL, có một đoạn code như này em thấy hơi khó hiểu @@ cái void render1 là của sách, khi chạy thì màu của cửa sổ đổi màu liên tục, em nghĩ là nhờ hai hàm sin và cos, nên em viết cái hàm render2, nhưng nó chỉ đổi màu 1 lần r im re luôn @@ cho em hỏi em sai ở đâu nhỉ
void render1(double currentTime)
{
const GLfloat color[] = {
(float)sin(currentTime) * 0.5f + 0.5f,
(float)cos(currentTime) * 0.5f + 0.5f,0.0f, 1.0f
};
glClearBufferfv(GL_COLOR, 0, color);
}
void render2(double currentTime)
{
float x;
float y;
x = (float)currentTime +1;
y = (float)currentTime ;
const GLfloat color[] = {
x * 0.5f + 0.5f,
y * 0.5f + 0.5f,0.0f, 1.0f
};
glClearBufferfv(GL_COLOR, 0, color);
}