{"action":"created","issue":{"url":"https://api.github.com/repos/openframeworks/openFrameworks/issues/5300","repository_url":"https://api.github.com/repos/openframeworks/openFrameworks","labels_url":"https://api.github.com/repos/openframeworks/openFrameworks/issues/5300/labels{/name}","comments_url":"https://api.github.com/repos/openframeworks/openFrameworks/issues/5300/comments","events_url":"https://api.github.com/repos/openframeworks/openFrameworks/issues/5300/events","html_url":"https://github.com/openframeworks/openFrameworks/issues/5300","id":181544874,"number":5300,"title":"Rendering ofFbo to float textures with ES 2.0","user":{"login":"aferriss","id":3698659,"avatar_url":"https://avatars.githubusercontent.com/u/3698659?v=3","gravatar_id":"","url":"https://api.github.com/users/aferriss","html_url":"https://github.com/aferriss","followers_url":"https://api.github.com/users/aferriss/followers","following_url":"https://api.github.com/users/aferriss/following{/other_user}","gists_url":"https://api.github.com/users/aferriss/gists{/gist_id}","starred_url":"https://api.github.com/users/aferriss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aferriss/subscriptions","organizations_url":"https://api.github.com/users/aferriss/orgs","repos_url":"https://api.github.com/users/aferriss/repos","events_url":"https://api.github.com/users/aferriss/events{/privacy}","received_events_url":"https://api.github.com/users/aferriss/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-10-06T22:49:53Z","updated_at":"2016-10-07T08:36:31Z","closed_at":null,"body":"ofTexture is setup so that it can take parameters to create a float texture targeting ES 2.0 like so:\r\n`void ofTexture::allocate(int w, int h, int glInternalFormat, int glFormat, int pixelType)`\r\nor in use:\r\n`tex.allocate(width, height, GL_RGBA,  GL_HALF_FLOAT_OES, GL_RGBA);`\r\n\r\nI could be missing something, but from what I can tell if you want to have an ofFbo render into a float texture, currently you will have to modify the createAndAttachTexture() function inside ofFbo.\r\n\r\nRight now it looks like this: \r\n````\r\nvoid ofFbo::createAndAttachTexture(GLenum internalFormat, GLenum attachmentPoint) {\r\n\t\r\n\tofTextureData texData;\r\n\r\n\ttexData.textureTarget = settings.textureTarget;\r\n\ttexData.width = settings.width;\r\n\ttexData.height = settings.height;\r\n\ttexData.glInternalFormat = internalFormat;\r\n\ttexData.bFlipTexture = false;\r\n\ttexData.wrapModeHorizontal = settings.wrapModeHorizontal;\r\n\ttexData.wrapModeVertical = settings.wrapModeVertical;\r\n\ttexData.magFilter = settings.maxFilter;\r\n\ttexData.minFilter = settings.minFilter;\r\n\r\n\tofTexture tex;\r\n\ttex.allocate(texData);\r\n\r\n    attachTexture(tex, internalFormat, attachmentPoint);\r\n\tdirty.push_back(true);\r\n\tactiveDrawBuffers.push_back(GL_COLOR_ATTACHMENT0 + attachmentPoint);\r\n}\r\n````\r\n\r\nBut neither ofTextureData or ofFbo::Settings seem to have a glFormat attribute. So you could do something terrible like this and make all your fbo textures float textures : \r\n\r\n```` \r\nvoid ofFbo::createAndAttachTexture(GLenum internalFormat, GLenum attachmentPoint) {\r\n\r\n\tofTexture tex;\r\n\ttex.allocate(settings.width, settings.height,  GL_RGBA,  GL_HALF_FLOAT_OES, GL_RGBA);\r\n\r\n    attachTexture(tex, internalFormat, attachmentPoint);\r\n\tdirty.push_back(true);\r\n\tactiveDrawBuffers.push_back(GL_COLOR_ATTACHMENT0 + attachmentPoint);\r\n}\r\n````\r\nOr perhaps a better way would just be to add the glFormat attribute to both ofTextureData and ofFbo::Settings. And then if there is a glFormat in ofTextureData it can just bubble down to fill in the glType.\r\n\r\nThis isn't an issue with GL ES > 2.0 since when you allocate a fbo you can give it the GL_RGBA32F, but since that doesn't exist in 2.0 we have this problem. \r\n\r\nIs this just something that was overlooked? Am I overlooking the solution? Or just too niche of a scenario for anyone to have noticed until now?"},"comment":{"url":"https://api.github.com/repos/openframeworks/openFrameworks/issues/comments/252183733","html_url":"https://github.com/openframeworks/openFrameworks/issues/5300#issuecomment-252183733","issue_url":"https://api.github.com/repos/openframeworks/openFrameworks/issues/5300","id":252183733,"user":{"login":"arturoc","id":48240,"avatar_url":"https://avatars.githubusercontent.com/u/48240?v=3","gravatar_id":"","url":"https://api.github.com/users/arturoc","html_url":"https://github.com/arturoc","followers_url":"https://api.github.com/users/arturoc/followers","following_url":"https://api.github.com/users/arturoc/following{/other_user}","gists_url":"https://api.github.com/users/arturoc/gists{/gist_id}","starred_url":"https://api.github.com/users/arturoc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arturoc/subscriptions","organizations_url":"https://api.github.com/users/arturoc/orgs","repos_url":"https://api.github.com/users/arturoc/repos","events_url":"https://api.github.com/users/arturoc/events{/privacy}","received_events_url":"https://api.github.com/users/arturoc/received_events","type":"User","site_admin":false},"created_at":"2016-10-07T08:36:31Z","updated_at":"2016-10-07T08:36:31Z","body":"we removed glFormat from ofTextureData cause it's something that in desktop you only use for specifying the format of the data you are going to upload so it made more sense to just have it as a parameter for loadData but i didn't knew that in ES you can use it to allocate a different texture type. I don't think we should bring it back or at least not for desktop since it doesn't make much sense as texture state there.\r\n\r\nOne option and something i've been wanting to add for a while is to have a new Settings object in ofFbo that allowed to pass a vector of ofTexture to attach to the fbo that way the allocation of the texture is much more flexible and only ofTexture has to deal with it and the allocation of the fbo becomes much more simple too.\r\n\r\n"}}
{"actor":{"display_login":"arturoc"}}