glTexSubImage2D error

Started by concerto, August 16, 2011, 11:57:07

Previous topic - Next topic

concerto

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.
High performance, fast network, affordable price VPS - Cloud Shards
Available in Texas, New York & Los Angeles
Need a VPS Upgrade?

Fool Running

It would help a lot if we knew what error you're getting. :P
Programmers will, one day, rule the world... and the world won't notice until its too late.Just testing the marquee option ;D

concerto

OpenGL error 1282 invalid operation
High performance, fast network, affordable price VPS - Cloud Shards
Available in Texas, New York & Los Angeles
Need a VPS Upgrade?

Matthias

I use this way for uploading texture since ages - and it works everywhere. So it is most likely an error in your code.

jediTofu

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
cool story, bro

concerto

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.
High performance, fast network, affordable price VPS - Cloud Shards
Available in Texas, New York & Los Angeles
Need a VPS Upgrade?