I’m trying create a texture in OGL that i can use to render on the fly too.
int textureID = createTextureID();
ByteBuffer imageBuffer = ByteBuffer.allocateDirect( sizeX * sizeY * channelsTrue );
imageBuffer.order( ByteOrder.nativeOrder() );
byte[] data = new byte[ sizeX * sizeX * channelsTrue ];
imageBuffer.put( data, 0, data.length);
imageBuffer.flip();
// Create the texture and store it on the video card
GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, channels, sizeX, sizeY, 0, type, GL11.GL_UNSIGNED_INT, imageBuffer);
I am wondering if I am doing it corectally as whenever I try to execute this code I get a JVM crash.
Any help would be apreciated.
