are no longer in the API, although those functions are mentioned even in the code examples in the API. I must have missed that change, but I can’t find when and why it happened.
Nevertheless, I tried to use those functions, but it is not working, here’s a small repro:
Changing enable/disable render target to set_render_target as you proposed still didn’t help in the project I uploaded - the screen is still black
function update(self)
render.set_render_target(self.render_target)
... -- drawing everything like in default script
render.set_render_target(render.RENDER_TARGET_DEFAULT)
-- up to this point everything is drawn to the render target only
-- 1) clear the frame buffer
render.clear({[render.BUFFER_COLOR_BIT] = self.clear_color})
-- 2) fill the window with a viewport (set viewport to match window)
render.set_viewport(0, 0, render.get_window_width(), render.get_window_height())
-- 3) set the view to the identity matrix
render.set_view(vmath.matrix4())
-- 4) set texture slot 0 to the color buffer of the render target
render.enable_texture(0, self.render_target, render.BUFFER_COLOR_BIT)
-- 5) draw graded predicate
render.draw(self.grade_pred)
-- 6) disable texture slot 0
render.disable_texture(0)
end
As I’m now learning OpenGL more thoroughly and revising the documentation, especially the tutorials that are outdated, few things already came up. One is with render.enable_target() which was deprecated and actually the topic should have been followed up, thus I’m working on a PR to the tutorial and also the documentation - in some code examples there are still deprecated functions used
Second thing is that Grading tutorial stating in chapter “Drawing to an off-screen buffer”:
All original drawing code in update() is left as is, apart from the viewport which is set to the render target’s resolution.
And my problem is that according to the API render.get_width() and render.get_height() are returning a width and height (respectively) from the game.project:
Returns the logical window width that is set in the “game.project” settings.
Is it correct or is there something wrong and a function render.get_render_target_width() should be used?
It looks like the width and height of the render target are set to render.get_width() and render.get_height() so I guess in that case it doesn’t matter if render.get_width() or render.get_render_target_width() is used?
In that case yes, but when window size is changed, is it that when I use an incorrect viewport, I could see some more/less of the world in a screen? It is somehow strange to understand when combined with projection
Also replacing render.enable_render_target() with render.set_render_target() is ok, but there is no replacement function for render.disable_render_target() (which is also not in the API) and it seems, like without disabling it, everything fails - is it ok guys?
This is my first PR to the engine, so let me know if everything is ok! The change regards replacing enable_render_target and disable_render_target with set_render_target equivalents. It is only in comments used to generate API documentation for render