Skip to main content
Share Your Experience: Take the 2024 Developer Survey

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
20 votes
3 answers
2k views

Terrain Generator - KhanAcademy

I'm new to JavaScript, and I've been learning off Khanacademy. I wrote the following basic terrain generator and I'm wondering if it could use any improvements. Here's the code: ...
Ethan Bierlein's user avatar
17 votes
4 answers
5k views

Bezier curves of grade n

I made a function which creates Bezier curves of grade n. What do you think? ...
NaCl's user avatar
  • 370
15 votes
3 answers
833 views

Setting the scene for a role-playing game

I made some games in Pygame, but I am still new to making games. I made this RPG game, and this code is just a part of the game. The game executes different Pygame files for different levels of the ...
Michael's user avatar
  • 159
15 votes
3 answers
2k views

Refactoring image loading/manipulation class

I have this Image class that I've been using for some time now on personal projects and games I eventually write. It was written in C++98 style and it is starting ...
glampert's user avatar
  • 17.1k
15 votes
1 answer
242 views

Creation of Queen Ann's Lace fractal

I've created a program which recreates the Queen Ann's Lace fractal. However, when the amount of points that are being plotted increases, the points are plotted way slower. Is there any way to make it ...
Trevor Mayo's user avatar
14 votes
1 answer
2k views

OpenGL Instanced Rendering

I have a very basic OpenGL instanced rendering setup, which is compiling and running, however it is super slow, and even though I spent days of asking and reading how to fix it, I still have no clue, ...
Peter Varo's user avatar
14 votes
1 answer
292 views

Writing little package for rubber ducks in tikz

I'm currently working on a little latex package to bring rubber ducks into tikz (a continuation from https://tex.stackexchange.com/a/347458/36296). As this is the ...
samcarter's user avatar
  • 508
14 votes
1 answer
3k views

Isometric City Building Game

I have recently been working on my first game with an isometric perspective. For those who don't know, an isometric perspective is a pseudo 3D view created from 2D tiles. I am working off of this ...
bazola's user avatar
  • 8,569
13 votes
4 answers
1k views

Voxel-based chunk manager

I'm creating a voxel-based game and have been working on it for quite a while. I've come to a point where I have to load and unload chunks on the fly. I've created a chunk manager class and it's ...
Duckdoom5's user avatar
  • 261
13 votes
2 answers
788 views

Sierpiński's carpet fractal animation 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 nice image of ...
reducing activity's user avatar
12 votes
2 answers
17k views

Generating a 3D Point Cloud

I'm trying to produce a 3D point cloud from a depth image and some camera intrinsics. The image is 640x480, and is a NumPy array of bytes. The output is a (rows * columns) x 3 array of points. I've ...
dorfy's user avatar
  • 121
12 votes
3 answers
725 views

A flashing ! exclamation ! point ! bar

I have this Objective-C code for use in an iOS app that makes a 'bar' on the screen, with a red exclamation mark that flashes in it at random places. Here's what it looks like: Header file: <...
user avatar
12 votes
2 answers
3k views

3D perspective rendering in Windows console

This is something I put together from a 3D Soft Renderer I previously wrote in Java. I have less experience in C++, but I thought that being able to render 3D shapes in a console simply by printing ...
MrPublic's user avatar
  • 243
12 votes
1 answer
812 views

Fractal rendering fun time

I wrote up a script a while back to let me play around with fractals. The idea was to have direct access to the script that creates the fractal. None of that close, edit, then run hassle; just edit ...
motoku's user avatar
  • 2,521
10 votes
1 answer
539 views

Simulating a polygon

This code simulates a polygon (say a triangle) with a person at each vertex, every person is looking at the next adjacent vertex/person. They all start moving towards each other with a constant ...
RE60K's user avatar
  • 1,456
10 votes
1 answer
3k views

Simon game / Four tiles game

When I read the community challange, I couldn't wait. So here I go with the very first Four tiles game: ...
Caridorc's user avatar
  • 27.5k
10 votes
2 answers
6k views

Drawing an Archimedean spiral using Pillow

