0
我想创建一个web应用程序,直接转到互联网上的WEBGL示例之一,并将其显示在应用程序中。任何人都可以帮助我吗?如何使用webview显示webgl URL
我想创建一个web应用程序,直接转到互联网上的WEBGL示例之一,并将其显示在应用程序中。任何人都可以帮助我吗?如何使用webview显示webgl URL
找到了。
#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”
更多contenxt请... –
我尝试让使用一个UIWebView。而该应用程序视图中的简单的应用程序应该显示的内容一个网址,它是webgl样本的地址。 –