FossilOrigin-Name: 6ca1c3b3060a245b3244e4b7f60d4fad266f52fc5802179e6ad8607c8b91a5d3
59 lines
1.7 KiB
Objective-C
59 lines
1.7 KiB
Objective-C
/*
|
|
* Copyright (c) 2022, 2023 Jonathan Schleifer <js@nil.im>
|
|
*
|
|
* All rights reserved.
|
|
*
|
|
* This program is free software: you can redistribute it and/or modify it
|
|
* under the terms of the GNU Lesser General Public License version 3.0 only,
|
|
* as published by the Free Software Foundation.
|
|
*
|
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
|
* version 3.0 for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
* version 3.0 along with this program. If not, see
|
|
* <https://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#import <ObjFW/ObjFW.h>
|
|
|
|
#import "O3DGlideRenderer.h"
|
|
|
|
@interface TestsAppDelegate: OFObject <OFApplicationDelegate>
|
|
@end
|
|
|
|
OF_APPLICATION_DELEGATE(TestsAppDelegate)
|
|
|
|
@implementation TestsAppDelegate
|
|
- (void)applicationDidFinishLaunching: (OFNotification *)notification
|
|
{
|
|
O3DGlideRenderer *renderer = [[[O3DGlideRenderer alloc]
|
|
initWithResolution: OFMakeSize(640, 480)
|
|
bitsPerPixel: 16
|
|
refreshRate: 60
|
|
options: nil] autorelease];
|
|
|
|
const O3DVertex outerTriangle[] = {
|
|
{{ -1, -1, 0 }, { 1, 0, 0 }},
|
|
{{ 0, 1, 0 }, { 0, 1, 0 }},
|
|
{{ 1, -1, 0 }, { 0, 0, 1 }}
|
|
};
|
|
const O3DVertex innerTriangle[] = {
|
|
{{ -0.5, 0.5, 0 }, { 1, 1, 0 }},
|
|
{{ 0, -0.5, 0 }, { 0, 1, 1 }},
|
|
{{ 0.5, 0.5, 0 }, { 1, 0, 1 }}
|
|
};
|
|
|
|
OFDate *startDate = [OFDate date];
|
|
while (-startDate.timeIntervalSinceNow < 5) {
|
|
[renderer beginFrame];
|
|
[renderer drawPolygonWithVertices: outerTriangle count: 3];
|
|
[renderer drawPolygonWithVertices: innerTriangle count: 3];
|
|
[renderer endFrame];
|
|
}
|
|
|
|
[OFApplication terminate];
|
|
}
|
|
@end
|