How Do I Get My OpenGL Context In NetworkListener Class?

Using Slick2D and Kryonet:

Lets say a server sends a (TCP) packet to a client with X and Y coordinates. The client receives this packet in the NetworkListener and the goal is to call drawString(“hihi”,x,y) respectively. The issue clearly is: there is not an OpenGL context in this thread to make this function call happen.

For your entertainment, I have tried the following with no success!

public class ClientStart extends StateBasedGame {

    /*  lots of networking code */

    public static void main(String[] args) {
    /*  code */
    }
}
public class NetworkListener extends Listener {
    ClientStart client;  // assume this has been initialized properly to the main class
    
    /*  more missing code */

    public void received(Connection con, Object obj) {

    client.getContainer().getGraphics().drawString("hihi",x,y);  // this fails.

    }
}

How should the client go about ‘finding’ the current GameState (which contains the OpenGL context), or better yet, how should one attack this problem?

Thank you :slight_smile: