[TheGreatCube] Set the viewport of the view

This commit is contained in:
Eryn Wells 2015-11-14 23:58:08 -08:00
parent c1fbf7bf95
commit 02b9d4d7d8
2 changed files with 6 additions and 4 deletions

View file

@ -654,7 +654,7 @@
<window key="window" title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" releasedWhenClosed="NO" showsToolbarButton="NO" visibleAtLaunch="NO" animationBehavior="default" id="IQv-IB-iLA">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="196" y="240" width="480" height="270"/>
<rect key="contentRect" x="196" y="240" width="604" height="379"/>
<rect key="screenRect" x="0.0" y="0.0" width="1680" height="1027"/>
</window>
<connections>
@ -663,7 +663,7 @@
</windowController>
<customObject id="Oky-zY-oP4" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="75" y="250"/>
<point key="canvasLocation" x="137" y="304.5"/>
</scene>
<!--View Controller-->
<scene sceneID="hIz-AP-VOD">
@ -693,7 +693,7 @@
</viewController>
<customObject id="rPt-NT-nkU" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="75" y="655"/>
<point key="canvasLocation" x="137" y="775"/>
</scene>
</scenes>
</document>

View file

@ -21,7 +21,9 @@ class ViewController: NSViewController {
class FrameRenderer: Renderer.FrameRenderer {
func renderAtTime(time: FrameTimeStamp) {
func renderOntoSurface(surface: RenderingSurface, atTime time: FrameTimeStamp) {
glClear(GLbitfield(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT))
let bounds = surface.bounds
glViewport(GLint(bounds.origin.x), GLint(bounds.origin.y), GLint(bounds.size.width), GLint(bounds.size.height))
}
}