Skip to content

Commit

Permalink
libgui|GLState: Querying a normalized viewport rectangle
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Mar 15, 2014
1 parent bda89f6 commit 7781be4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions doomsday/libgui/include/de/gui/glstate.h
Expand Up @@ -157,6 +157,7 @@ class LIBGUI_PUBLIC GLState
gl::ColorMask colorMask() const;
GLTarget &target() const;
Rectangleui viewport() const;
Rectanglef normalizedViewport() const;
bool scissor() const;
Rectangleui scissorRect() const;

Expand Down
10 changes: 10 additions & 0 deletions doomsday/libgui/src/glstate.cpp
Expand Up @@ -559,6 +559,16 @@ Rectangleui GLState::viewport() const
d->props[ViewportHeight]);
}

Rectanglef GLState::normalizedViewport() const
{
GLTarget::Size const size = target().size();
Rectangleui const vp = viewport();
return Rectanglef(float(vp.left()) / float(size.x),
float(vp.top()) / float(size.y),
float(vp.width()) / float(size.x),
float(vp.height()) / float(size.y));
}

bool GLState::scissor() const
{
return d->props.asBool(Scissor);
Expand Down

0 comments on commit 7781be4

Please sign in to comment.