Added clear function to FrameBuffer.#190
Conversation
Instead of calling window.clear() when we have a framebuffer activated we should call framebuffer.clear(). Then it makes sure to clear the renderbuffers that are set. Of course merging this change will make my other pull request redundant: glumpy#189
|
Good point. Maybe you could also add the color option (as for window clear), what do you think? |
|
That is a good idea. |
|
Should we then add a self._color attribute and color argument to the FrameBuffer class? Like with app.window.Window? |
|
Yes, but there's a risk it messes up with the window clear color. |
Removed glClearColor from on_init and the color setter, since it is also set in the clear() function. This also means that the on_init corresponds to the one in the docstring now.
|
I thought about it and removed the clear function from the framebuffer, but I now realize it is simple: What I did now is that I removed the other calls to glClearColor in the window class. These were present in on_init and color.setter. They are redundant, since glClearColor will be called upon clearing anyways. Should I just add the framebuffer clear function again? |
|
You're right. Window clear color is protected. For the For the framebuffer, we could probably do the same and have a dedicated |
|
I think I forgot about this PR, sorry. What did we decide in the end concerning the clear function? |
|
No problem. I haven't had too much time to look into it anyways. There are many ways to go about it and I must admit I am too inexperienced to make the call. |
|
I think having a specific clear color for window and framebuffer makes sense. But as you noticed, _color is used in the framebuffer. I proposed to rename _color to _clearcolor that would be also similar to _clearflags in the window.py class. What do you think? |
|
I agree. I'm thinking of adding a @clearcolor.setter to Window and FrameBuffer and just keeping the old @color.setter in them both for backwards compatibility. |
Instead of calling window.clear() when we have a framebuffer activated we should call framebuffer.clear().
Then it makes sure to clear the renderbuffers that are set.
This also fixes: #189