LWJGL Forum

Programming => OpenGL => Topic started by: concerto on August 16, 2011, 11:57:07

Title: glTexSubImage2D error
Post by: concerto on August 16, 2011, 11:57:07
GL11.glTexImage2D(target, 0, pixelFormat, width, height, 0, srcPixelFormat, GL11.GL_UNSIGNED_BYTE, (ByteBuffer) null);
GL11.glTexSubImage2D(target, 0, 0, 0, texWidth, texHeight, srcPixelFormat, GL11.GL_UNSIGNED_BYTE, textureBuffer);


Where width/height is a power of 2 and texWidth/texHeight is the original dimension. pixelFormat/srcPixelFormat is GL11.GL_RGBA ... I tried some other formats but failed too.

This works on AMD and Intel but for some reason it crashes on Nvidia cards. Does anyone have a solution? Is a hack required? Thanks.
Title: Re: glTexSubImage2D error
Post by: Fool Running on August 16, 2011, 12:49:17
It would help a lot if we knew what error you're getting. :P
Title: Re: glTexSubImage2D error
Post by: concerto on August 16, 2011, 13:18:10
OpenGL error 1282 invalid operation
Title: Re: glTexSubImage2D error
Post by: Matthias on August 16, 2011, 17:05:13
I use this way for uploading texture since ages - and it works everywhere. So it is most likely an error in your code.
Title: Re: glTexSubImage2D error
Post by: jediTofu on August 18, 2011, 03:23:56
http://www.opengl.org/sdk/docs/man/xhtml/glTexSubImage2D.xml

Read the very bottom of the page; it has descriptions for possible INVALID_OPERATIONs

EDIT:  you're passing null as your last value to glTexImage2D
Title: Re: glTexSubImage2D error
Post by: concerto on August 31, 2011, 06:46:22
Thanks for the responses. I tried not passing null but it doesn't work either. Note that this does work on AMD/Intel but just not Nvidia which is alright weird.

I've moved to hacking the png to be the right size when it's loaded for now. Will look into it again later.