Posted November 18, 20204 yr 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(); }
November 18, 20204 yr Author 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?
November 18, 20204 yr Author 43 minutes ago, diesieben07 said: Yes, exactly. If you would draw an actual line it would be invisible, because a line has no width. As soon as you can see it, it is a rectangle where one of the sides is shorter. okay thanks
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.