Posted by
Wade Walker on
Feb 23, 2011; 3:37pm
URL: https://forum.jogamp.org/glTexImage-performance-tp2555613p2560730.html
Ondrej wrote
By the way, how can I see the code at GL4bcImpl.java:23832 ? Cound not found it in repositories. Is this the part of code which is generated by gluegen?
Yes, GL4bcImpl.java is generated by gluegen as part of the build process. The method in your stack trace is this:
/** Entry point to C language function: <code> void {@native glTexImage2D}(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid * pixels); </code> <br>Part of <code>GL_VERSION_1_0</code> */
public void glTexImage2D(int target, int level, int internalFormat, int width, int height, int border, int format, int type, Buffer pixels) {
checkUnpackPBODisabled(true);
Buffers.rangeCheckBytes(pixels, imageSizeInBytes(format, type, width , height , 1 , false));
boolean pixels_is_direct = pixels != null && Buffers.isDirect(pixels);
final long __addr_ = ((GL4bcProcAddressTable)_context.getGLProcAddressTable())._addressof_glTexImage2D;
if (__addr_ == 0) {
throw new GLException("Method \"glTexImage2D\" not available");
}
dispatch_glTexImage2D1(target, level, internalFormat, width, height, border, format, type, pixels_is_direct ? pixels : Buffers.getArray(pixels), pixels_is_direct ? Buffers.getDirectBufferByteOffset(pixels) : Buffers.getIndirectBufferByteOffset(pixels), pixels_is_direct, __addr_);
}
Line 23832 is dispatch_glTexImage2D1(), which is the native function.
Ondrej wrote
Looks like no big performance differences whether using direct or indirect buffers. (tested on notebook with poor graphic card)
I'd expect higher performance when reading a file into a texture when it's a direct buffer, since Java should be able to use native I/O. You might have to read tons of data to see a difference, though.