With video card acceleration, you can easily make your laptop a heater! _ Javascript skills

Source: Internet
Author: User
This article introduces how to easily create a heater with a video card! If you need it, you can refer to the many things that have been broken recently. I haven't been here to write whimsical things for a long time. But this morning I thought of something interesting, so it took me half an hour to think about it. By the way, let's share it.

When the weather is cold, or when frozen hands are frozen ~ So this hot notebook is just a hot tool for drying hands :)

What is lacking in the US is that when you don't want it to be hot at ordinary times, the fan is always flickering. I really want to make it hot now, but it is not awesome.

The solution is also very simple. There is a 3D game, and all the special effects are available, neither hot nor hot. However, this takes up a lot of system resources. It is better to create a "heater "!

The most popular hardware in the computer is the CPU and video card. These two hardware will not work unless the fan is crazy ~
I plan to use vc to write a simple small program that consumes CPU and GPU. However, for jsfans like me, I will think about any problem: can it be implemented on the web? Of course, the results are definitely dropping!
Currently, all browsers support GPU hardware acceleration. It is better to use js directly ~ Just a few lines of code can be done!

The code is very simple, that is, rendering images without stopping. After some streamlining, I simply removed the image and replaced it with a blank canvas. Our goal is not to make ourselves look beautiful, but to make hardware work!

Click here for a try: http://www.etherdream.com/FunnyScript/GPUHeater.html (ie9 is preferred)


The Code is as follows:





Heater


Heating...


Script
Var ctx = document. getElementById ('P'). getContext ('2d ');
Var src = document. getElementById ('p2 ');

SetInterval (function (){
For (var I = 0; I <1000; I ++)
Ctx. drawImage (src, 0, 0 );
}, 16 );
Script




Okay, simple enough code, but it does work and the fan starts to scream.
On ie9, the operation is exactly the same as imagined: the CPU usage is less than 1%, and the page is still rendered when it is minimized. The specific amount of heat has to be determined by the master Peng.

At first it was only 40 degrees, and the temperature began to soar in a short time. Because it is integrated graphics card, and the laptop hardware is relatively close, so the temperature is counted into the CPU...



Of course, we can also use Worker to create multiple threads and execute intensive operations to fully consume CPU resources ~
However, in order not to affect the running of other programs, CPU is not wasted here.
Let's talk about this. The above code is only ideal for ie9.
Currently, many Browsers Do not support HTML5 and Worker threads. To make the "online heater" more compatible, we will create a flash version when we are free next time and use stage3D to accelerate the GPU, and asynchronous Shader consumes 100% of the CPU...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.