Questions tagged [c]
C is a general-purpose computer programming language used for operating systems, libraries, games and other high performance work.
275
questions
0
votes
0
answers
70
views
Why is my Gouraud Shading not working correctly?
I am trying to write a 3d Renderer in C using SDL and cgml but my shading seems to be not working correctly. When rendering the teapot I get seams and when I want to render a cube I get a bright white ...
0
votes
0
answers
37
views
Glyphs are not being drawn [opengl + freetype]
I've followed this source from learnopengl.com for text rendering. It seems fairly simple, and only required this much code:
...
0
votes
0
answers
49
views
How to re-design the graphics logic behind my game to preform better?
Recently, I have been working on a small "pet-project" of mine in C using the SDL library. I have noticed that without my render-calls, my project takes up 2% of the CPU and with the render-...
0
votes
0
answers
722
views
Why is my RenderTexture y-flipped?
When drawing a very simple RenderTexture using Raylib, with the following POC code, the texture actually drawn is vertically inverted. Is that normal? If not, what ...
0
votes
1
answer
184
views
How can I handle voxels that require extra data in my octree?
I am using octrees as an efficient way to store voxel data in a voxel game. The details of my octree implementation can be found here, but in a nutshell, each node is 16 bits, and the most significant ...
1
vote
2
answers
142
views
Reduce entity-component system boilerplate
I'm attempting to create an entity-component system in C++.
However, I've run into an annoying issue where a component system function inherently involves a lot of ceremony and boilerplate. This is ...
1
vote
0
answers
63
views
Why opengl code in a lib doesn't renderer?
I am experimenting with opengl using c99 on windows and vs 2022 i tried to create an window using glfw in one project and put a function that supposed to generate a texture in another project that is ...
1
vote
0
answers
299
views
How to use SDL_RenderSetLogicalSize() properly in SDL2?
I want to handle different resolutions without altering any game objects. I tried using SDL_RenderSetLogicalSize() but I don't know how to implement it properly. ...
0
votes
1
answer
251
views
How to achieve no gaps between triangles in software renderer like in Quake?
I've heard alot that I need to use fixed-point math, top-left rule, etc. to eliminate gaps between triangles but the thing is how did Quake not have any gaps, did it? I've seen Quake's math file and ...
5
votes
3
answers
1k
views
How to install game with dependencies on Linux?
I am creating a game using C and some libraries. I wish to not require my users to download anything but the game as most games are self contained. What is the usual process for compiling and ...
0
votes
1
answer
92
views
How to add a slot to processing queue using a ring buffer with three pointers?
I am working on a farm game made in C. I am currently working on adding item processing, such as milling wheat into flour. Under the hood, I am using a ring buffer to handle the queues for processing. ...
0
votes
0
answers
101
views
Why are there gaps in my fibonacci sphere?
I recently took an interest in sphere topologies to find which one is the best. The most popular one seems to be the fibonacci sphere. So I went and did some research and found some C code online that ...
0
votes
1
answer
446
views
How to set up view and model matrices for 3D rendering?
For various reasons I am building a very simple graphics engine. I have a pretty good 2D thing using plain SDL2 and C that essentially boils down to a single "putpixel" function. I can ...
1
vote
1
answer
91
views
Why is my texture moving?
I tried sampling equirectangular texture as a reflection. It simply does not work as intended. The texture is moving with my camera in a weird manner. Here is what I tried to do.
Fragment shader:
<...
0
votes
1
answer
111
views
Strange flashing cube bug in snake game
I'm trying to make a simple snake game in C and OpenGL, and I have this at the moment, which runs almost perfectly:
...