FossilOrigin-Name: b55b31d1bbac4d060b641f5c9bc0407cc4f5f11ef64d5c4f28b80d6934fe318f
55 lines
1.5 KiB
Objective-C
55 lines
1.5 KiB
Objective-C
/*
|
|
* Copyright (c) 2022 Jonathan Schleifer <js@nil.im>
|
|
*
|
|
* All rights reserved.
|
|
*
|
|
* This file is part of Obj3DEngine. It may be distributed under the terms of
|
|
* the Q Public License 1.0, which can be found in the file LICENSE.QPL
|
|
* included in the packaging of this file.
|
|
*
|
|
* Alternatively, it may be distributed under the terms of the GNU General
|
|
* Public License, either version 2 or 3, which can be found in the file
|
|
* LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of
|
|
* this file.
|
|
*/
|
|
|
|
#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
|