cannot edit: https://www.khronos.org/opengl/wiki/Image_Load_Store#Image_store
Instead of using glTexImage2D
, this should be glTexStorage2D
for provided e.g.
//Create the texture
glGenTextures(1,&m_textureId);
glBindTexture(GL_TEXTURE_2D, m_textureId);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
glBindTexture(GL_TEXTURE_2D, 0); //Unbind the texture
//Use the texture as an image
glBindImageTexture(4, m_textureId, 0, 0, 0, GL_READ_WRITE, GL_RGBA8UI);
asif_bahrainwala:
glTexStorage2D
Also why can’t I use glTexImage2D (this does not work) instead of glTexStorage2D
okay this is mentioned here:
https://www.khronos.org/opengl/wiki/Common_Mistakes
glGenTextures(1, &textureID);
glBindTexture(GL_TEXTURE_2D, textureID);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_BGRA, GL_UNSIGNED_BYTE, pixels);
Your name appears similar to the one who added this code snippet in the first place . Are you unable to log in? What was the problem with updating the code?
Hi,
Yes I had added that code snippet, I wanted to change it to use glTexStorage2D
but mentioning this is better: https://www.khronos.org/opengl/wiki/Common_Mistakes#Creating_a_complete_texture )
On editing the page
I get the following error:
[Y68SZAr8FG3GnWKf5xJKpgAAAEk] /opengl/wiki_opengl/index.php?title=Image_Load_Store&action=submit Error: Interface 'MediaWiki\Extension\AbuseFilter\Hooks\AbuseFilterAlterVariablesHook' not found
Backtrace:
from /home/khronos/public_html/opengl/wiki_opengl/extensions/TorBlock/includes/TorBlockAbuseFilterHooks.php(33)
#0 /home/khronos/public_html/opengl/wiki_opengl/includes/AutoLoader.php(244): require()
#1 [internal function]: AutoLoader::autoload(string)
#2 /home/khronos/public_html/opengl/wiki_opengl/vendor/wikimedia/object-factory/src/ObjectFactory.php(247): spl_autoload_call(string)
#3 /home/khronos/public_html/opengl/wiki_opengl/vendor/wikimedia/object-factory/src/ObjectFactory.php(152): Wikimedia\ObjectFactory\ObjectFactory::getObjectFromSpec(array, array)
.....
No, it isn’t. It’s better to direct people to the less error prone solution (glTexStorage2D
) than it is to tell them how to avoid a common mistake.
In any case, I don’t have any actual administrative control over the Wiki. I got the same error when I attempted to fix the page, so something there seems broken.
Hi @Alfonse_Reinheart
I have updated the page (pending review)