Questions tagged [c++]

C++ is a statically typed, free-form, multi-paradigm, compiled, general-purpose programming language.

Filter by
Sorted by
Tagged with
0 votes
2 answers
83 views

OpenGL texture not displaying despite setting uniform int

As you can see in the linked image, despite assigning a texture unit, there is no texture being drawn on the screen. In the main loop, I am receiving error 1282, and there are no further errors ...
Henry Fielding's user avatar
0 votes
0 answers
54 views

Can Nakama-cpp be used with Godot?

Can "Nakama C/C++ Client SDK" be used with "Godot 4 using C++ GDExtension API" ? Nakama C++ on Github Godot C++ on Github If yes, what are the procedures for using these together ...
Neel's user avatar
  • 229
2 votes
2 answers
100 views

Finding the closest point on a circle to end of a ray in 3D

I have a circle in 3D space, so we have center C with radius r, and the normal of plane the circle lies on, N. There is also a normalized vector V that I am modifying to go far past the circle's ...
A well-rested dog's user avatar
1 vote
2 answers
106 views

Would it be practical if I used composition for everything?

I've been learning C++ and SDL2 and I'm trying to improve at using composition and for the longest time I thought it was only useful for making things like players, enemies, coins, etc, and I think ...
Konjointed's user avatar
1 vote
1 answer
96 views

Creating a Renderer class using SFML

I currently have a Renderer class, which as in the example code, looks like this: ...
BOOM's user avatar
  • 11
1 vote
1 answer
55 views

Player stays grounded when jumping at the side of a two tile high wall

I am currently developing a simple Super Mario Bros. like platformer in Cocos2d-x v2. I am now at the step of doing wall sliding with two axis-aligned bounding boxes (tiles) but I've not quite found ...
MikaKC's user avatar
  • 11
1 vote
0 answers
37 views

Offset in a raycasting algorithm

I'm trying to implement a function that takes a ray as its start and end position and returns all intersections with the map grid. I wrote following code and got a problem. Function returns correct ...
CalmlyGrass's user avatar
0 votes
0 answers
152 views

Rendering texture as pure white / filled with color with SDL2

I added a glow or shine effect to make character flash with one color for a short period of time, it looks like this. The code in draw function: ...
SavedowW's user avatar
1 vote
2 answers
95 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 ...
Red Needle's user avatar
0 votes
2 answers
62 views

Skybox looks distorted when camera nears sides of the cube

I created a cubemap for skybox, but there were problems with displaying UV for it. when I appear in the world, everything looks fine as it should, BUT when I approach one of the sides of the cube, its ...
Roolld's user avatar
  • 1
0 votes
0 answers
75 views

How do you load/store assets?

I'm new to C++ and SDL2 and for the past few days I've been trying to figure out what to do with/how to handle assets for my game. I'm using an asset pack that includes 4 characters and each character ...
Konjointed's user avatar
0 votes
0 answers
84 views

What are the advantages of TWeakObjectPtr automatic nulling?

When you use TWeakObjectPtr to hold an Actor reference then the pointer variable is automatically nulled for you by GC when the <...
Kostej's user avatar
  • 33
1 vote
1 answer
156 views

DOS VGA card vertical sync - how to check for blanking interval?

I'm right now developing a game for ms dos in C++ (compiler: DJGPP) and need to test if the VGA card is currently in the vertical blanking interval. Is there a memory address I can just read? How can ...
Nkl29's user avatar
  • 11
0 votes
0 answers
71 views

How do you handle collision with a sprite?

I'm in the process of learning C++ and SDL2 and I'm trying to add a sprite to my player which is currently a rectangle. I've managed to get the sprite showing on the screen, however, I've run into a ...
Konjointed's user avatar
1 vote
1 answer
87 views

Why does ApplyRadialDamageWithFaloff applies full damage?

For some reason it applies full damage even when actor to damage is further than 100.0f from the MainDamageSphere. What can be the problem? I'm checking for damage with the usage of overriden "...
JohnTheRipper's user avatar
1 vote
1 answer
121 views

How to fix diamond artefacts in diamond square algorithm?

I'm trying to implement the Diamond Square Algorithm. In order to do this I'm following this tutorial: Diamond Square | Procedural Generation | Game Development Tutorial I store the height values into ...
Giuseppe's user avatar
0 votes
0 answers
53 views

Black space and incorrect lighting when capturing to Composure

I'm setting up a Virtual Production project and capturing from a camera to a Composure CG_layer. I then output this CG layer to a Render Target that I have assigned to a material on a virtual LED ...
starphan's user avatar
0 votes
0 answers
114 views

