html - WebGL in QuickLook -
is possible use webgl in quicklook plugin?
i followed tutorial replacing relevant code in generatepreviewforurl.m
with
osstatus generatepreviewforurl(void *thisinterface, qlpreviewrequestref preview, cfurlref url, cfstringref contenttypeuti, cfdictionaryref options) { nsstring *_content = [nsstring stringwithcontentsofurl:(__bridge nsurl *)url encoding:nsutf8stringencoding error:nil]; nsstring* path = @"/users/myusername/downloads/todoql/demo.html"; nserror *error = nil; nsstring* _html = [nsstring stringwithcontentsoffile:path encoding:nsutf8stringencoding error:&error]; if(error) { // if error object instantiated, handle it. nslog(@"error while loading file: %@", error); } nslog(@"\n%@\n",_html); qlpreviewrequestsetdatarepresentation(preview,(__bridge cfdataref)[_html datausingencoding:nsutf8stringencoding],kuttypehtml,null); return noerr; } void cancelpreviewgeneration(void *thisinterface, qlpreviewrequestref preview) { // implement if supported }
for debugging, set discard contents of of file quicklook given , rather render local html file located @ /users/myusername/downloads/todoql/demo.html
.
i use this barebones webgl example, altering slight show gl context not being loaded:
gl = canvas.getcontext("experimental-webgl"); if(!gl) { document.body.innerhtml = ":-("; return; }
indeed, running /usr/bin/qlmanage -p example.example
shows disappointed face rather webgl demo.
in safari, demo works long "enable webgl". need enable webgl somehow quicklook plugins? how?
Comments
Post a Comment