1

So I am still trying to get the same result within OpenGL and DirectX.

Now my problem is using Rendertargets and Viewports.

What I learned so far:

  • DirectX's Backbuffer stretches if the Window is resized -- Size of rendered Texture changes
  • OpenGL's Backbuffer resized if the Window is resized -- Rendered Texture stays where it is rendered

Now what I did here was to change OpenGL's Viewport to the Window Size. Now both have the same result, the rendered Texture is stretched. One Con: -OpenGL's Viewport's Size cant be set like in DirectX because it is set to the Window Size.

Now when rendering a Rendertarget this happens:

  • DirectX: Size matters, if Size is greater than the Backbuffer the texture only takes a small place, if Size is lower than the Backbuffer the Texture takes a lot place
  • OpenGL: Size doesnt matter, rendered Context stays the same/stretches.

Now my question is:

How do I get the Same Result in OpenGL and in DirectX? I want the same Result I have in DirectX within OpenGL. And is my Idea of doing it so far right or is there a better idea?

3
  • 1
    If you want to duplicate the behavior of DirectX, then draw into an Frambuffer Object and blit that FBO to the default framebuffer (window) using GL_LINEAR sampling. That is the behavior you want, right? Where the framebuffer resolution doesn't change with window resize? Oct 26, 2014 at 16:21
  • @AndonM.Coleman I render everything from the framebuffer into a texture and draw that texture afterwards. If I use blit, my texture is not passed through a shader right? What I want is basically that if I change the size if the FBO Texture it also affects on how the textures are rendered on it, just like in directX. Does that work?
    – PuRe
    Oct 26, 2014 at 19:10
  • 1
    Well, I don't understand what you mean by that. The only relevant difference between D3D and GL with respect to sizing a window has to do with the way the framebuffer is resized. GL does this automatically, in D3D you have to do it yourself. But if you use an FBO for drawing, you can keep GL from resizing the framebuffer you draw into when you resize your window. Oct 26, 2014 at 19:17

1 Answer 1

2

What I did: draw everything in OpenGL to a FrameBuffer and blit that to the backBuffer. Now the Content is rescaleable just like in DirectX.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.