OpenGL canvas bigger than screen windows?

BlitzMax Forums/MaxGUI Module/OpenGL canvas bigger than screen windows?

ima747(Posted 2010) [#1]
I'm using OpenGL for consistency between mac and windows, as well as for a few other reasons.

I'm drawing multiple images to a canvas in a window and then grabbing the back buffer to an image and saving that.

It works fine on mac (nvidia card)

When I do it on windows (also nvidia card, as well as on a laptop with unknown card) when I grab the back buffer anything that would be on the canvas outside the frame of the screen is empty.

How can I overlay images and grab the result if I need more space than the resolution of the screen on windows? (it works fine on mac) Is there a way to disable back buffer clipping to screen bounds? Maybe there's just a better way to composit images without having to do it with the pixmaps by hand (the problem is I need scaling and rotation as well as text drawing etc, so doing the pixmap composit would be very difficult compared to just using draw commands...)


Sanctus(Posted 2010) [#2]
Up the top of my head... did you set the glViewport to the right size?. And if you use OpenGL then you could use render targets and that supports sizes like 4096x4096 and even faster than copying from the backbuffer.


ima747(Posted 2010) [#3]
the viewport is set to the size of the canvas so beyond full screen, and it clips at the edge of the screen, not the edge of the canvas (which is beyond full screen).

I'm using the standard blitz drawing commands, if there's a way to pipe them directly to a texture that would be great. I need to be able to grab non pow2 sizes for the output image though...


Sanctus(Posted 2010) [#4]
Well for NPOT2 textures the video card has to support stuff like that. For example the internals of blitzmax use POT2 textures. When you load a image that has the sizes not powers of 2 BM stretches it to a POT2 texture. Do a bit of research :). Basically it's quite easy to make a render target with OpenGL. If for example your target computer is slower then you have to do the same thing BM does. Look at the source. According to Steam 95% users have hardware that supports DX9 which basically means those support EXT_FBO (frame buffer objects).


ima747(Posted 2010) [#5]
I know the core textures are pot2, my point is I need the output to be NON pot2, so if I render to a pot2 texture (which I must for compatability's sake) then I have to strip it down to the non pot2 data that I actually want when I'm done... but this is all academic.

What I need is to be able to take some pictures and text. Draw them inside a rect bigger than, or at the very least not entirely displayed on the screen at one time with rotation and scaling, then take the resulting image from all this drawing and save it to a file.

It works fine on mac.

Anything that when flipped to the screen would be off screen, justcomes out as transparent on windows.

Don't really have the time to learn direct opengl, and I'm unaware of any render to texture code that will do better than a screen grab for what I need (being that it needs rotation, scaling, and text rendering as well). Speed is not a primary concern, just getting accurate and oversized images in proper aspect ratio.


Sanctus(Posted 2010) [#6]
Well from what I read I'm even curious as to why that works on mac. It should be clipped on every platform so I'm not sure there's a way to change that (info taken from opengl.org).
You could read about FBO's here:
http://www.songho.ca/opengl/gl_fbo.html
You just have to set it up and it should work with standard BM commands such as drawimage/drawtext and everything related.


ima747(Posted 2010) [#7]
That's why I was so confused it didn't work on windows since it worked so smoothly on mac (I would have expected the mac to fail the same way, or for it to be manufacturer dependent, like only works on nvida and not ATI but it works on mac on both and fails on PC on both so it's OS dependent...)

Very confusing.

Guess I'll have to look into fbo or try to find some other path...

I tried the directx driver on windows and I get the full bounds not clipped, but there are other drawing issues to contend with...

back to the drawing board I guess. Thanks for the feedback.


Kryzon(Posted 2010) [#8]
You can use non-power-of-2 textures with GL, by using this extension.
I've never done it, so I can't help you much with that.