Skip to main content
GameDev.net gamedev.net
🔒 Locked

Viewports

Started by Ruudje Nov 22, 2003 at 11:10 AM 1 replies 450+ views
Original Post
Ruudje
Ruudje
Is there ANY way to get a non-rectangular viewport, or are they rectangular no matter what?
Crispy
Crispy
Why would you want a non-rectangular viewport - that would require an entirely different 3D->2D mapping from that which the graphics card uses. Besides, your monitor is rectangular and therefore doesn''t directly "support" non-rectangular viewports.

You can hack it though: blend on oval (or circular) region over the screen to only leave a non-rectangular area visible.

Otherwise, the technique you''re looking for is probably the fisheye lens effect (linear transformation onto a rectangular surface such as the screen is also a lens-derived effect). Since the graphics card doesn''t support fisheye-mapping directly, you might want to use some extensions or grab the frame buffer and tessellate it with modified vertex coordinates.

That is, if I understood your question correctly.





"Literally, it means that Bob is everything you can think of, but not dead; i.e., Bob is a purple-spotted, yellow-striped bumblebee/dragon/pterodactyl hybrid with a voracious addiction to Twix candy bars, but not dead."- kSquared
Brother Bob
Brother Bob
glViewport only use width and height to describe the shape of the viewport, so it can only be a rectangle. But you can simulate any viewport shape using the stencil buffer. And using the destination alpha channel, you can not only get an arbitrary shape, but also an arbitrary degree of "visibility" (like a blurry edge you see in the movies when someone looks in a pair of binoculars).

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.