All Questions
524 questions
1
vote
0
answers
45
views
How to correctly add point light and reflection values in an ray tracing system?
I'm working on a small ray tracing project and I'm trying to add a point light system to my rendering engine. Here's an excerpt of my main ray_color function, which calculates the color of a ray based ...
2
votes
0
answers
75
views
XDrawRectangle misses bottom-right pixel
I have a wrapper function to implement XDrawRectangle() in X11/Xlib.h in Linux. But it's not plotting the bottom right pixel. Is there something wrong with this function?
EDIT: minimal reproducible ...
1
vote
0
answers
63
views
Printing the values of pixels of a DIB image
The MS Device Independent Bitmap (DIB) has a pixel array in which each row of pixels is padded up to a multiple of 4 bytes:
I came up with the following function to print the value of each pixel (...
2
votes
1
answer
80
views
Rendering Text glitches and shows text quads behind and wrong color hex
I am trying to make a function in my game engine to draw text with stb_truetype , The problem is that when rendering it , for some reason there's black boxes behind the text and even when the color ...
0
votes
0
answers
61
views
SDL2 Program Breaks Every Time I Try To Render Something
Every time i try to render a rectangle or line to the screen then the entire screen turns black and my background color won't work anymore.
#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>...
1
vote
0
answers
48
views
How to Reduce Pixelation in Texture Mapping for Raycasting Engine in C
I am working on a raycasting engine in C, similar to the one used in classic games like Wolfenstein 3D. I have implemented basic texture mapping, but the rendered walls appear very pixelated. I would ...
2
votes
0
answers
93
views
Properly rasterize a triangles edges using barycentric algorithm
In an attempt to add a z-buffer to a custom 3D rendering engine, I need to use a barycentric algorithm to interpolate the depth of each point inside a triangle. While this approach works, the ...
1
vote
0
answers
102
views
Alpha compositing in fixed point (0xff is not 1.0)
I'm writing some code (intended for use from both C and C++) that does alpha compositing using integer math (fixed point), and I'm coming across the problem that 0xff isn't quite 1.0. This is ...
1
vote
1
answer
90
views
SDL_Quit segmentation fault
I'm on Ubuntu 22.04.4 LTS, and I'm getting into using the SDL2 library, but for some reason calling SDL_Quit() gives me a segmentation fault. Here's the minimum amount of code for which the error ...
1
vote
1
answer
138
views
can we display same framebuffer side by side on screen simultaneously using DRM(direct rendering manager) APIs in linux?
can we display same framebuffer side by side on screen simultaneously using DRM(direct rendering manager) APIs in linux?
constraints:
need to use single plane and single framebuffer
what I already ...
2
votes
0
answers
104
views
Black flickering in C XLib on resize
I wrote a program that renders to XLib window in 60fps.
When i resize the window, XLib seems to clear the window to black and the effect lingers before it is time for my 60fps render cycle to repaint ...
1
vote
2
answers
358
views
How do you draw graphics in C/C++ without external libraries?
I’m trying to find out how to draw graphics in C/C++ without any external libraries. I know it is possible because I’m pretty sure the libraries are programmed in either C or C++ and I want to know ...
-1
votes
1
answer
56
views
how to not make my raycaster draw walls with curves
# define GRID_SIZE 64
// TODO: this comment
# define EPSILON 0.0001
// one degree in radians
# define ONE_DEGREE 0.0174532925
// Screen width
# define SCREEN_WIDTH 720
// Screen Height
# define ...
0
votes
0
answers
55
views
WindowProc Event system not responding in real-time
I have made this event system to abstract platform code (currently win32 api). I built a simple event queueing system to dispatch the system messages, but my events aren't responding in real time. My ...
0
votes
1
answer
109
views
Incorrect rendering of two overlapping sprites
Here is the problem, when drawing multiple sprites (textured Quads)
the sprite on the front, clips the back sprite, and I won't be able to display behind it to the user.
My expected output is to ...