From Rosetta Code: The Archimedean spiral is a spiral named after the Greek mathematician Archimedes. It can be described by the equation: $$r=a+b\theta$$ with real numbers \$a\$ and \$b\$. ...
Dair's user avatar
  • 5,906
10 votes
1 answer
698 views

Finger painting code

I have a very simple view that handles touch events and draws accordingly. It's nothing significant, but it does use a bit more CPU than I would like (35%). Again, it is the bare minimum (<90 lines)...
Josue Espinosa's user avatar
10 votes
3 answers
178 views

Generating image gauges from a value, min and max

One of the things I was recently investigating was the ability to generate "gauge" charts—that is, a chart which shows where a value stands within a range of values. As an example, if we know ...
Der Kommissar's user avatar
10 votes
1 answer
1k views

Sprite drawing class

I have written a very XNA spritebatch like interface for drawing sprites in OpenGL. When begin is called the vertex data buffer is mapped to a float*. The index buffer and vertex buffer are bound in ...
Ben's user avatar
  • 125
9 votes
3 answers
4k views

Use of nested namespaces in 3D graphics engine library

I know that nested namespaces are used in C++ very rarely. But I think it's a nice solution to exclude types from global scope and sometimes it helps to write programs faster when we use things like "...
shadeglare's user avatar
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 (...
lcols19's user avatar
  • 183
9 votes
2 answers
272 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 ...
reducing activity's user avatar
9 votes
1 answer
704 views

Bresenham line drawing implementation

I found myself having to implement Bresenham's line drawing algorithm. I'm looking for feedback on effectivity and code style. Can I reduce the code somehow? ...
Emily L.'s user avatar
  • 16.6k
9 votes
2 answers
291 views

Random numbers, IO monad, and pure code

To get used to Haskell, I wrote a little program using the Diagrams package which generates 100 random dots (larger dots are more likely to be in the center). ...
bdoering's user avatar
8 votes
4 answers
2k views

Plotting the Mandelbrot set efficiently

This is my Mandelbrot set program - it includes Smooth Coloring, perodicity checks, and my approach to biomorphs. I know of Edge Detection, but I couldn't find a simple explanation that I can ...
iogamesplayer's user avatar
8 votes
3 answers
1k views

Car generation algorithm

I have an algorithm which generates some cars (quote unquote) and displays them using Graphics. I would like to know if my code is using Random correctly, and if it has any memory leaks. Or if there ...
Offtkp's user avatar
  • 371
8 votes
1 answer
5k views

Drawing a triangle and some concentric circles

For class, I had to use Java to draw a triangle and some concentric circles: ...
Simon Kuang's user avatar
8 votes
1 answer
311 views

LaTeX code for presentation slides

I'm giving a presentation in a few days. I'm preparing my material in LaTeX; however, I am relatively new to it. How can I make my LaTeX code more concise and less repetitive? Here is a reduced ...
JesseTG's user avatar
  • 459
8 votes
1 answer
1k views

D3D9 leaks if any?

I am writing a D3D9 hook plugin to give back to a community that helped me learn programming. It is a community based on programming and scripting for games. The plugin is supposed to hook d3d9.dll ...
Brandon's user avatar
  • 183
8 votes
1 answer
320 views

Basic Ray Tracer

This is my first self-guided programming project, and all the math used in the program is self-taught. I wanted to get a better understanding of how computer graphics worked, but I just feel more ...
Jonas Banks's user avatar
8 votes
2 answers
271 views

Shorten up Mesh Generator Class

I'm currently writing a mesh generator class, and I'm making a method that generates vertices, normals and texcoords for a cube. But, as you can see, it's incredibly complicated and hard to follow. Is ...
Dlaor's user avatar
  • 253
8 votes
1 answer
103 views

Drawing 800+ circles in a space-themed shoorter game

I am making a space-themed shooter game, and I need to render many "lasers" at the same time. I am using the library Slick2D, a wrapper around lwjgl. Unfortunately, ...
Blue's user avatar
  • 574
8 votes
2 answers
3k views

Graphics in Conway's Game of Life in Java

I recently coded a program to stimulate Conway's Game of Life. Originally, my program just printed an array of 1's and 0's where the 1's represented the "live" cells, but I tried to teach myself some ...
Jared's user avatar
  • 711
8 votes
1 answer
1k views

Multi-function clock GUI

I was sitting in my bedroom, looking at my Powers of 2 clock sitting next to my radio, under my analog clock on the wall, and wondered to myself: "Why have all these different clocks when I can have ...
Eric Roch's user avatar
  • 387
7 votes
2 answers
1k views

JPaint (Java painting app)

I have this painting app called JPaint in Java and I'm wondering if it could be improved. The variable declaration seems repetitive and long, and I think it might ...
Quintec's user avatar
  • 432
7 votes
1 answer
11k views

Single-player Agario game

I made an Agario single player version (soon to become a multi player one using socket). What can be some improvements? Controller: ...
sguan's user avatar
  • 347
7 votes
1 answer
1k views

Drawing the flag of Liberia

I am working on this assignment to draw the flag of Liberia for my essentials of computer programming class. I finished it but had extra time to kill and noticed that a couple similar blocks of code ...
Smarticles101's user avatar
7 votes
1 answer
782 views

Paint rectangles to canvas using mouse

Just wanted to post this here to see if anyone has any critiques of my code, if I'm drawing the background image most efficiently, or if I'm doing anything which could benefit from obvious ...
user2546963's user avatar
7 votes
2 answers
195 views

Isometric Projection and Culling

I'm working on a small isometric drawing system in JavaScript. After much help from the Gamedev section, reading old questions, I've got something working. However, it's still a little hacky. I need ...
Danie Clawson's user avatar
7 votes
2 answers
1k views

Speeding up 2D shadow algorithm

I wrote a class to represent a set of lights in a 2D game that raycast in order to find shadows. The draw method does a lot of calculations and takes a lot of time. Mainly, the adding of areas and ...
Kyranstar's user avatar
  • 1,191
7 votes
2 answers
2k views

Drawing a circle segment

I wrote code to draw a circle segment, such that the segment angle will be facing the mouse. My code: ...
TKK's user avatar
  • 375
7 votes
1 answer
1k views

8086 ASM Bresenham's Line Algorithm Pt2

Following the successful review of my implementation of Bresenham's Line Algorithm, I've been asked to upload the full implementation of my project which creates a small animation of shapes moving ...
user avatar
7 votes
2 answers
2k views

8086 ASM Bresenham's Line Algorithm

As part of a first year university course in computer architecture some time ago we were tasked with learning 8086 ASM. The final course work required creating a small animation of shapes moving ...
user avatar
7 votes
2 answers
135 views

Interdependent color swatch widgets

To illustrate some algorithmic problems I found while writing this code review, I needed to include a live demonstration, which I implemented using a Stack Snippet with Angular.js. The demonstration ...
200_success's user avatar
7 votes
1 answer
195 views

A simple ray marcher for the command line

This is my attempt at creating a ray marcher for the command line for fun. I have some prior experience with C programming, although I'm far from being an expert, and little to no experience with ...
Knogger's user avatar
  • 173
7 votes
1 answer
125 views

Improving Terrain Generation Time in C#

I am working on making my code run smoother, since I will be using it a lot in a game in development, but I am stumped. Is there any way I could make this run faster? Improvements to the terrain ...
jklsfdgs's user avatar
7 votes
1 answer
463 views

jQuery to display ANSI graphics

This is my first attempt at a jQuery plugin. Any tips or comments in regards the the plugin setup would be appreciated. I'm also looking for a general review over the code itself. I'm wondering if ...
Justin808's user avatar
  • 775
7 votes
1 answer
690 views

Doge meme generator in Racket

I wrote a doge meme generator in racket some time ago, mainly as a joke, and I would like some criticism about the general style and what could be improved. Here is how the program output looks : ...
Hello_world's user avatar
7 votes
0 answers
753 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 ...
JesseTG's user avatar
  • 459

1
2 3 4 5