1
$\begingroup$

I'm having problems when using the following statement on different GPUs:

glTexSubImage3D(target, 0, 0, 0, 0, width, height, layers, format, type, NULL);

on NVIDIA cards "format = GL_RGBA" throws a fatal error that causes the program to crash, but it works and throws no errors if I use the sized version "format = GL_RGBA8"

on AMD cards "format = GL_RGBA" works and throws no errors, "format = GL_RGBA8" also works, but throws the error "GL_INVALID_ENUMERATION"

--

I'm currently using GL_RGBA8, so it works on both cards, but I wonder if there is a way to do this that throws no errors on either card.

--

Here's the spec for glTexSubImage3D from Khronos.org

format

Specifies the format of the pixel data. The following symbolic values are accepted: GL_RED, GL_RG, GL_RGB, GL_BGR, GL_RGBA, GL_DEPTH_COMPONENT, and GL_STENCIL_INDEX.

--

I'm using opengl 4.3 core profile, glfw and glew. Here is my texStorage statement called before glTexSubImage3D

internalFormat = GL_RGBA8;
glTexStorage3D(target, 1, internalFormat, width, height, layers);

per the comments, the other values are

target = GL_TEXTURE_2D;
width = 4096;
height = 4096;
layers = 1;
format = GL_RGBA8;
type = GL_UNSIGNED_BYTE;

--

Am I using this incorrectly? Is there a way to satisfy both implementations?

$\endgroup$
  • $\begingroup$ Passing NULL to TexSubImage functions is not allowed. You need to fix that, regardless of the rest of your parameters. $\endgroup$ – Nicol Bolas Aug 14 '18 at 13:15
  • $\begingroup$ Yup, that fixed everything. I guess in the case of NVIDIA, 2 wrongs made a right? Add your comment as an answer, and I will accept it as the answer. $\endgroup$ – Kyy13 Aug 14 '18 at 17:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.