Jump to content

[1.8, GL] Render a line between 2 BlockPos, with a colour gradient


CraftedCart

Recommended Posts

Hi.

I'm trying to make it so that when given 2 positions in the world (BlockPos), as well as 2 colours, I can draw a line between the 2 points with a gradient.

I know you can draw faces with the Tessellator, but I'm looking for something like this (Xycraft, where there are no visible faces):

LTBs2iP.jpg

Thanks :)

Link to comment
Share on other sites

Well, you're still going to be drawing quads in all likelihood.  Just that you need a texture on those quads to give you the gradient.  You're not going to get the gradient effect without the texture (or a hell of a lot of work).

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.

Link to comment
Share on other sites

Well, you're still going to be drawing quads in all likelihood.  Just that you need a texture on those quads to give you the gradient.  You're not going to get the gradient effect without the texture (or a hell of a lot of work).

 

I guess I could draw a thin cuboid, however I kinda wanted a way to dynamically change the colour of the gradient dynamically (Interpolation). Do you know of any way to do that (eg, is there a way to use a procedurally generated texture?)

 

Also the glow in the screenshot is quite nice. Does anyone have any idea how to implement that?

Link to comment
Share on other sites

I dont know much about opengl, though Im pretty sure you can apply colors to anything with a bunch of extra effects. I remeber seeing a ton of starter tutorials about how to use opengl, sampling a simple triangle in 3 different colors (each corner another color), with a nice blend effect.

 

So why not give it a try and google for some opengl java tutorials? Im sure youll find what you are looking for!

Projects:

Discontinued:

- N2ConfigAPI

- Meachanical Crafting Table

 

Latest:

- CollectionUtils

 

Coöperations:

- InGameConfigManager

Link to comment
Share on other sites

The colorization just means you need a white png that acts as the gradient, and then you use gl_Color to give it a color.

 

And drawing a thin cuboid is going to be just as hard as drawing a single quad: you still need the 4 important corners.

 

This might help with finding the quads.

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.

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.