我想创建一个Web应用程序,它直接转到互联网上的WEBGL样本之一并在应用程序中显示。有人帮我吗?
答案 0 :(得分:0)
#import "WGLAppDelegate.h"
@implementation WGLAppDelegate
@synthesize window=_window;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
// Class ADWebView = NSClassFromString(@"ADWebView");
// UIWebView* webView = (UIWebView *)[[[ADWebView alloc] initWithFrame:self.window.bounds] autorelease];
// [webView setWebGLEnabled:YES];
UIWebView* webView = [[[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 300, 400)] autorelease];
id webDocumentView = [webView performSelector:@selector(_browserView)];
id backingWebView = [webDocumentView performSelector:@selector(webView)];
[backingWebView _setWebGLEnabled:YES];
NSString* htmlPath = [[NSBundle mainBundle] pathForResource:@"alphatexture" ofType:@"html"];
NSURLRequest* request = [NSURLRequest requestWithURL:[NSURL fileURLWithPath:htmlPath]];
[webView loadRequest:request];
UIViewController* viewController = [[[UIViewController alloc] init] autorelease];
viewController.view = webView;
self.window.rootViewController = viewController;
[self.window makeKeyAndVisible];
return YES;
}
@end
您可以在此处找到示例应用:" https://github.com/atnan/UIWebViewWebGL"