Вот мой цикл.
Код: Выделить всё
bool SG_Window::LoopShow() {
double lastTime = glfwGetTime();
double tickRate = 1.0 / 60.0;
this->ShaderCompilate();
while (!glfwWindowShouldClose(this->window))
{
glViewport(0, 0, this->width, this->height);
glClearColor(0.1f, 0.1f, 0.1f, 1.0f); /
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glfwPollEvents();
double currentTime = glfwGetTime();
double deltaTime = currentTime - lastTime;
if (deltaTime >= tickRate) {
lastTime = currentTime;
for (SG_Assets* asset : *this->linkedAssets) {
if (asset->IsActualise()) {
//glBindFramebuffer(GL_FRAMEBUFFER, asset->getFBO());
//glViewport(0, 0, asset->w, asset->h);
//glClearColor(1.0f, 0.0f, 0.0f, 1.0f);
std::cout window);
}
}
for (std::function function : *this->functions) {
function();
}
}
else {
glfwWaitEventsTimeout(tickRate);
}
}
std::cout vertexShader = glCreateShader(GL_VERTEX_SHADER);
glShaderSource(vertexShader, 1, &vertexShaderSource, NULL);
glCompileShader(vertexShader);
GLint success;
GLchar infoLog[512];
glGetShaderiv(vertexShader, GL_COMPILE_STATUS, &success);
if (!success) {
glGetShaderInfoLog(vertexShader, 512, NULL, infoLog);
std::cerr
Подробнее здесь: [url]https://stackoverflow.com/questions/78682284/how-do-i-make-opengl-on-a-1px-by-1px-scale-on-c[/url]