Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

2D Circle / Rounded Corner Rect Rendering


PlumpOrange
 Share

Recommended Posts

I have been trying to render a 2D circle on a GUI. Here is what I ended up with after a lot of google searches:
 

public static void drawCirc(double p_73734_0_, double p_73734_1_, double p_73734_2_, int p_73734_4_) {
        float var10 = (float) (p_73734_4_ >> 24 & 255) / 255.0F;
        float var6 = (float) (p_73734_4_ >> 16 & 255) / 255.0F;
        float var7 = (float) (p_73734_4_ >> 8 & 255) / 255.0F;
        float var8 = (float) (p_73734_4_ & 255) / 255.0F;
        double increment = 2*Math.PI/50;
        double cx = p_73734_0_;
        double cy = p_73734_1_;
        double radius = p_73734_2_;

        GL11.glColor4f(var6, var7, var8, var10);

        for(double angle = 0; angle < 2*Math.PI; angle+=increment){
            GL11.glBegin(GL11.GL_POLYGON);
            GL11.glVertex2d(cx,cy);
            GL11.glVertex2d(cx + Math.cos(angle)* radius, cy +
                    Math.sin(angle)*radius);
            GL11.glVertex2d(cx + Math.cos(angle + increment)*radius, cy +
                    Math.sin(angle + increment)*radius);
            GL11.glEnd();
        }
    }

However, it is not rendering. Nothing is coming up. I have tried a variety of tweaks to this code, but nothing is working.

I am unsure if mc's default tesselator is overriding my vertex's and stopping it from rendering or if I am being stupid, but no matter what I try, it doesn't render a circle.

I am hoping after I figure out how to render a circle, I can try rendering a rounded rectangle, but so far, it does not look promising. I am hoping someone on here knows how to do this correctly.
 

 
 
0
 Advanced issues found
 
 
Spoiler

P.S. I am using MCP, but I am sure you guys are still able to help.

 

Edited by PlumpOrange

Just an orange that codes

Link to comment
Share on other sites

4 hours ago, diesieben07 said:

Jarmodding is not supported on this forum.

Both mods and clients use OpenGL, my question would still apply to either. I'm just trying to figure out why my circle isn't rendering. Also, I've made posts on here about mcp development in the past, and outside of this account, with no issue. I don't understand why you are so strict on what platform you modify on.

 

Just an orange that codes

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share



×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.