Questions tagged [graphics]

Use this tag for questions involving visual presentations, whether they are generated using bitmap or vector techniques.

Filter by
Sorted by
Tagged with
1 vote
1 answer
114 views

Create normals from triangulated surface

Objective I have a 3D face mesh triangulated. I have computed the midpoint of each triangle in the mesh, and I have the normal vector (n1, n2,n3) for each triangle. The objective is to create a 2D ...
  • 111
3 votes
1 answer
56 views

Android + Kotlin advanced color picker (HSV and RGB)

For almost the past year, I have been working on a pixel art editor for Android. My pixel art editor was relying on an external library for its color picker. For 0.2.0, I wanted to change this by ...
0 votes
0 answers
43 views

Optimizing barycentric triangle rendering algorithm

I created this piece of Go code that renders a shaded triangle using a Barycentric algorithm ...
3 votes
1 answer
51 views

Radial gradient image generator

A function to create a radial gradient from one rgb colour to another and using rayon to improve performance. Are there better way to convert between some of the types / any obvious performance ...
  • 133
3 votes
0 answers
181 views

Efficiency of wgpu-based 2D Batch Renderer

I've been working on a WebGPU-backed Rust renderer that batches together 2D colored sprites. I hadn't gotten onto the "sprite" portion of it yet, but I'm already finding some performance ...
  • 31
1 vote
0 answers
28 views

An OpenGL backend for displaying a framebuffer of an emulator

Motivation I'm making an emulator. It has its own software framebuffer of size 320x240. Each frame is prepared internally from the emulator, and I just need a way to display it on a window, scaled to ...
  • 421
2 votes
0 answers
44 views

Recursive path drawing in Latex

I have some diagrams I'm drawing using tikz and I'd like to make a macro to draw them for me. I will describe it fully but here are some examples so you can follow along: The diagram has a number of ...
0 votes
0 answers
57 views

Python image triangular mosaic creator

This is a Python script that turns images into "low-poly" art/creates a triangular mosaic from the image, I wrote this script completely by myself. In short, it takes a filepath to an image, ...
5 votes
0 answers
60 views

A Python script that creates n-flakes

I have written a simple Python script that generates n-flakes using matplotlib. Wikipedia article on N-flake. I wrote two functions, one function generates pentaflake, the other generates hexaflake, I ...
3 votes
2 answers
674 views

Rendering primitive 2D shapes

I am currently creating my own 3D renderer (think something like OpenGL). As a first step, I created a mini program below to render primitive 2D shapes essential to 3D graphics: points, lines, and ...
1 vote
2 answers
61 views

Generate vertices and normals for a flat shaded cylinder

