Categories
Mastering Development

WebGL Point Lighting Issue

I have attempted to create a rotating cube in WebGL and texture it by using the texture mapping technique, which I think worked fine. The cube rotates so as to try and demonstrate the (point) lighting I have tried to implement, but it seems to act in an unexpected fashion and I’m not really sure […]

Categories
Development

Loading a Collada (dae) model from Assimp shows incorrect normals

I am trying to correctly load a collada (dae) file in Assimp, but the normals seem to come out wrong. I would like help with figuring this out. I have a feeling it is to do with how I am handling the transformation matrix. As an example, here’s a screenshot of the OpenGL application loading […]

Categories
Development

String Matching a list of names

I’m working on my first big project trying to learn more about string matching. I am trying to match a list of names based on this article: https://bergvca.github.io/2017/10/14/super-fast-string-matching.html import pandas as pd import re from sklearn.feature_extraction.text import TfidfVectorizer names_short = pd.DataFrame([“gogle”,”bing”,”amazn”,”facebook”,”fcbook”,”abbasasdfzz”, “zsdfzl”,”gogle”,”bing”,”amazn”,”facebook”,”fcbook”, “abbasasdfzz”,”zsdfzl”,”google”,”bing”,”amazon”,”facebook”], columns=[“name”]) def ngrams(string, n=3): string = re.sub(r'[,-./]|\sBD’,r”, string) ngrams = zip(*[string[i:] for […]

Categories
Development

Slice and change numpy 2D array with list of column indices different for each row [duplicate]

This question already has an answer here: Indexing one array by another in numpy 3 answers I would like to slice a 2D numpy array using a list of column indices. The difficulty is the column indices are different for each row. For example: x = np.array([[0, 1, 2] [3, 4, 5] [6, 7, 8]]) […]

Categories
Development

OpenGL Texture is not rendered (C)

I want to render a simple picture between a rectangle (two triangles) but when I start the program, there is just a black rectangle instead of the picture. To render the picture, I´m using shaders, which I acces with uniforms. I can´t find a mistake, why It´s not rendering. Could you please help me? main.c […]

Categories
Development

Texture mapping problems and How to cahnge the texture mapping location in WebGL

I am trying to map a texture at a cube, but I came across two problems and one question here is the code for initialize the cube function init_cube(gl, n) { const vertices = new Float32Array([ // Vertex coordinates 1.0, 1.0, 1.0, -1.0, 1.0, 1.0, -1.0,-1.0, 1.0, 1.0,-1.0, 1.0, // v0-v1-v2-v3 front, Pass 1.0, 1.0, […]

Categories
Development

What are the correct vertices and indices for a cube using this mesh function?

I’m trying to create a cube using vertices and indices. The vertices I found by plotting it onto a graph, and the indices were carefully patterned and calculated to make two triangles per side of a cube. However, when I turned on the program, a cube did not show, why is this? Are my vertices/indices […]

Categories
Development

How to display normals with an object in webgl

I am trying to make normals for the vertices of my cylinder to display in green, however I do not know how to render 2 objects at once. The professor said to use a second vertex buffer, but I’m not sure on how to do this. What I have currently is a program that can […]

Categories
Development

Why doesn’t lwjgl draw a Rectangle?

I want to draw a rectangle in lwjgl. The code should draw a rectangle, but it doesn’t. I am using OpenGL 4.4 (LWJGL doesn’t support beyond that). I am mostly a beginner in 3d Graphics and such so any help would be greatly appreciated. float[] vertices= { 0.5f, 0.5f, 0.0f, 0.5f, -0.5f, 0.0f, -0.5f, -0.5f, […]

Categories
Development

Efficiently sorting and filtering a JaggedArray by another one

This is more an awkward-array question, but it is closely related to uproot. I have a JaggedArray (awkward.array.jagged.JaggedArray) that contains indices that point to positions in another JaggedArray. Both arrays have the same length, but each of the numpy.ndarrays that the JaggedArrays contain can be of different length. I would like to sort the second […]