Slick Posted May 11, 2022 Share Posted May 11, 2022 (edited) Display d = new Display(); @Override public void onPaint(Graphics2D g){ log("aaaa"); g.setColor(Color.RED); d.drawModel(g, myPlayer().getGridX(), myPlayer().getGridY(), myPlayer().getZ(), myPlayer().getModel()); log("bbbb"); } trying out the Display api and when I call drawModel it seems like it is throwing an exception silently as I never saw the second message being printed on the console am I doing anything wrong here? I am trying to draw the outline of entities and tiles on screen, searched for some older posts in the forum but no luck EDIT: should be using getDisplay() rather than instantiating a new display class, all good now Edited May 11, 2022 by Slick Quote Link to comment Share on other sites More sharing options...
Khaleesi Posted May 12, 2022 Share Posted May 12, 2022 (edited) 10 hours ago, Slick said: Display d = new Display(); @Override public void onPaint(Graphics2D g){ log("aaaa"); g.setColor(Color.RED); d.drawModel(g, myPlayer().getGridX(), myPlayer().getGridY(), myPlayer().getZ(), myPlayer().getModel()); log("bbbb"); } trying out the Display api and when I call drawModel it seems like it is throwing an exception silently as I never saw the second message being printed on the console am I doing anything wrong here? I am trying to draw the outline of entities and tiles on screen, searched for some older posts in the forum but no luck EDIT: should be using getDisplay() rather than instantiating a new display class, all good now Not sure what you are trying to do with this code, but you are trying to draw the display on top of your player This draws the outline of a model Same works for Npc,'s or whatever you are trying to draw. public void onPaint(Graphics2D g){ RS2Object object = .... if(object != null && object.isVisible()){ g.draw(object.getModel().getArea(object.getGridX(), object.getGridY(), object.getZ())); } } Retrieving a object in the onPaint method isn't a great example though, because this will result in FPS drops. The more things you load in the onPaint the harder your FPS drops the best thing is to set the object inside the onLoop RS2Object object; public int onLoop(){ object = ...; } public void onPaint(Graphics2D g){ if(object != null && object.isVisible()){ g.draw(object.getModel().getArea(object.getGridX(), object.getGridY(), object.getZ())); } } Edited May 12, 2022 by Khaleesi Quote Link to comment Share on other sites More sharing options...