Texture maps appear black in WebGL examples - three.js

I am using an ebook guide "WebGL up-and-running" to learn WebGL. The ebook has an accompanying repository on GitHub to run some examples. The examples work fine (animation, shape, camera movement, etc.) when I run them except the textures aren't right (most appear black while others don't appear in the browser). The problem doesn't lie with the code (I think) as I didn't touch it since downloading from GitHub.
The only instruction from the guide that I didn't follow is a single paragraph that states:
"Finally, get all of this onto a web server. You will need to serve up your pages in order for most of the samples in the book to work. I run a local version of a standard LAMP stack on my MacBook…but all you really need is the “A” part of LAMP (i.e., a web server such as Apache)."
I have no idea what a web server does in this context and don't know how to install it. Could this be the problem? If so please assist me in getting started with a web server. If not, what else could cause the example models not to render properly?
When I run examples from https://threejs.org/examples all of them work fine.

Related

How can you tell whether a website is using the LAMP or MEAN Stack when looking at the script in the developer panel?

I'm starting to learn the basics of LAMP and MEAN. I'd like to dive in by learning LAMP first.
There's a website that I like to replicate, but I don't know whether it's using LAMP or MEAN.
How can I tell the difference by taking a cursory look within the developer panel in the Chrome browser?
I assume the good framework is using REST or LESS or something that does not include a file extension in the URL (.php, .html etc)
you can use guess.scritch.org/ or... a new post with the chrome dev tool method will be posted in a minute.

Dagre-D3 or D3 not working on different server

Hy, so unfortunately i cant post my hole source code, neither can i link to it.
But because of this, I'm ok if i don't get a concrete answer, just some guidance.
So my situation is this:
I have made, with the help of dagre-d3.js and d3.js a hierarchy organizational chart. It works perfectly on local (WAMP) environment, but when i try it on the live server, which runs linux (ubuntu), not all the functions are working correctly.
But what i don't understand is that the functions that are not working 100% percent are just front-end svg stuff, so there is no back-end connection when i try these operations.
Locally i tested it with windows 7, 8 on wamp and in chrome, firefox, even internet explorer, and every functionality works, when i load it from the server, some functionalities are not working. And the fact is that i don't get any error messages, so its not like d3.js or dagre-d3.js isnt correctly loadded, because it is, the graph is rendered correctly.
So to finish up, my question is this, can there be some server side configuration which interferes with the rendered SVG graph? And if no, then where should i start looking? How to even check wheres the problem?
Thank you in advance for any kind of guidance.
Ok, so at last i figured it out.
On the live server there was a different version of php which, when using json_encode converted the ids to strings, and because of this the dagre-d3 plugin didn't work as it should have, some functionalities did, but not all.

Need basic step by step instructions to get Flexpaper on to clients website

Greetings o knowledgeable ones,
I may have bitten off more than I can chew and this is the reason why I'm here!
I'm a beginner/intermediate front end coder and I have a client who has asked me to use Flexpaper to view their PDF catalogues on their website.
I know little about PHP and server side stuff (hell, I barely know front end code) and for the life of me I cant find a step by step instruction on how to upload the viewer and the PDFs on to the website/server.
I've read a couple of answers on the website that give me a glimpse into what I need to do but they seem to fall short of a complete answer.
I tried to using the 'Server Publishing' option in my local machine (using MAMP) but got stuck half way through when permissions where denied. Then found an answer eluding to the possibility of publishing to the web using the 'FlexPaper Desktop Publisher Zine' So I downloaded that and published a PDF and now I have a folder that was created on my machine but I'm a little lost from as to what to do next?
Some specific questions I have:
Do I upload the whole folder to the server and if I do what is the
code I have to include on a web page to access this Flexpaper PDF?
Do I need to upload any other applications/helper files to make the
viewer work on the website?
I have multiple PDFs(approx 15) I need to upload - is using the
'Desktop Publisher' to create each PDF the best way to do this? Or
should I use the 'Server Publishing' solution?
Why have I charged my client so little for so much work!?
Flexpaper seems like a great option for viewing PDFs online but it seems to be lacking in a beginning-to-end process of how to implement it onto websites. Unless I am missing something....
I am not a smart man.
Thanks and peace

Web Performance

Im working on a large site, trying to decrease the load times, and I have bumped into a rather strange issue. Im using google chromes built in developer tools, and I am finding that certain images are getting hung up, and the browser is continuing to look for them. Has anyone encountered this issue before? How do I isolate what is causing this problem?
The site runs a couple of ads, is it possible this error is occurring because of ad networks?
Here is a link to the actual problem: http://i.stack.imgur.com/IEtLA.png (updated)
If you have not done already, use a tool like http://www.webpagetest.org/ to test your site. It will test the site from nominated locations around the world, with the browser of your choice, and you will get waterfall charts for your page.
Just an idea.... If not yet done, try Google's free website testing and optimization tool 'Website Optimizer'. See what it tells you.
Another idea, try accessing the site with another browser, either one, IE, Safari, or FireFox, to see if you get the same issue; if you do then it may be the server for some reason not serving those images.
One more.... To isolate further, if possible, try using only few (one or two) images in your site/pages; if these load then add one or two more images until you encounter the issue, then that image has something and you may replace that image.

