Jump to content

How to properly texture a 3D Line?


RobinCirex

Recommended Posts

Hey, I want to make a laser and I'm rendering a 3D line. However, I want to add a texture to it but I'm not quite sure how to do it. Can someone tell me what I have to put in the tex method? This is my code 

	public void fillTex(Matrix4f matrix, Matrix4f matrix2) {
		BufferBuilder bufferbuilder = Tessellator.getInstance().getBuffer();
		RenderSystem.enableBlend();
		RenderSystem.enableTexture();
		RenderSystem.defaultBlendFunc();
		GL11.glLineWidth(5);
		Minecraft.getInstance().getTextureManager().bindTexture(laserTexture);
		bufferbuilder.begin(2, DefaultVertexFormats.POSITION_TEX);
		bufferbuilder.pos(matrix, (float) 0, (float) 0, (float) 0).tex(0, 0).endVertex();
		bufferbuilder.pos(matrix2, (float) 0, (float) 0, (float) 0).tex(100, 100).endVertex();
		bufferbuilder.finishDrawing();
		WorldVertexBufferUploader.draw(bufferbuilder);
		RenderSystem.disableTexture();
		RenderSystem.disableBlend();
	}

 

Link to comment
Share on other sites

30 minutes ago, diesieben07 said:

I would advise against using a line. By setting a line width you are effectively turning it into a normal rectangle - so just draw that.

No matter what - calling any GLXX methods in Minecraft is not adviced, as you will be leaking GL state.

okay, how would I be doing it then? Just using a rect?

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



×
×
  • Create New...

Important Information

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