Skip to main content
OverflowAI is here! AI power for your Stack Overflow for Teams knowledge community. Learn more
16 votes
Accepted

What is an index buffer and how is it related to vertex buffers?

Could someone ELI5 to me, what is an index buffer and how is it related to vertex buffers Your vertex buffer contains the X and Y coordinates of 5 vertices. They are: ...
Rotem's user avatar
  • 443
9 votes
Accepted

Logarithmic spiral with equal vertex spacing, what equations?

Since a logarithmic spiral is defined by $r=e^{a\cdot\theta}$, the inverse of the equation is this: $\theta=\frac{\ln{r}}{a}$. If we want to be able to control our step value, we can multiply it ...
Scott Milner's user avatar
6 votes

What is an index buffer and how is it related to vertex buffers?

If you have a vertex buffer like this: var vertices = [ 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.6, 0.0, 1.0, 0.6, 0.0, 0.5, 1.0, 0.0 ] And simply draw it ...
q9f's user avatar
  • 703
4 votes
Accepted

Name and influence of style used for futuristic line patterns?

That looks a lot like it’s based on the straight skeleton of some outline shapes drawn on the image. You can see similar structures in the middle one of these diagrams from a research page by Stefan ...
Noah Witherspoon's user avatar
4 votes

Floating Point Operations in Line Drawing Algorithms

is it important with modern GPU architectures to avoid floating point operations in favor of integer operations? Almost certainly not. CPUs have a long history where for many years they only handled ...
user1118321's user avatar
  • 3,421
4 votes
Accepted

Bezier Curve Tool Controlled by Mouse

Instead of using cubic Bezier spline, you should use cubic Hermite spline. For cubic Hermite curve you specify the segment end points and tangents, which is what you then control in the tool. Hermite ...
JarkkoL's user avatar
  • 3,636
4 votes
Accepted

How to never draw "Jaggies" in the first place considering resolution and scale

Well you can render at higher resolution and sample down thhis is called FSAA and should just work without much change to render code. FSAA has the benefit of not having a conflation problem whereas ...
joojaa's user avatar
  • 8,437
4 votes
Accepted

How would I create a virtual cabling system?

The shape you’re trying to draw is called a catenary: it’s the shape that a cable/cord of constant density takes when supported at each end. You’ll have to do some research to find a parametric ...
Noah Witherspoon's user avatar
2 votes
Accepted

Bug with the Bresenham's line drawing algorithm?

Note that the approach you appear to be taking will only work for lines with a slope in a single octant. For the other seven octants the algorithm requires changing the approach, for example by ...
trichoplax is on Codidact now's user avatar
2 votes
Accepted

First steps towards CAD standard curve fitting

Since you have a limited set of tools you are not actually doing a classical fitting. What you have is a discrete problem. And since you are looking for a somewhat easily drawn fit, no more than twice ...
joojaa's user avatar
  • 8,437
2 votes
Accepted

How different can the number of pixels in a straight line be to its real length?

The worst case is when the line is at a 45-degree angle; then its length (in pixel-sized units) is a factor of $\sqrt{2}$ times the number of pixels, or about 40% longer. You can see this if you ...
Nathan Reed's user avatar
2 votes

Bresenham's Algorithm not drawing horizontal lines

e = (float)(delta_x / delta_y) - 1.0; e += (float)delta_x / delta_y; Either of these lines will cause a divide-by-zero error when ...
Dan Hulme's user avatar
  • 6,820
2 votes

Uniform line thickness in plot

You should separate your line drawing logic from your calculation logic. In general you should try to have a generic line drawing function that would accept any number of points and draw a line from ...
zoran404's user avatar
  • 153
2 votes
Accepted

Non jagged line algorithm for javascript canvas

The problem you are seeing, i.e. "jaggies" or "staircasing", is an example of the more general problem known as "aliasing" and, in the graphics field, the term you want to search for is "Antialiasing"....
Simon F's user avatar
  • 4,251
2 votes

Wireframe mesh effect on a photograph subject

This is not something that would be called a "wireframe mesh" in computer graphics. Models are sometimes displayed as a wireframe to help visualize the topology which look like a lot of ...
pmw1234's user avatar
  • 3,219
1 vote
Accepted

Why an object becomes larger when drawn in perspective

If you keep constant the scale at which you view the x-y plane (image plane), while changing the distance of the viewpoint to that plane, then you are not solely changing the viewpoint position; you ...
Kevin Reid's user avatar
  • 1,116
1 vote

What is this vertical line contour effect in glitch art called?

The technique is called halftone. Achieving continuity must be done through subsampling / super-sampling, but the essence of the algorithm goes like this. Imagine walking across a horizontal line of ...
Wyck's user avatar
  • 410
1 vote

What is the most efficient line algorithm using a shader program

Here is a (mostly) minimal version of an SDF for a line segment using a signed distance field as suggested in the comments. I take no credit for this code, it is your function pieced together with IQ'...
pmw1234's user avatar
  • 3,219
1 vote
Accepted

Bresenham's algorithm next pixel?

Well, for the first octant you can either step EAST or NORTH-EAST. Depending on the distance to the actual line you choose the appropriate. In many integer implementations, this is done with regard to ...
beyond's user avatar
  • 315
1 vote

First steps towards CAD standard curve fitting

As far as I know, there are no standard shapes for (physical) French curves. The folks who manufacture them are free to choose any shapes they like. Of course, they choose shapes that look "nice", ...
bubba's user avatar
  • 348
1 vote
Accepted

Anti-aliasing - Controlling colour density of pixel that comes within the "rectangle" surrounding my line

You have a background color and the color of your line, an antialiased line has additional lines drawn on either side of the first that are simply part way between the color and brightness of your ...
Rob's user avatar
  • 256
1 vote
Accepted

How to rasterize a line when the background color is not always white?

You're actually already doing color interpolation in the code you posted, in these expressions: qRgb( 255-I, 255, 255-I ) qRgb( I, 255, I ) The first one ...
Nathan Reed's user avatar
1 vote

Fast antialiased line drawing

Absolutely there is, the Bresenham's Algorithm, modified. Instead of drawing from (x0,y0) to (x1,y1), one can use Bresenham's algorithm to draw lines from ...
Aki Suihkonen's user avatar
1 vote

Bug with the Bresenham's line drawing algorithm?

Frankly, your implementation doesn't make much sense. It basically iterates x coordinate through i variable and increments y ...
ivokabel's user avatar
  • 1,464

Only top scored, non community-wiki answers of a minimum length are eligible