Jump to content

GL11 draw lines only limited amount of colors?


MGlolenstine

Recommended Posts

	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!

Link to comment
Share on other sites

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());
        }

 

Link to comment
Share on other sites

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();

 

Link to comment
Share on other sites

            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.

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

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...

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Baba  Serege [[+27-73 590 8989]] has experience of 27 years in helping and guiding many people from all over the world. His psychic abilities may help you answer and resolve many unanswered questions. He specialize in helping women and men from all walks of life.. 1) – Bring back lost lover. even if lost for a long time. 2) – My lover is abusing alcohol, partying and cheating on me I urgently need help” 3) – Divorce or court issues. 4) – Is your love falling apart? 5) – Do you want your love to grow stronger? 6) – Is your partner losing interest in you? 7) – Do you want to catch your partner cheating on you? – We help to keep your partner faithful and loyal to you. 9) – We recover love and happiness when relationship breaks down. 10) – Making your partner loves you alone. 11) – We create loyalty and everlasting love between couples. 12) – Get a divorce settlement quickly from your ex-partner. 13) – We create everlasting love between couples. 14) – We help you look for the best suitable partner. 15) – We bring back lost lover even if lost for a long time. 16) – We strengthen bonds in all love relationship and marriages 17) – Are you an herbalist who wants to get more powers? 18) – Buy a house or car of your dream. 19) – Unfinished jobs by other doctors come to me. 20) – I help those seeking employment. 21) – Pensioners free treatment. 22) – Win business tenders and contracts. 23) – Do you need to recover your lost property? 24) – Promotion at work and better pay. 25) – Do you want to be protected from bad spirits and nightmares? 26) – Financial problems. 27) – Why you can’t keep money or lovers? 28) – Why you have a lot of enemies? 29) – Why you are fired regularly on jobs? 30) – Speed up money claim spell, delayed payments, pension and accident funds 31) – I help students pass their exams/interviews. 33) – Removal of bad luck and debts. 34) – Are struggling to sleep because of a spiritual wife or husband. 35- ) Recover stolen property
    • OLXTOTO adalah situs bandar togel online resmi terbesar dan terpercaya di Indonesia. Bergabunglah dengan OLXTOTO dan nikmati pengalaman bermain togel yang aman dan terjamin. Koleksi toto 4D dan togel toto terlengkap di OLXTOTO membuat para member memiliki pilihan taruhan yang lebih banyak. Sebagai situs togel terpercaya, OLXTOTO menjaga keamanan dan kenyamanan para membernya dengan sistem keamanan terbaik dan enkripsi data. Transaksi yang cepat, aman, dan terpercaya merupakan jaminan dari OLXTOTO. Nikmati layanan situs toto terbaik dari OLXTOTO dengan tampilan yang user-friendly dan mudah digunakan. Layanan pelanggan tersedia 24/7 untuk membantu para member. Bergabunglah dengan OLXTOTO sekarang untuk merasakan pengalaman bermain togel yang menyenangkan dan menguntungkan.
    • Baba  Serege [[+27-73 590 8989]] has experience of 27 years in helping and guiding many people from all over the world. His psychic abilities may help you answer and resolve many unanswered questions. He specialize in helping women and men from all walks of life.. 1) – Bring back lost lover. even if lost for a long time. 2) – My lover is abusing alcohol, partying and cheating on me I urgently need help” 3) – Divorce or court issues. 4) – Is your love falling apart? 5) – Do you want your love to grow stronger? 6) – Is your partner losing interest in you? 7) – Do you want to catch your partner cheating on you? – We help to keep your partner faithful and loyal to you. 9) – We recover love and happiness when relationship breaks down. 10) – Making your partner loves you alone. 11) – We create loyalty and everlasting love between couples. 12) – Get a divorce settlement quickly from your ex-partner. 13) – We create everlasting love between couples. 14) – We help you look for the best suitable partner. 15) – We bring back lost lover even if lost for a long time. 16) – We strengthen bonds in all love relationship and marriages 17) – Are you an herbalist who wants to get more powers? 18) – Buy a house or car of your dream. 19) – Unfinished jobs by other doctors come to me. 20) – I help those seeking employment. 21) – Pensioners free treatment. 22) – Win business tenders and contracts. 23) – Do you need to recover your lost property? 24) – Promotion at work and better pay. 25) – Do you want to be protected from bad spirits and nightmares? 26) – Financial problems. 27) – Why you can’t keep money or lovers? 28) – Why you have a lot of enemies? 29) – Why you are fired regularly on jobs? 30) – Speed up money claim spell, delayed payments, pension and accident funds 31) – I help students pass their exams/interviews. 33) – Removal of bad luck and debts. 34) – Are struggling to sleep because of a spiritual wife or husband. 35- ) Recover stolen property
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.