I can't manage to get Instantiate USerWidget from c++ in unreal5

I have a c++ UserWidget like this (sorry for some naming I renamed stuff a bit for post clarity) header ...
Bobby's user avatar
  • 21
0 votes
1 answer
78 views

Render and Process loop synchronisation with threads

I am developing an interactive visualizer for a project using Pangolin and OpenGL. The idea is as follows. There are two threads: 1. Render Thread 2. Process Thread - acquire lock and swap ...
Nitron_707's user avatar
0 votes
1 answer
26 views

Maintain constant Y position value for a dynamic body

Something obvious is skipping my mind with Bullet Physics library, so apology in advance: I have a dynamic rigidbody, which I'd like to have its Y (up/down) coordinate to be at constantly at a certain ...
Avi's user avatar
  • 163
0 votes
0 answers
31 views

Persistent Variable Issue: Incorrect Texture Index in C++/Opengl Rendering

I am attempting to render two different textures in C++/OpenGL. However, I am encountering an issue where the integer I pass as the texture index to my Fragment Shader always seems to be set to 0. In ...
DDD's user avatar
  • 1
0 votes
0 answers
67 views

How would I go about making Pushboxes in a 2D fighting game?

I am working on a 2D fighting game engine in C++ and SDL2 and everything so far is going swimmingly. I have hitboxes, hurtboxes, and pushboxes as you would expect of a typical fighting game. How ...
guiege's user avatar
  • 1
2 votes
2 answers
634 views

What does raylib's "no external dependencies" really mean?

I'm considering making a 2D game with C++ and raylib, targeting windows desktop. One of the attractive features of that framework is that it has "no external dependencies". However, now that ...
DrZ214's user avatar
  • 338
0 votes
0 answers
53 views

Сollision detection c++

In the cube class I have its position and rotation. Also I have a collision check function: ...
Het Best's user avatar
0 votes
0 answers
44 views

High mass bodies that are stacked on top of each other are wobbling while sitting idly in Box2D

I'm recreating the SaturnV rocket to-scale in Box2D, which so-far involves 3 very massive rectangular bodies stacked on top of each other (1-2 million kg each). Box2D advises not to use such high mass ...
confused_aspirant's user avatar
0 votes
1 answer
187 views

How to read pixel data from a ID3D12Resource?

I'm trying to read pixel data of a D3D12 render target (ID3D12Resource) for h264 encoding/streaming, I tried asking on DirectX Discord and also GPT and still I got ...
Cyclone's user avatar
  • 31
0 votes
0 answers
225 views

Why is this Godot extension class still considered abstract?

I'm working on building an extension to MultiplayerPeer for Godot, using GDExtension. As is my custom, even if I don't end up pushing it to the final product, I always start with a Nullary Pattern ...
Michael Macha's user avatar
0 votes
0 answers
23 views

C++ Qt Game Dev: How to instantiate game objects at a specific positions read from a txt file?

I am trying to add a functionality to a game. First, here's a description of what was the initial version of the game like: What I Had at Hand I had at hand, a simple baloon popping game where the ...
Berk Tezcan's user avatar
1 vote
1 answer
906 views

Trouble adding C++ actor component to blueprint in Unreal 5

I'm a veteran C++ dev, but so far I've only been working with blueprints in Unreal. I'm now attempting to mix the two. I have a blueprint actor I'd like to attach a component to, but the actor ...
Nightmare Games's user avatar
2 votes
2 answers
171 views

Considerations when applying C++ Core Guidelines in game development

I'm curious about the impacts of applying the C++ Core Guidelines to game development. When I try to discuss about this, and point out that we should check return values, or validate user data, or ...
phydthekid's user avatar
0 votes
1 answer
130 views

What is the best way to store unique data for tile types?

To store specific data unique to each tile type, what is the best way to do this? Say a tile has an ID corresponding to data concerning its name, block strength, texture, health, etc; how could this ...
DAG3223's user avatar
1 vote
0 answers
196 views

Expected a smoothly fading opacity in this Raylib shader, but instead it is chunky

In my main file, I create a regular icosahedron and assign the below shaders to it using the Raylib framework in C++17. I intended for the vertex shader to assign a 1.0 alpha value to points at Z=-5....
James Watson's user avatar
0 votes
1 answer
211 views

How would i make two loops for a game engine

