Jump to content

Recommended Posts

Posted (edited)

Im trying to render a simple plane with the following code:
 

Minecraft mc = Minecraft.getInstance();
	
	@SubscribeEvent
	public void renderWorldLastEvent(RenderWorldLastEvent evt){
		System.out.println("renderWorldLast");
		GL11.glPushMatrix();
		
		Vec3d projectedView = mc.gameRenderer.getActiveRenderInfo().getProjectedView();
		GL11.glTranslated(-projectedView.x, -projectedView.y, -projectedView.z);
		
		float x = 0;
		float y = 57;
		float z = 0;
		
		ResourceLocation texture = new ResourceLocation(ExampleMod.MODID, "debug.png");
		mc.textureManager.bindTexture(texture);
		Tessellator tessellator = Tessellator.getInstance();
		BufferBuilder bufferbuilder = tessellator.getBuffer();
	    
	    GL11.glEnable(GL11.GL_TEXTURE_2D);
	    
	    bufferbuilder.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); 
        bufferbuilder.pos(x, y + 1.1, z + 1.0D).tex(0, 1).endVertex();
        bufferbuilder.pos(x + 1.0D, y + 1.1, z + 1.0D).tex(1, 1).endVertex();
        bufferbuilder.pos(x + 1.0D, y + 1.1, z).tex(1, 0).endVertex();
        bufferbuilder.pos(x, y + 1.1, z).tex(0, 0).endVertex();

	  	GL11.glEnd();
        tessellator.draw();
        GlStateManager.popMatrix();
        
	    
	}

It renders the plane perfectly, but it just completly ignores lighting.
I tried stuff like

GlStateManager.enableLighting();

but I cant get it work.
Also, some textures like staind glass or water wont render in from of it.
How can I fix those issues?

Thanks in advance

-Lukas
 

Edited by CookieLukas
  • Guest locked this topic
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.