tiled offscreen textures?

I use an offscreen texture to allow the user to draw a drawing. This works well.

Now I want to make enhancements…

conceptually, I want to change it so that the user is drawing on a set of horizontally tiled textures versus 1 single texture?

Is this possible? Any ideas as to how I could accomplish this?

Texture arrays, texture atlas, cube maps, or separate textures.
You’re going to have to tell us more about what you’re doing with these before we can say any of these would be better than the rest.

For instance, what’s stopping you from just bumping up your X texture resolution?

If you’re using glCopyTexSubImage2D to paste the dirty rectangle:


RECT DirtyRect; // computed by Brush_Position and Brush_Size
...

foreach_texture{
	RECT tempRect;
   	if(!IntersectRect(&tempRect,&texPositionAndSize,&DirtyRect))continue;
	int wid = tempRect.right-tempRect.left;
	int hei = tempRect.bottom-tempRect.top;
glCopyTexSubImage2D(...); // x/y/width/height/xoffset/yoffset derived from tempRect and the texture-position onscreen
}

The glCopyTexSubImage2D approach is prone to the following pitfall, though: if the brush/DirtyRect is not completely in the viewport or even some window is partially obscuring it, the copied pixels will have undefined values.

This can be solved in many ways, but maybe the best+easiest would be to use FBOs and draw the brush on each FBO/texture it covers.

ok. you can think of my app as a meter that is drawing intensity as the paper below it scrolls. the paper is my background texture. right now my paper is a single texture that is twice the size of my display (viewport). i change which portion i show from the texture to accomplish the “scrolling” it works, but the paper is real short :slight_smile:

I then capture the entire image at the end for the user.

i want the “paper” to be infinite or longer that 2x.

does that help? i appreciate the suggestions. i am in the opengl es environment

Ah, I see. So with infinite length, an open-ended array of textures is probably your best bet. Based on scroll position and zoom factor, you can dynamically decide which segments (textures) are within viewport, and draw just them. Or let GL cull them - your pick.

However, you might consider whether it might not make sense to rerender the raw data within the scroll window directly, rather than save the result off into a textures. Less memory consumption…

opengl es environment

…which is probably a bigger deal on your embedded platform.