I would like to generate list of vertices and normals (with the correct indices) for rendering a cylinder barrel (I ommited the end caps for brevity). The normals should not be interpolated (flat ...
4 votes
1 answer
56 views

Shorten a SVG file created with Inkscape

I often use Inkscape for generating SVG images. However, these images contain data which doesn't seem to affect the visual output, so I want to remove it. To do that, I wrote the following code: ...
5 votes
1 answer
180 views

Python module to print in printer

I made a code that simplifies the job of sending anything to print with the Windows API. The module has a Document object which stores a reference to the actual device context within it. You can ...
  • 151
1 vote
1 answer
76 views

Hough Circular Transform

I'm writing a very basic crater-detection code using Hough Circular Transforms. By far, the longest part of my code is actually doing the transform, which involves numerous nested loops/conditions. ...
4 votes
1 answer
830 views

4x4 double precision matrix multiply using AVX intrinsics (inc. benchmarks)

Benchmark An optimised 4x4 double precision matrix multiply using intel AVX intrinsics. Two different variations. Gist For quick benchmark (with a compatible system) copy paste the command below. Runs ...
  • 171
2 votes
0 answers
71 views

Structuring a project that generates triangles inside triangles

Basically I made this completely useless program that generates triangles inside triangles. Its not perfect yet but my question is about the structure. I am generally happy with it but I want to know ...
1 vote
0 answers
39 views

81 variations of the rounded rectangle

If we apply outward curving, inward curving, and no curving at all, individually to each of the 4 corners of the rectangle, we get next 81 variations: The code implements next BASIC command: ...
  • 4,128
0 votes
0 answers
78 views

convert ID3DXMatrixStack to DirectXMath

Is it right it convert ID3DXMatrixStack to DirectXMath like that: ...
  • 23
0 votes
0 answers
43 views

How can I make my resource mapping faster?

I have a Direct3D 11 application and recently I've started to implement a new feature on it, the UI(User Interface). It seems to work well, but I'm having one problem with optimization when it comes ...
6 votes
2 answers
355 views

Animal Storage TreeView - Tkinter

Bit of a pointless program (at the moment). It's intended more as practice for myself rather than anything else. General idea is that you add details of a particular cat or dog, and it'll update a ...
's user avatar
6 votes
1 answer
356 views

ray-tracing in one weekend implementation

In the past I had followed the Ray Tracing in a Weekend books using C++ because that was what the book used. However, recently I started thinking about how hard it would be to implement using C and ...
  • 669
2 votes
1 answer
768 views

Converting an equirectangular image to a cubemap

I've written a program that does three things: Take an equirectangular image and ... ... cut horizontally-overlapping image areas. ... fill the image from the bottom with black so it has a ratio of 2:...
9 votes
2 answers
2k views

Can I draw a square with pixels more efficiently?

I'm drawing a square on a window using an implementation of Xlib. I put a colored pixel with my_pixel_put at a specific (...
  • 183
6 votes
3 answers
713 views

ad hoc logging in c++ projects

I am currently going through this Vulkan tutorial. An extra excercise was writing a function which checks if the hardware you are running on supports the extensions other libraries require (GLFW in ...
  • 191
2 votes
0 answers
64 views

Super Compact Bresenham's Line Algorithm v2

I recently posted here about an implementation of the Besenham's line algorithm that I wrote. I've been hard at work improving it and redoing it from the ground up. However I still can't seem to beat ...
4 votes
1 answer
167 views

Super Compact Bresenham's Line Algorithm Variant

I wrote this variant of Bresenham's for fun. I am looking to see what I can optimize as it is still slower than Bresenham's. The idea here was that if I could isolate out the ...
6 votes
1 answer
107 views

Basic raytracer written in Rust

I come from a fairly strong background of C and thought that this project would be a good way to get a handle on Rust. Right now, I have everything in one file because I wasn't sure the best way to ...
5 votes
2 answers
937 views

Menu for X11 using Xlib in C

I am learning the xlib library and I made a xmenu utility in order to practice it. It receives as input a menu specification where each line is a menu entry. Each line can be indented with tabs to ...
  • 854
-3 votes
1 answer
75 views

how to make 'for loop' short in C? [closed]

I made some code about solar system stimulation in C. It is working, but it looks too long. So, Are there some ways to shorten my code? Also this website told me your code is too full to upload this....
  • 17
3 votes
0 answers
21 views

Simple graphics library from Sparkle

The piston2d-graphics crate provides a trait, Graphics, which allows easy access to some graphics primitives. This would be a ...
  • 313
2 votes
2 answers
151 views

Code for getting the coordinates of points on the chart

I am a beginner android developer. I am working on one of my applications. For this application, I wrote an algorithm that is needed to obtain data that is used to build a diagram. I have a list of ...
  • 417
1 vote
0 answers
71 views

color and canvas implementations in Rust for Ray Tracer Challenge

I'm learning Rust by working through Jamis Buck's The Ray Tracer Challenge. The book instructs the reader on what to build in what order, and provides all required test cases. Included here are my ...
6 votes
2 answers
680 views

Simulating a Solar System Using Command-Line Graphics

After a relative hiatus of around two years, I've decided to start delving back into the programming world; to start, I've appropriated one of my older projects, CLIGL, and have made a solar system ...
5 votes
1 answer
718 views

Draw a spark line with SwiftUI

I am using a set of data points (currently randomly generated), and drawing a line graph inside a box: ...
  • 161
4 votes
1 answer
287 views

Single-player obstacle-avoidance space game

I was wondering what I could do to improve the gameplay of this game, as well as the graphics. I would like to use LWJGL, but the rendering library isn't important. I just need to find out ...
  • 143
2 votes
1 answer
100 views

Speed up shapely buffer

I was asked to move the code here. I have different shapely.LineStrings like so: which I then buffer to create a polygon like ...
4 votes
2 answers
74 views

Loading and drawing an image

I have some functions and structs for loading and drawing an image with OpenGL. The two main places I would like feedback are: I've tried to separate the OpenGL-specific code into the implementation ...
  • 1,132
1 vote
1 answer
1k views

Moving objects in loop in graphics.py

Currently I am trying to teach myself more about functions with parameters and return values that connects with one to another. In this code I created a square object with graphics.py that moves to ...
3 votes
2 answers
866 views

Snake game using graphics.py

I am a self taught python beginner for about 3 months and recently I finished my own snake game project. As seen from the code, it is not very efficient nor tidy to look at so I want to know if there ...
5 votes
1 answer
175 views

Rust code of a tree fractal

I just picked up Rust recently and this is my first program (longer than 10 lines at least) so I'm looking for constructs that are more native and natural to Rust. I come from a c++/ python background....
6 votes
0 answers
135 views

Julia set in Julia (and other fractals)

I've made the following to draw a series of zooming in images of a fractal. ...
  • 3,512
6 votes
0 answers
44 views

Drawing a line in any direction with pixels

I am doing an image drawing and rendering library, and would like some feedback on this code, it simply draws a line in any direction. The equation for that is: m = (y2 - y1) / (x2 - x1) b = y1 - m ...
  • 61
2 votes
0 answers
115 views

Improving rendering performance of 3D Voxel Game

Improving rendering performance of 3D Voxel Game Technical features added: Perlin Noise Generator 3D Explorable World (You can't break or place blocks) Free camera, you can fly and go through blocks ...
  • 31
7 votes
0 answers
655 views

Unity3D shader for rendering 2D sprites with a pseudo-glitch effect

I'm making a puzzle game in Unity with sprite-based graphics. When the game is paused, I want to hide most game elements, because I don't want the player to be able to pause and leisurely think about ...
  • 459
5 votes
2 answers
128 views

Class hierarchy for objects in a 3D engine

I am writing my own 3D engine. I initially made the code quick and dirty but after a while the code became pretty messy and it have a lot of repeating code so I am currently cleaning up some of the ...
3 votes
1 answer
168 views

Plot ROC, PR, and PRI curves in C# using pre-calculated coordinates

I have written a small program in C# to plot ROC, PR (equal to AP) and ...
  • 193
2 votes
0 answers
487 views

DirectX11 Error Handling

I'm new to C++, been a C programmer most of my life. I wanted to get into graphics and Direct3D is C++ so I figured it was about time. I've been learning about strings, vectors, references, smart ...
  • 21
9 votes
2 answers
226 views

Maze generator for teaching Python 3

I am teaching programming (in this case - 1 on 1 tutoring of a teenager interested in programming) and this code will be a final stage of a progression toward program generating a maze. Any comments ...
2 votes
1 answer
385 views

2-dimensional random walk simulator, draws the steps on a canvas

Here's what I came up with for a 2-dimensional random walk exercise. It takes a number of steps as input and iterates through them, while drawing every step as a line on the canvas. The direction is ...
  • 341
1 vote
2 answers
387 views

Drawing graphics and text using macOS Core Graphics

I have a small python project, which draws graphics and text onto a graphics context using MacOS's Core Graphics APIs. The idea is to make it easy for the user to write a few short lines, in order to ...
  • 113

1
2 3 4 5