Jump to content

Recommended Posts

Posted (edited)

Hey Guys,

 

i'm trying to render my own projectile and get strange results.

Sometimes it works and sometimes the Projectile behave weird.

 

I recorded the my issue here: https://youtu.be/pZzjO-KiXuE

 

 

Here is my code for the renderer:

@Override
    public void doRender(EntityShockRifleProjectile entity, double x, double y, double z, float entityYaw, float partialTicks) {
        this.bindEntityTexture(entity);
        GlStateManager.pushMatrix();
        GlStateManager.disableLighting();
        GlStateManager.disableCull();
        GlStateManager.translate((float) x, (float) y, (float) z);
        GlStateManager.rotate(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) - 90.0F, 0.0F, 1.0F, 0.0F);
        GlStateManager.rotate(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch), 0.0F, 0.0F, 1.0F);
        Tessellator tessellator = Tessellator.getInstance();
        BufferBuilder bufferbuilder = tessellator.getBuffer();
        GlStateManager.enableRescaleNormal();

        GlStateManager.rotate(45.0F, 1.0F, 0.0F, 0.0F);
        GlStateManager.scale(0.05625F * 3, 0.05625F * 3, 0.05625F * 3);
        GlStateManager.translate(-4.0F, 0.0F, 0.0F);

        final Color projectileColor = new Color(0, 139, 255, 255);

        GlStateManager.color(1F / 255F * projectileColor.getRed(),
                             1F / 255F * projectileColor.getGreen(),
                             1F / 255 * projectileColor.getBlue(),
                             1F / 255 * projectileColor.getAlpha());

        final double width = 8.0D;
        final double height = 0.5D;

        for (int j = 0; j < 4; ++j) {
            GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F);
            GlStateManager.glNormal3f(0.0F, 0.0F, 0.05625F);

            bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX);

            bufferbuilder.pos(-width, -height, 0.0D).tex(0.0D, 0.0D).endVertex();
            bufferbuilder.pos(width, -height, 0.0D).tex(1, 0.0D).endVertex();
            bufferbuilder.pos(width, height, 0.0D).tex(1, 1).endVertex();
            bufferbuilder.pos(-width, height, 0.0D).tex(0.0D, 1).endVertex();

            tessellator.draw();
        }

        GlStateManager.disableRescaleNormal();
        GlStateManager.enableLighting();
        GlStateManager.enableCull();
        GlStateManager.popMatrix();
    }

 

I tried my best to figure out what is causing this behavior but i don't know that much about GL & Rendering. :S

I would be very happy about help ^^

 

:Edit

This issue just happens on the client who is shooting the projectile.

The other players see those 'buggy' projectiles without any problems.

Edited by Skyriis
Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

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