The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Questions tagged [javascript]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
2
votes
1answer
54 views

Non jagged line algorithm for javascript canvas

I'm trying to draw a line between two specified points, by updating values in an array which is heightxWidth with each element a set of four bytes (r,g,b,a). In my naive implementation I get the top ...
-2
votes
1answer
144 views

How can I make a cube with faces of different colors? Webgl

I have to draw cubes with faces of different colors (each per face), but I don't know how to accomplish this task: I draw cubes using CPU and GPU meshes (no vertexBuffer or three.js "style") and I don'...
1
vote
1answer
231 views

Flood-Fill and scanLine algorithms are line-based floods but I want square based floods

I have a flood-fill algorithm (Flood-fill) to fill a 24x24 matrix as follows (matrix is 24x24 here but will be much bigger in production): ...
2
votes
0answers
47 views

Binary representation of Pascal's triangle [closed]

I recently learnt about the binary representation of Pascal's triangle. Here is what it looks like I am a java learner. Is there a way for me to find the java source code to graph this binary ...
1
vote
0answers
54 views

How can I convert a shape made out of pixels to vertices

I'm trying to implement the solution to get the minimum dissection into rectangles of a rectilinear polygon. My shape is made out of pseudo-pixels (different width/height) but for the moment let's ...
1
vote
1answer
404 views

How can I draw a filled circle on a grid with the less rectangle as possible?

I have a grid with a variable width/height spacing. Let's say 100 horizontal lines separated by 80 pixels and 100 hundred vertical lines separated by 50 pixels. Each cell of the grid in my logic have ...
1
vote
0answers
336 views

3D model outline using stencil buffer

I'm trying to outline a 3D model in WebGL. I've tried using a stencil buffer techique with glLineWidth and glPolygonMode. However, Mozilla's WebGL reference says that the minimum and maximum widths of ...
-1
votes
2answers
171 views

The distance from the cube sides to the parallel projection plane

I have asked this question on ru.stackoverflow.com and have no valid answers. Specification: Coordinate system Cube spins around its center on all three axes. Turn angle is not known previously. ...
5
votes
1answer
194 views

How can I verify if a selection area is over a shape in SVG?

I'm creating an SVG editor. I have a simple selection tool that appears when I click and move my mouse from a blank area in my SVG. My SVG is populated with rectangles that can have a rotation ...
3
votes
1answer
89 views

Need help reasoning about video oscillation >60hz

I want to make a basic video oscillator for the web. What I want to do is basically illustrated in a tutorial for Lumen: essentially, I want to define an oscillator to turn on and off a color signal ...
4
votes
1answer
124 views

Image regeneration with nearest neighbor search

So what I would like to achieve is this: User submits Image 1 - this image is then broken down into X by X sized blocks User submits Image 2 - then the program/algorithm takes all the blocks ...
3
votes
1answer
1k views

WebGL: Why are my textures black?

I am trying to write a simple WebGL script to display a pyramid with a brick texture and Phong lighting. The lighting works fine but when I incorporate the texture, the pyramid turns black. I've ...
4
votes
1answer
286 views

Russian Roulette - Maximum call stack size exceeded

I am trying to write my own path tracer in JavaScript, but I have a problem with the implementation of russian roulette. First, let me describe how my path tracer works. I have a function called ...
3
votes
1answer
242 views

Easing curves on the GPU?

I was thinking that I could pass a timestamp in (from requestAnimationFrame) to the vert shader, and just have my easing curves in the GPU instead of using (for example) Tween.js from the outside. Is ...
1
vote
0answers
128 views

How To Generate High Quality Bitmap From Canvas For WebGL Texture

I would like to generate a bitmap for use with a webgl texture generated from a 2d canvas, but I don't think I am doing it correctly. I know how to display the contents of one canvas into another by ...
2
votes
1answer
267 views

Inverse Kinematics with more than 2 segments

I'm building a 2D inverse kinematics system and can't figure out how to find all the joint positions. I have the math to make a typical IK set up with a single bend (e.g. arm, leg), but I get stuck ...
4
votes
2answers
341 views

Can a scene graph be stored in the GPU?

I am starting to learn WebGL. Can a scene graph be stored in the GPU? Or is that type of thing more for the main thread (or webworker)? For example, I want to calculate some layout, and apply it as a ...
2
votes
0answers
371 views

Creating Signed Distance Fields Images On The Fly For WebGL Application

I am working on a "CAD" like program in HTML5 that requires drawing many thousands (700,000+) of images on the screen. I think, "fortunately" the many images are replicated uses of a unique set of ...
1
vote
0answers
40 views

View / print index values?

So i'm currently trying to draw a 3D cube, and from what I understand everything should be working right, but It's coming out weird and I believe it's because the ordering of my indexes is wrong. Is ...
3
votes
1answer
50 views

Successive lineTo(x, y) in JavaScript

When I was doing some graphic designing with JavaScript, I saw this strange behaviour. When I ran the following code (with proper HTML and JavaScript of course), ...
5
votes
1answer
646 views

Can we use PhysX in WebGL?

I'm new to GL stuff (coming in via WebGL, with no direct OpenGL experience). Can we use PhysX with WebGL?
4
votes
1answer
581 views

draw a chord in three.js as in d3.js

I'm starting to learn three.js and want to create a chord diagram as possible in d3.js, but from ground up. I've created a scene and have circle segments on xz axes. But I got stuck on the chords. I ...
1
vote
0answers
43 views

Trouble using java connectivity and data transmition on libgdx [closed]

Hello everybody i have a trouble making datatransmition with mine program just to give the idea im trying to move this blocks when i move mine cars Here I leave the encoding of mine server/client ...
1
vote
1answer
80 views

Get data from javascript

There is an web-interface that load geometric models and show it inside the bounding volume. WebGL is used to generate it. So far no scene graph technique is used to organize the elements in the scene....
4
votes
1answer
159 views

Javascript color extraction library

I have a small project that needs to extract the perceptually-salient colors of an image, in javascript. There are a few libraries out there (color-thief.js, vibrant.js). The trouble is, I'm finding ...
8
votes
1answer
126 views

Can I determine the pixel geometry programmatically?

Different screens can have different pixel geometry, so that the red, green and blue components are arranged in different patterns. Using sub-pixel rendering to give a higher apparent resolution is ...