Thanks to visit codestin.com
Credit goes to github.com

Skip to content

glClearColor in the documentation #32

@robindegen

Description

@robindegen

The documentation mentions the following code:

while(!glfwWindowShouldClose(window)) {
glClear(GL_COLOR_BUFFER_BIT);
glClearColor(0.1f, 0.1f, 0.1f, 1.0f);

}

glClear clears the color buffer to the color configured with glClearColor, so constantly setting it after clearing is incorrect.

It means your very first frame will actually be just black. After that every frame after you're changing the color value to the same value, which basically only costs time and does nothing. glClearColor should be called only once outside of the loop.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions