All Questions
142 questions
1
vote
1
answer
134
views
What is the equation for bilinear filtering between 2 mip levels based on texture coordinate derivatives
Tagging as OpenGL since the question should be OpenGL/WebGL agnostic
I'm trying to implement shader based texture filtering. I had a previous question and an answer that helped me fix a bug in ...
2
votes
1
answer
181
views
Compute mip level selection from texcoord varying
Marking as OpenGL even those the example in the question is WebGL because OpenGL domain experts should be able to answer this question. There's an OpenGL repo here
I'm trying to compute texture mip ...
2
votes
1
answer
247
views
In what way is WebGL2 immediate compared to retained mode OpenGL3?
I have some previous experience with OpenGL3 from following the tutorials on learnopengl.com and have recently been learning how WebGL2 compares. I'm still a n00b, so excuse any misunderstandings.
One ...
2
votes
1
answer
732
views
When perspective division is necessary?
I'm very confused when it is necessary for a homogeneous coordinate (x, y, z, w) get divided by w (ie. converting to (x/w, y/w, z/w, 1)).
According to this page, when a homogeneous vertex coordinate ...
1
vote
1
answer
334
views
OpenGL: Problem with lighting when rotating mesh
I'm drawing some static geometry (a sphere, a cube, etc.) together with some dynamic geometry (a rotating torus.)
I can see that there is a problem because specular lighting on the torus is static and ...
0
votes
2
answers
220
views
Text Rendering Problem with Distance Field in WebGL
I made this Distance Field example with Qt OpenGL 3.3:
It works very good. I made it using this video tutorial: OpenGL 3D Game Tutorial 33: Distance Field Text Rendering
I rewrote this example line by ...
0
votes
1
answer
554
views
Problem with normals when drawing instanced mesh
I'm rendering a sphere with instanced drawing, while rotating the model-view-matrix around the Y axis.
It looks ok at the beginning:
But at another angle, things get worse:
It looks to me like a ...
0
votes
0
answers
285
views
difference between canvas and gl.canvas
in WebGL, we create a rendering context with
const canvas = document.getElementById("#mycanvas");
let gl = canvas.getContext("webgl2");
in every operation I see people using gl....
0
votes
1
answer
311
views
Why are simple 2D shapes drawn in CAD editors in segments
After looking at some programs for 2d modeling, I noticed that all primitives are drawn as segments (see attached picture).
For example, why is the circle drawn as a polygon? It seems to me that it is ...
1
vote
1
answer
2k
views
How does Chrome support webgl on macOS?
I found libGLESv2.dylib libswiftshader_libGLESv2.dylib libvk_swiftshader.dylib in Chrome.app. And in https://webglreport.com/?v=2 it says:
Vendor: WebKit
Renderer: WebKit WebGL
Unmasked Vendor: ...
0
votes
1
answer
573
views
2D Color Grid in GLSL Fragment Shader
I'm trying to achieve this pattern in GLSL:
While getting that effect on the X axis is straightforward by scaling, using floor() and mix():
void main() {
vec2 st = vTexCoord;
float maxColumns = ...
0
votes
1
answer
1k
views
What are the use cases of sampler2D uniforms in WebGL / OpenGL? [closed]
Samplers goes into a little too much depth without use cases. What are the use cases of sampler2D (texture) uniforms in a vertex shader? Are they used to pass data in ever, or what do you use them for ...
1
vote
1
answer
2k
views
Draw image with OpenGL
How to draw video/image over map (GMap.Net) with open OpenGL/OpenTK (video from drone)
My question is how to draw video image on map since video can be looked with different angle on map and image ...
1
vote
0
answers
503
views
How many times vertex shader is called, if I use 4 vertices and 6 indices to create a quad? [duplicate]
I am trying to assign unique id for each vertex being processed by the vertex shader in webgl1 as a color. Lets say I have 4 vertices and 6 indices representing the connectivity for two triangles that ...
1
vote
2
answers
330
views
Encode axis aligned unit vector in a single float value
I want to encode axis-aligned unit vector in a single float value. Like this:
0: vec3(0, 0 ,0)
1: vec3(1, 0, 0)
2: vec3(0, 1, 0)
3: vec3(0, 0, 1)
To convert float to vector according to the table ...