Jump to content

Recommended Posts

Posted

public void render(RenderEngine eng, World worldObj, float partial)
{
	Tessellator tessellator = Tessellator.instance;
	float invertRain = 1.0F - worldObj.getRainStrength(partial);
	float celestial_period = getCelestialPeriod(worldObj.getWorldTime(), partial);
	GL11.glEnable(3553);
	GL11.glBlendFunc(770, 1);
	GL11.glColor4f(1.0F, 1.0F, 1.0F, invertRain);
	GL11.glPushMatrix();
	GL11.glRotatef(this.angle, 0.0F, 1.0F, 0.0F);
	GL11.glRotatef(celestial_period * 360.0F, 1.0F, 0.0F, 0.0F);

	float size = 30.0F;
	System.out.println("I am rendering");
	GL11.glBindTexture(3553, eng.getTexture("/mods/CustomCelestials/textures/environment/sun_type"+this.type+".png"));
	tessellator.startDrawingQuads();
	tessellator.addVertexWithUV(-size, 100.0D, -size, 0.0D, 0.0D);
	tessellator.addVertexWithUV(size, 100.0D, -size, 1.0D, 0.0D);
	tessellator.addVertexWithUV(size, 100.0D, size, 1.0D, 1.0D);
	tessellator.addVertexWithUV(-size, 100.0D, size, 0.0D, 1.0D);
	tessellator.draw();

	GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
	GL11.glPopMatrix();
	this.renderHorizon(eng, worldObj, celestial_period, this.angle, partial, 1.0F);
}

 

My print statement prints.  Sunsets render (the this.renderHorizon call, to a function in the same class).  The sun object itself does not.

 

This code works in 1.5.1 and does not in 1.5.2.

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.

Posted

Try drawing in the opposite direction. The direction you start drawing (clockwise or counter clockwise) makes your texture face a certain direction. Your sun is probably just facing away from you so you can't see it.

So:

	tessellator.addVertexWithUV(-size, 100.0D, size, 0.0D, 1.0D);
	tessellator.addVertexWithUV(size, 100.0D, size, 1.0D, 1.0D);
	tessellator.addVertexWithUV(size, 100.0D, -size, 1.0D, 0.0D);
                tessellator.addVertexWithUV(-size, 100.0D, -size, 0.0D, 0.0D);

This should fix your problem.

Read my thoughts on my summer mod work and tell me what you think!

http://www.minecraftforge.net/forum/index.php/topic,8396.0.html

 

I absolutely love her when she smiles

Posted

Not sure if it would or not.

 

I did end up...solving the problem, although I don't know what it actually is.  Here's working code.

 

public void render(RenderEngine eng, World worldObj, float partial)
{
	Tessellator tessellator = Tessellator.instance;

	GL11.glEnable(GL11.GL_TEXTURE_2D);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
        GL11.glPushMatrix();
        float rainStr = 1.0F - worldObj.getRainStrength(partial);
        
        GL11.glColor4f(1.0F, 1.0F, 1.0F, rainStr);
        //GL11.glTranslatef(0F,0F,0F);
        GL11.glRotatef(angle, 0.0F, 1.0F, 0.0F);
        GL11.glRotatef(getCelestialPeriod(worldObj.getWorldTime(), partial) * 360.0F, 1.0F, 0.0F, 0.0F);
        
        float size = 30.0F;
        eng.bindTexture("/mods/CustomCelestials/textures/environment/sun_type"+this.type+".png");
        tessellator.startDrawingQuads();
        tessellator.addVertexWithUV((double)(-size), 100.0D, (double)(-size), 0.0D, 0.0D);
        tessellator.addVertexWithUV((double)size, 100.0D, (double)(-size), 1.0D, 0.0D);
        tessellator.addVertexWithUV((double)size, 100.0D, (double)size, 1.0D, 1.0D);
        tessellator.addVertexWithUV((double)(-size), 100.0D, (double)size, 0.0D, 1.0D);
        tessellator.draw();

	GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
	GL11.glPopMatrix();
	renderHorizon(eng, worldObj, getCelestialPeriod(worldObj.getWorldTime(), partial), this.angle, partial, 1.0F);
}

 

Note that the quad's verts are draw in the same order as the original.

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.

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



×
×
  • Create New...

Important Information

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