Hi, I am trying to dynamically edit an image.
I have put the pixels into a byte buffer and then made a byte array from that.
How can i set and get a single pixel at x,y?
Thanks
public void GetPixelsFromImage()
{
int size = m_iWidth*m_iHeight*16;
GL11.glBindTexture(GL11.GL_TEXTURE_2D, m_iTextureID);
m_bbPixels = ByteBuffer.allocateDirect(size);
GL11.glGetTexImage(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, GL11.GL_INT, m_bbPixels);
m_pixels = new byte[size];
m_bbPixels.get(m_pixels);
}
public void SetPixels()
{
GL11.glBindTexture(GL11.GL_TEXTURE_2D, m_iTextureID);
GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA8, m_iWidth, m_iHeight, 0,GL11.GL_RGBA, GL11.GL_INT, m_bbPixels);
}
public void CopyPixelsToByteBuffer()
{
m_bbPixels.put(m_pixels);
}
public void SetPixel(int x, int y, int rgb)
{
///???????
}
public int GetPixel(int x, int y)
{
///???????
}