🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Rendering to texture in OpenTK

Started by
2 comments, last by 8Observer8 2 years, 7 months ago

Hello guys,

I am working on a project in C# using OpenTK. I need to learn how to render primitives into a texture created in the program, so that later I can use this texture for displaying as a background. Could you please help me with any information, how to display an image in a texture and not on the screen? Could you please give any source where I can read about it? If you have any code example, could you please share it with me?

Advertisement

There is a tutorial about that on GD.net

https://nehe.gamedev.net/tutorial/radial_blur__rendering_to_a_texture/18004/

You just need a couple of buffer objects to redirect rendering to in OGL. The default buffer is rendering to the window manager so you need to glBindBuffer a Framebuffer and a Renderbuffer.

Here is another tutrial which is more into modern GL

http://www.opengl-tutorial.org/intermediate-tutorials/tutorial-14-render-to-texture/

The official OpenTK website has this tutorial: https://opentk.net/learn/index.html​​ This tutorial contains two section. These sections were parted from the famous tutorial: https://learnopengl.com/​ But you should know that the OpenTK tutorial is about OpenTK 3. Use this version.

This is my example with loading a texture: https://github.com/8Observer8/TexturedRectangle_OpenTkOpenGL30CSharp​ You do not need to set up OpenTK for my example. It already includes OpenTK lib. Just open and run it. It will work.

I recommend you to use Qt C++ instead of OpenTK C#. This is my example how to draw a texture using Qt C++ and OpenGL: https://rextester.com/BJW63108

This topic is closed to new replies.

Advertisement