I want to structure my program as shown in the first two images, but I don't know how to get make two game loops happening simultaneously. The arrows show the flow of data. ** I figured that having ...
IcedSalad's user avatar
0 votes
0 answers
69 views

Well tuned orbit camera

I have been trying to make an orbit camera using glfw. I got a working solution which is as in the following. ...
atg's user avatar
  • 1
1 vote
0 answers
77 views

How to implement SSL Pinning in Unreal Engine?

So, I am using FHttpModule to initialize my HTTP request and set different parameters to it. Like this : ...
Karan Bobade's user avatar
0 votes
1 answer
141 views

rotating a sprite with mouse cursor

i am learning how to make a 2d game using sdl and c++ and am currently trying to rotate the sprite so that is always facing the cursor, my game is set up with an entity component system, i have a ...
user21746705's user avatar
0 votes
0 answers
43 views

Normalise movement for direction with 16:9 aspect

should i move everything by the windows Normalised cords to make it so SE is bottom-right, or should i use (1,1) and move everything at or either (1+speedX,1+speedY) ...
Domonicx's user avatar
0 votes
0 answers
102 views

How to render my volume rendered through raycasting into an imGui window

I've been trying a lot to modify my Code so I can pass my scene into an extra ImGui window but I just can't modify my code so it still works and uses an FBO to render into ImGui. Here's my starting ...
Alexander Schuetz's user avatar
1 vote
1 answer
79 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: <...
Eskimo Joe's user avatar
0 votes
0 answers
24 views

Add a second texture to Sascha Willems' glftLoading app

I am working with Sascha Willems' Vulkan code: https://github.com/SaschaWillems/Vulkan/tree/master/examples/gltfloading https://github.com/SaschaWillems/Vulkan/blob/master/data/shaders/glsl/...
shawn_halayka's user avatar
0 votes
1 answer
55 views

Transforming a ray to NDC coordinates

I am trying to have ray tracing with a mesh using NanoRT and I want to be able to allow for a model transform on top of my view and projection transforms. I have successfully transformed my ray from ...
Felipe Gutierrez's user avatar
0 votes
1 answer
254 views

colored triangle where the color changes over time

I am trying to draw a triangle which changes color over time. My implementation is by using uniform variable. my fragment shader- ...
ALvi1995's user avatar
0 votes
0 answers
49 views

How to render using Mesh Component and Transformation Component in Entity Component System

I was developing a game engine using DirectX11. You want to use the Entity Component System (ECS) in your existing method OOP. By the way, I have a question about the rendering system of ECS. I was ...
tot4766's user avatar
0 votes
0 answers
116 views

How I can compute normals vectors for a tessellated terrain?

I would like compute normals vectors for a tessellated terrain generated procedurally, in order to use them for a basic lighting. I don't know how I could do it. I can do it in the Tessellation ...
Giuseppe's user avatar
0 votes
1 answer
194 views

Frame duration varies by a millisecond every few frames

When I run the program at 60 fps, I get 0.016 seconds per frame most of the time, then 0.017 s once every few frames. A similar thing happens for 30 fps, varying between 0.033 and 0.034 seconds per ...
Domonicx's user avatar
0 votes
1 answer
56 views

Several objects from another level appearing in a level that they shouldn't?

I created a project in Unreal, Top Down Character. By default, the scene looks like this: I thought of creating a main menu to take the player to the other scenes of the project I intend to do. For ...
Boneco Sinforoso's user avatar
1 vote
1 answer
147 views

What's the purpose of this cross product and dot product in triangle clipping code?

I have this code that inserts a triangle into the drawing list. The PHD_VBUF structure stores one x,y,z vertex. If the vertex is behind the front plane, then ...
black4's user avatar
  • 167
1 vote
0 answers
91 views

Are there OpenGL functions that are only available for specific platforms?

I want to load the OpenGL functions for my project myself. Are there any specific functions besides wglGetSwapIntervalEXT that require me to query the spec for its availability? And if there are, ...
Cherestes Radu's user avatar
0 votes
2 answers
184 views

How to procedurally compose shaders? [closed]

I read several times that shaders can be composed by the engine on the fly, depending on graphical settings. How is this generally done?
HenriV's user avatar
  • 45
1 vote
1 answer
71 views

glPatchParameteri(GL_PATCH_VERTICES, 4) causes access violation

I'm trying to create a tessellated terrain, for this purposes I'm following the LearnOpenGL tutorial: https://learnopengl.com/Guest-Articles/2021/Tessellation/Tessellation However, when I set the ...
Giuseppe's user avatar

1
2
3 4 5
86