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
3answers
1k 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: ...
16
votes
4answers
5k views

Bezier curves of grade n

I made a function which creates Bezier curves of grade n. What do you think? ...
15
votes
3answers
816 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 ...
15
votes
3answers
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 ...
15
votes
1answer
203 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 ...
14
votes
1answer
1k 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, ...
14
votes
1answer
250 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 ...
14
votes
1answer
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 ...
13
votes
2answers
627 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 ...
12
votes
4answers
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 ...
12
votes
3answers
705 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: <...
12
votes
2answers
2k 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 ...
12
votes
1answer
732 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 ...
10
votes
2answers
14k 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 ...
10
votes
1answer
504 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 ...
10
votes
1answer
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: ...
10
votes
2answers
5k 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\$. ...
10
votes
1answer
660 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)...
10
votes
3answers
168 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 ...
10
votes
1answer
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 ...
9
votes
3answers
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 "...
9
votes
2answers
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 (...
9
votes
2answers
174 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 ...
9
votes
1answer
635 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? ...
9
votes
2answers
255 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). ...
8
votes
3answers
925 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 ...
8
votes
1answer
5k views

Drawing a triangle and some concentric circles

For class, I had to use Java to draw a triangle and some concentric circles: ...
8
votes
1answer
231 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 ...
8
votes
1answer
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 ...
8
votes
2answers
267 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 ...
8
votes
1answer
91 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, ...
8
votes
2answers
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 ...
8
votes
1answer
987 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 ...
7
votes
2answers
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 ...
7
votes
1answer
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: ...
7
votes
1answer
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 ...
7
votes
1answer
735 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 ...
7
votes
2answers
168 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 ...
7
votes
2answers
294 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 ...
7
votes
2answers
989 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 ...
7
votes
2answers
1k 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: ...
7
votes
2answers
1k 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 ...
7
votes
1answer
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 ...
7
votes
2answers
129 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 ...
7
votes
1answer
120 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 ...
7
votes
1answer
575 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 : ...
7
votes
0answers
484 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 ...
6
votes
3answers
687 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 ...
6
votes
2answers
179 views

Sims-style walls part 2: Flood fill

A follow up to this post. I've ported all of it to Unity, and generally cleaned it up a little, but looking over the code, the code for flood filling is messy and repetitive. Here's a visual of how it ...
6
votes
2answers
2k views

Game engine Scene class using raw pointers

I'm writing a C++ game engine and I have a scene class that I'd like to present as a code example to a team that is interested in my skills. The scene class holds games entities, updating and ...

1
2 3 4 5