PDA

View Full Version : Wrong clipping



Vincenz
11-14-2002, 03:11 AM
Hello, I have an application that renders text. The problem is that it's quite a heavy algorithm and for reasons I can't divulge on right now I need to render to a texture. So when I create the text I create a square texture, set the viewport, ... This all works fine.
However, if my text is bigger than my original screen-size, it gets clipped. This is a problem, as the texture with the text on it moves inside the original window, and I see where it gets clipped. Does anyone have any suggestions why it would clip like that? I mean, I changed the viewport and used the gluOrtho2D function to set the right viewport and viewing volume, yet it still clips at windowside.

Thanking you in advance,
Vincenz

Vincenz
11-14-2002, 03:48 AM
I just noticed why this happens.
--> From MSDN
If any of the pixels within the specified rectangle of the current frame buffer are outside the read window associated with the current rendering context, then the values obtained for those pixels are undefined. No change is made to the internalFormat, width, height, or border parameter of the specified texture array or to texel values outside the specified texture sub-image.

-->

How would I circumvent this?
Thanks again.

nexusone
11-14-2002, 05:16 AM
It is hard to tell with out seening your view setup and ortho settings.

But when you use bitmap fonts you can not scale them to fit the window like a texture maped bitmap font.

Bitmaps size does not scale, vs. a texture which can be scaled.

I hope this makes sense....

Vincenz
11-14-2002, 05:46 AM
Hmm, oops I forgot to mention I'm using the glCopyTexSubImage function. And that this function has the limitation written above. I guess the easiest solution would just be to render the scene in different pieces and then glue them together :p

nexusone
11-14-2002, 06:44 AM
Also look at only changing your glViewport, with window re-size and not your glortho or perspective.


Originally posted by Vincenz:
Hmm, oops I forgot to mention I'm using the glCopyTexSubImage function. And that this function has the limitation written above. I guess the easiest solution would just be to render the scene in different pieces and then glue them together :p

Vincenz
11-14-2002, 07:31 AM
Perhaps I explained myself in the wrong way.
This has nothing to do with the windows code, or windows resize code or whatsoever. But I figured out how to solve it. I'll generate the texture I need piecewise, I hope the performance does not suffer too much under it.