我想开发一个基于webGL的应用程序,用于数据分析和数据可视化,以表示2D/3D图形图表(线性聊天,饼图,条形图等...).在webGL中有没有这样的开源库?如果没有在webGL中,OpenGL中有任何这样的库..
如果不在openGL中,那么有任何最好的工具(基于桌面或基于Web的应用程序)用于数据分析和数据可视化.这些工具可以像提供数据输入一样,并且应该能够最终可视化数据.
或者我开发webGL应用程序很容易,我应该能够将.csv或.xls文件作为输入?
下面的代码帮助我使用libjpg将OpenGL输出转换为JPEG图像,但生成的图像垂直翻转...
代码工作完美,但最终图像翻转我不知道为什么?!
unsigned char *pdata = new unsigned char[width*height*3];
glReadPixels(0, 0, width, height, GL_RGB, GL_UNSIGNED_BYTE, pdata);
FILE *outfile;
if ((outfile = fopen("sample.jpeg", "wb")) == NULL) {
printf("can't open %s");
exit(1);
}
struct jpeg_compress_struct cinfo;
struct jpeg_error_mgr jerr;
cinfo.err = jpeg_std_error(&jerr);
jpeg_create_compress(&cinfo);
jpeg_stdio_dest(&cinfo, outfile);
cinfo.image_width = width;
cinfo.image_height = height;
cinfo.input_components = 3;
cinfo.in_color_space = JCS_RGB;
jpeg_set_defaults(&cinfo);
/*set the quality [0..100] */
jpeg_set_quality (&cinfo, 100, true);
jpeg_start_compress(&cinfo, true);
JSAMPROW row_pointer;
int row_stride = width * 3;
while (cinfo.next_scanline < cinfo.image_height) { …Run Code Online (Sandbox Code Playgroud) 如使用OAuth 2.0 的google开发者页面中所述,我为相应的客户端ID创建了唯一的URL
URL的格式是:
https://accounts.google.com/o/oauth2/auth?
scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile&
state=%2Fprofile&
redirect_uri=https%3A%2F%2Foauth2-login-demo.appspot.com%2Foauthcallback&
response_type=token&
client_id=812741506391.apps.googleusercontent.com
Run Code Online (Sandbox Code Playgroud)
用户可以登录并重定向到我的重定向URL,但问题是,当我尝试使用jquery解析响应时,它会导致失败,而不是成功.
我在我的重定向网址页面中使用以下javascript:
<script>
// First, parse the query string
var acc_token;
var params = {}, queryString = location.hash.substring(1),
regex = /([^&=]+)=([^&]*)/g, m;
while (m = regex.exec(queryString)) {
if(m[1]=="access_token")
acc_token = m[2];
params[decodeURIComponent(m[1])] = decodeURIComponent(m[2]);
}
// And send the token over to the server
var req = new XMLHttpRequest();
// consider using POST so query isn't logged
req.open('GET', 'https://' + window.location.host + '/catchtoken?' + queryString, true);
req.onreadystatechange = …Run Code Online (Sandbox Code Playgroud)