using glReadPixels with ByteBuffer

I’ve been banging my head over this. Any help would be greatly appreciated! I’m trying to get color picking to work with my project. It uses OpenGL in Java (lwjgl).

So I’m using a simple loop to give each new primitive rendered a unique color with:
glColorub(ubColor[0], ubColor[1], ubColor[2]) , where ubColor loops through 0-255 for each cell. I know this much is working correctly.

The problem arises when I try and read the ByteBuffer after calling glReadPixels. I get junk values, like 0, -52 and -1. They don’t seem to change for most primitives either. I’ve included what I think is the important code below.

  

        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glDisable(GL11.GL_FOG);
        GL11.glDisable(GL11.GL_LIGHTING);
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);

    	
    	int nWidth = 1; 
    	int nHeight = 1;
        ByteBuffer pRGB = ByteBuffer.allocateDirect(3);
    	
        ////Render Primitives here
        ColorPicking.renderSector(0);
        ////
        
        //Window height is 600
        // x and y are mouse location
		GL11.glReadPixels( x,600 - y, 1, 1, GL11.GL_RGB, GL11.GL_UNSIGNED_BYTE, pRGB);

		pRGB.rewind();
		
		System.out.print("First:");
		System.out.print(pRGB.get());
		System.out.print("Second:");
		System.out.print(pRGB.get());
		System.out.print("Third:");
		System.out.print(pRGB.get());