Map Tile Caching for Offline Viewing

I'm trying to build an application that will use open source maps from Open Street Maps (though the concept should be applicable to any map provider). The application will enable the user to specify a number of waypoints along a route prior to departure.
Because I don't have a data plan for my cell phone (and because rambling in the countryside rarely gives you a good connection), I want to be able to pre-load the relevant map tiles for the waypoints and/or route before departure so that maps can continue to be used without a data connection.
My initial thoughts are to download the required tiles from the map provider and store them in isolated storage. However, the Bing Maps control implementation, which uses the TileSource class relies on returning an absolute URI that it can download the tile(s) from, which clearly won't work with data stored in isolated storage.
The question has already been asked: Windows Phone 7 Map Control with custom layer in offline mode, but wasn't answered and I'm wondering if since then anyone has cracked the problem.
I've seen this done with a custom layer placed over the map. Tiles are then loaded from anywhere you like (IsolatedStorage, online, somehwere else?) into the custom layer.
Sorry, I don't have any code I can share which demonstrates this at the moment but am currently doing something very similar.
I built a small prototype using OpenStreetMaps for Android. I think it might be interesting to look at the repository and therefore, find a solution similar to mine. I did download the maps before hand, but maybe you can use an online solution for this. This is the repo: https://github.com/kikofernandez/OpenStreetMapExample and the video of how it could look like: https://vimeo.com/40619538.
I used for this prototype OpenLayers, OpenStreetMaps, JavaScript and a WebView in Android. I would like to give you further details but it was just a prototype.
If you can store the data locally (embed it in the XAP), you can reference it via an absolute URI. Chris Walshie talks about it here.
So, for example, once you have the installation path for the app, you can reference the resource like this:
Uri toResource = new Uri("file:///Applications/Install/4FFA38B5-00AF-4760-A7EB-7C0C0BC1D31A/Install/EMBEDDED_RESOURCE", UriKind.Absolute);
Have you set the Build Action on your image(s) to Content?
If your app is running on WP8 then use the built in maps control in the Windows Phone 8 SDK as this already supports offline maps out of the box. If targeting WP7 it is possible to get offline maps to work but takes a lot of work. I created this for a customer a few years ago and I believe that it took me a little over 3000 lines of code to do. Mind you they wanted to also have a framework for adding tiles from various sources such as downloading over and area and downloading zipped files. They way I managed to get the rendering to work was to a canvas to the map without setting it's position. This will be default make it a child of the map but it will not move. I then made the canvas the same size as the map and used the resize event to resize the canvas should the map be resized. I then used the view change event to trigger a method to render the tiles. When this event fired I first calculated all the tiles in view using the code found here: http://msdn.microsoft.com/en-us/library/bb259689.aspx
I then would pull the tiles from isolated storage and draw them on the canvas. For performance I keep track of which tiles I added to the canvas so that if the tile was still in view I simply changed it's position rather than reloading it from isolated storage. I also removed any images that were no longer in view. Overall this works fine but there were some minor issues such as not having the smooth transition between zoom levels. If you really wanted that it is possible to get that to work but requires a lot more math. Also, if you zoom into an area where there is no tiles you end up with an empty map. You can create a custom map mode to prevent the user from going into areas where you don't have tiles.
A solution
The question is a bit old, but there's a solution for anyone who can use Qt.
The solution is not limited to the Windows Phone platform, I've done it targetting Android, and it also works on my desktop.
In Qt, you'll want to patch the OSM Plugin used by QtLocation. It's simple, quick and easy.
How to do it ?
A quick implementation could modify the QGeoTiledMappingManagerEngineOsm class to make it call your own QGeoTileFetcher instead of QGeoTileFetcherOsm.
There may be better ways to acheive this, but at least it works for me.
Basically, you make a fetcher that reads tiles from the filesystem instead of the network.
You build your filesystem database once, from an online resource for instance (see below) and you deploy it with your application for its offline use.
Where do I get tiles from ?
Information how to get the tiles to your offline implementation is available here :
http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames
Here are two sources for tiles that can be used for free :
Open Street Maps project servers
Mapquest Open Tiles servers
Take care of the licensing and terms of use.
Open Street Map
Project : wiki.openstreetmap.org/wiki/Main_Page
License : www.openstreetmap.org/copyright
Terms of use : wiki.openstreetmap.org/wiki/Tile_usage_policy
Servers are currently named like *.tile.openstreetmap.org
MapQuest-OSM Tiles
Project : developer.mapquest.com/web/products/open/map
License : opendatacommons.org/licenses/odbl/
Terms of use : developer.mapquest.com/web/info/terms-of-use
Servers are currently named like otile*.mqcdn.com
(Sorry for strange links : I haven't got enough reputation to post real links).

Resources