{"action":"created","issue":{"url":"https://api.github.com/repos/mrdoob/three.js/issues/386","repository_url":"https://api.github.com/repos/mrdoob/three.js","labels_url":"https://api.github.com/repos/mrdoob/three.js/issues/386/labels{/name}","comments_url":"https://api.github.com/repos/mrdoob/three.js/issues/386/comments","events_url":"https://api.github.com/repos/mrdoob/three.js/issues/386/events","html_url":"https://github.com/mrdoob/three.js/issues/386","id":1305877,"number":386,"title":"create a texture from a data array?","user":{"login":"larsberg","id":346072,"avatar_url":"https://avatars.githubusercontent.com/u/346072?v=3","gravatar_id":"","url":"https://api.github.com/users/larsberg","html_url":"https://github.com/larsberg","followers_url":"https://api.github.com/users/larsberg/followers","following_url":"https://api.github.com/users/larsberg/following{/other_user}","gists_url":"https://api.github.com/users/larsberg/gists{/gist_id}","starred_url":"https://api.github.com/users/larsberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/larsberg/subscriptions","organizations_url":"https://api.github.com/users/larsberg/orgs","repos_url":"https://api.github.com/users/larsberg/repos","events_url":"https://api.github.com/users/larsberg/events{/privacy}","received_events_url":"https://api.github.com/users/larsberg/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/mrdoob/three.js/labels/Question","name":"Question","color":"dad9ff"}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":10,"created_at":"2011-07-28T21:07:58Z","updated_at":"2016-08-26T02:41:02Z","closed_at":"2011-08-02T22:45:43Z","body":"Hi guys,\r\n\r\nI'd like to create at texture from an array but I can't seem to get it working correctly.  I'm trying to use the function below to create a texture but I get a black screen.  I think it's probably something I've missed down the line and I was hoping that you might be able to see what I'm missing. If there is a better way to do this sort of thing I'm all ears:)\r\n\r\nyou can see it here:\r\nhttp://thelablab.com/wp-content/labThree/lab/dataTextureTest.html\r\n\r\n\r\n         init(){\r\n            .....\r\n           //dataTex = THREE.ImageUtils.loadTexture( \"textures/ramp.png\" );   //this works\r\n            dataTex = createTextureFromData( numParticles, numAttributes, data.pixels);  //this doesn't :S\r\n\r\n            simpTexShader = new THREE.MeshShaderMaterial({\r\n                                                         uniforms: {inTex: { type: \"t\", value: 0, texture: dataTex } },\r\n                                                         vertexShader: document.getElementById( 'simpTex_vert' ).textContent,\r\n                                                         fragmentShader: document.getElementById( 'simpTex_frag' ).textContent\r\n                                                         });\r\n            .....\r\n            }\r\n         function createTextureFromData ( width, height, data, callback ) {\r\n             \r\n            texture = new THREE.Texture( );\r\n            texture.needsUpdate = false; // true;\r\n            texture.__webglTexture = gl.createTexture();\r\n            \r\n\t\t\t\tgl.bindTexture( gl.TEXTURE_2D, texture.__webglTexture );\r\n\t\t\t\t//gl.pixelStorei( gl.UNPACK_FLIP_Y_WEBGL, true );\r\n            \r\n            gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, width, height, 0, gl.RGBA, gl.UNSIGNED_BYTE, data);\r\n            texture.__webglInit = false; //true;\r\n            \r\n            gl.texParameteri( gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE );\r\n            gl.texParameteri( gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE );\r\n            gl.texParameteri( gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR );\r\n            gl.texParameteri( gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_NEAREST );\r\n            gl.generateMipmap( gl.TEXTURE_2D );\r\n            gl.bindTexture( gl.TEXTURE_2D, null )\r\n             \r\n            return texture;\r\n         };\r\n\r\nThanks!\r\nLars"},"comment":{"url":"https://api.github.com/repos/mrdoob/three.js/issues/comments/242610970","html_url":"https://github.com/mrdoob/three.js/issues/386#issuecomment-242610970","issue_url":"https://api.github.com/repos/mrdoob/three.js/issues/386","id":242610970,"user":{"login":"bruce25796","id":13309263,"avatar_url":"https://avatars.githubusercontent.com/u/13309263?v=3","gravatar_id":"","url":"https://api.github.com/users/bruce25796","html_url":"https://github.com/bruce25796","followers_url":"https://api.github.com/users/bruce25796/followers","following_url":"https://api.github.com/users/bruce25796/following{/other_user}","gists_url":"https://api.github.com/users/bruce25796/gists{/gist_id}","starred_url":"https://api.github.com/users/bruce25796/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bruce25796/subscriptions","organizations_url":"https://api.github.com/users/bruce25796/orgs","repos_url":"https://api.github.com/users/bruce25796/repos","events_url":"https://api.github.com/users/bruce25796/events{/privacy}","received_events_url":"https://api.github.com/users/bruce25796/received_events","type":"User","site_admin":false},"created_at":"2016-08-26T02:41:02Z","updated_at":"2016-08-26T02:41:02Z","body":" I implemented similarly with WebGL on chrome browser. But at run-time, WebGL gives:   WebGL: INVALID_ENUM: texImage2D: invalid type "}}
{"actor":{"display_login":"bruce25796"}}