You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I have the same question with #2401 .
Texture array doesn't work on my computer.(Ubuntu 20.04 x64 Opengl4.6)
I'm trying to render a cube with different textures on each side.
I use this code to load textures.
bgfx::TextureHandle handle = bgfx::createTexture2D(16, 16, false, 6, bgfx::TextureFormat::RGBA8); for (int i = 0; i < 6; i++) { ifstream inFile(textures[i], ios::in | ios::binary); inFile.seekg(0, ios_base::end); uint32_t size = inFile.tellg(); inFile.seekg(0, ios_base::beg); void* data = new char[size]; // Remember to free it inFile.read((char*)data, size); inFile.close(); if (NULL != data) { static bx::DefaultAllocator s_allocator; static bx::AllocatorI* g_allocator = &s_allocator; bimg::ImageContainer* imageContainer = bimg::imageParse(g_allocator, data, size); delete (char*)data; if (NULL != imageContainer) { const bgfx::Memory* mem = bgfx::makeRef( imageContainer->m_data, imageContainer->m_size, imageReleaseCb, imageContainer); bgfx::updateTexture2D( handle, i, 0, 0, 0, imageContainer->m_width, imageContainer->m_height, mem); } } }
f_simple.sc
`$input v_texcoord0
#include <bgfx_shader.sh>
SAMPLER2DARRAY(s_texColor, 0);
vec3 toLinear(vec3 _rgb)
{
return pow(abs(_rgb), vec3_splat(2.2) );
}
void main() {
gl_FragColor = texture2DArray(s_texColor, v_texcoord0);
}
`
How to fix it,please?
Beta Was this translation helpful? Give feedback.
All reactions