MGlolenstine Posted September 9, 2017 Share Posted September 9, 2017 put('0', new Color(0, 0, 0, 255)); put('1', new Color(0, 0, 255, 255)); put('2', new Color(0, 128, 0, 255)); put('3', new Color(0, 102, 102, 255)); put('4', new Color(102, 0, 0, 255)); put('5', new Color(64, 0, 64, 255)); put('6', new Color(192, 128, 0, 255)); put('7', new Color(192, 192, 192, 255)); put('8', new Color(128, 128, 128, 255)); put('9', new Color(0, 0, 128, 255)); put('a', new Color(0, 255, 0, 255)); put('b', new Color(0, 255, 255, 255)); put('c', new Color(255, 0, 0, 255)); put('d', new Color(255, 0, 255, 255)); put('e', new Color(255, 255, 0, 255)); put('f', new Color(255, 255, 255, 255)); as you can see in the top table of colours, I'm having a problem getting all of these colours to show when using this part of the code GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glLineWidth(2f); GlStateManager.disableDepth(); GL11.glBegin(GL11.GL_LINES); Vec3d vec = new Vec3d(0, 0, 1); GL11.glVertex3d(vec.x, vec.y + mc.player.eyeHeight, vec.z); GL11.glVertex3d(x, y, z); GL11.glEnd(); GL11.glEnable(GL11.GL_TEXTURE_2D); GlStateManager.enableDepth(); for example 7 and 8 are the same colour when drawn, and 'e' and '6' are the same as well. I know the colours are similar, but they're not the same. I'm probably using something wrong in the GL11 drawing section, but I don't know what. Thanks! Quote Link to comment Share on other sites More sharing options...
MGlolenstine Posted September 9, 2017 Author Share Posted September 9, 2017 bump? Quote Link to comment Share on other sites More sharing options...
MGlolenstine Posted September 9, 2017 Author Share Posted September 9, 2017 40 minutes ago, diesieben07 said: Do not use GL11 directly in Minecraft, use GlStateManager. I do not see you setting any GL color at all. I'll try GLStateManager, and yeah, I forgot to add the color assignment. I'm asigning it like this if (mode == 1) { Color c = new Color(96, 149, 234, 1); GL11.glColor4d(c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha()); } else if(mode == 0){ if (entity.getTeam() != null) { Color c = Colors.getColor(entity.getDisplayName().getFormattedText()); GL11.glColor4d(c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha()); }else{ Color c = new Color(255, 255, 255, 1); GL11.glColor4d(c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha()); } }else if(mode == 2){ Color c = new Color(255, 0, 0, 1); GL11.glColor4d(c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha()); }else if(mode == 3){ Color c = new Color(0, 255, 0, 1); GL11.glColor4d(c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha()); } Quote Link to comment Share on other sites More sharing options...
MGlolenstine Posted September 9, 2017 Author Share Posted September 9, 2017 I updated my code to GlStateManager, but now it's not even drawing my lines... if (mode == 1) { Color c = new Color(96, 149, 234, 1); GlStateManager.color(c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha()); } else if(mode == 0){ if (entity.getTeam() != null) { Color c = Colors.getColor(entity.getDisplayName().getFormattedText()); GlStateManager.color(c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha()); }else{ Color c = new Color(255, 255, 255, 1); GlStateManager.color(c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha()); } }else if(mode == 2){ Color c = new Color(255, 0, 0, 1); GlStateManager.color(c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha()); }else if(mode == 3){ Color c = new Color(0, 255, 0, 1); GlStateManager.color(c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha()); } GlStateManager.glLineWidth(2f); GlStateManager.disableDepth(); GlStateManager.glBegin(GL11.GL_LINES); Vec3d vec = new Vec3d(0, 0, 1).rotatePitch(-(float) Math.toRadians(Minecraft.getMinecraft().player.rotationPitch)).rotateYaw(-(float) Math.toRadians(Minecraft.getMinecraft().player.rotationYaw)); if(mc.player.isSneaking()) { GlStateManager.glVertex3f((float)vec.x, (float)vec.y + mc.player.eyeHeight-0.08f, (float)vec.z); }else { GlStateManager.glVertex3f((float)vec.x, (float)vec.y + mc.player.eyeHeight, (float)vec.z); } GlStateManager.glVertex3f((float)x, (float)y, (float)z); GlStateManager.glEnd(); GlStateManager.enableDepth(); Quote Link to comment Share on other sites More sharing options...
Draco18s Posted September 9, 2017 Share Posted September 9, 2017 Color c = new Color(96, 149, 234, 1); GlStateManager.color(c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha()); Um...why are you creating color objects at all? GlStateManager.color(96, 149, 234, 1); ? Also, I'm pretty sure 1 alpha is basically invisible. Quote Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given. Link to comment Share on other sites More sharing options...
MGlolenstine Posted September 9, 2017 Author Share Posted September 9, 2017 21 minutes ago, Draco18s said: Color c = new Color(96, 149, 234, 1); GlStateManager.color(c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha()); Um...why are you creating color objects at all? GlStateManager.color(96, 149, 234, 1); ? Also, I'm pretty sure 1 alpha is basically invisible. Wait.. alpha is from 0-255? I thought it was 0-1... Quote Link to comment Share on other sites More sharing options...
MGlolenstine Posted September 9, 2017 Author Share Posted September 9, 2017 With GlStateManager I don't get the solid lines that I've gotten with GL11... I want those back... is there something I can do about that? It's just like GL11 ones were fully opaque and unbreakable, they were bright, but with GlStateManager lines are much darker, they vanish when I don't want them to, and the color settings are the same... and yes, I've updated Alpha to 255. I still don't understand why it doesn't work Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.