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
0answers
28 views

Light matrix issues

I have a simple school task, I need to draw an octahedron and a sphere with light in it. It works, but works weird I use this code 8 times with different coordinates to draw an octahedron ...
0
votes
1answer
48 views

I can't make the cube map to use shadow mapping - or it seems so

Basically, I'm following tutorials as I'm very new to OpenGL. I managed to perform shadow mapping towards just one direction, meaning I created 2D texture depth map. Now with omnidirectional shadow ...
1
vote
0answers
79 views

Doom-style 8 directions sprite math HELP C++ [duplicate]

I'm trying to get Doom-style 8 direction sprite rotation that changes its sprite depending on the camera and the forward vector of the entity just like this video here: https://www.youtube.com/watch?v=...
0
votes
1answer
260 views

Vulkan rendering of Minecraft-like world in C++

I decided on using 16x16x16 (4096 total) chunks of blocks. Problem is with textures. First idea was about texture atlas but it would require a lot of calculation and possible problems in dividing UV (...
1
vote
0answers
38 views

c++ text based football - how to have the cpu keep choosing a play from a menu until a condition is met

I am updating my post to include more of the code and cleaned up the function hopefully. I am trying to write a function for the computer to keep calling a play in a do while loop (which I am ...
1
vote
0answers
84 views

“Proper” way to do 2d scrolling game

I am new to game development and I would like to make a 2D scrolling game with a tile based engine. If you want an idea, it should resemble the Legend of Zelda: A Link to the Past like in the image: ...
1
vote
1answer
150 views

GLSL C++ Only first sampler array index is accessible

I have the following shader, which whose fragment shader contains a sampler array of 16 elements. Fragment ...
1
vote
0answers
57 views

C++ text based football — lookup table and AI logic help

I am trying to develop a one-player text based football game in C++ strictly in the console without graphics. I am developing the game logic here below vs the CPU and I also need to do the vice versa (...
0
votes
2answers
248 views

Moving an object at an angle based on quaternion rotation matrix (c++)

I have been trying to figure this out for a while now, and can't seem to get a working method. I am building a space ship movement with the following movement keys: P = accelerate (move forward) A = ...
1
vote
1answer
120 views

Problem with rotation a camera with the mouse OPENGL GLFW

I am trying to move my camera with my mouse, I can translate it juste by changing the current position of my camera, but when I want to move my forward vector and my up vector of my camera it doesnt ...
0
votes
1answer
83 views

OpenGL Textures not showing

So I'm currently working on a small C++ project for a school assessment and for some reason my Textures are not showing when I run the game. I don't get any compilation errors but they don't show up. ...
0
votes
1answer
168 views

Set multiple render targets with OMSetRenderTargets using ComPtr<T>

I've recently decided to get rid of pretty much all of the raw pointers from my Direct3D code, and I ran into a problem with using ComPtr<T> template with ...
1
vote
0answers
85 views

Is there a library like ImGui with the ability to customize frames, buttons, sliders, etc. in the windows for OpenGL [closed]

I'm trying to write a game on OpenGL using C++. From third-party libraries for creating windows (widgets?) Inside OpenGL, I was able to add ImGui to my project, create a window and attach some ...
0
votes
2answers
143 views

Say I've got a list of a hundred unique weapons, how can I programmatically and easily identify them all?

I've got a class, WeaponFrame, that has an int member, weapon_frame_id, that I intend to use as a way to identify the weapon, ...
0
votes
1answer
93 views

Perspective Matrix doesn't work OpenGL 4

I tried to implement my own perspective matrix and it doesn't work. I don't understand why. With just with my view matrix (without Perspective Matrix) I can see my mesh. Here my view matrix : ...
2
votes
1answer
536 views

Calculating normal map from height map using Sobel operator

So I'm trying to generate a normal map from a greyscale height map. Unfortunately the result I'm getting doesn't seem quite right. Here is the height map I'm using to generate the normal map: Here ...
2
votes
1answer
94 views

How could I get rid of these shared_ptr/weak_ptr in this entity-component architecture?

We've built an entity-component architecture that works ok for our needs, but it has something that bugs me a bit from a software engineering point of view. We use ...
0
votes
1answer
35 views

Typical Point Light Flow?

A Quick Note This question assumes you have some knowledge about the overall rendering process and do not need clarification on rendering objects with HLSL and a <...
0
votes
2answers
379 views

MacOS Mojave makes SDL2 unaccessible

I have some code that worked with no issues on MacOS Sierra, but when I update to Mojave, my compiler always says that it can't find SDL2. Here's the error: ...
1
vote
2answers
1k views

Unresolved external symbol _glad_XXX

I am relatively new to C++ but I have a few years of java experience. I decided to try to make a game with C++, In contrast with the handful of games i have written in Java with lwjgl. I am having a ...
0
votes
1answer
159 views

DirectX 11 Compute Shader error DXGI_ERROR_DEVICE_HUNG

I am trying to use a compute shader for ray picking technology. My shader accepts: vertex buffer of all models index buffer of all models a buffer of transformation matrices of all models Offset ...
-3
votes
1answer
73 views

Cant make SFML work

I am having an error when I try to create the first window in SFML. the error says: The code execution cannot proceed because sfml-system-d-2.dll was not found. Reinstalling the program may fix the ...
0
votes
1answer
227 views

Where should I store textures for a game?

I am currently creating a game in SFML using C++ and I'm wondering: what is good practise for a location for textures? Should I store it with my project? Or my executable? Or even in something like ...
0
votes
1answer
73 views

How to implement an tooltip item cache?

I'm building a tooltip item like that I would like to keep this information cached on the client side, avoiding that whenever the information is displayed it's necessary to make a request to the ...
0
votes
2answers
96 views

Read function outside of code while run-time?

Hi it is my first post on this community. So if i was rude or something please let me know :) So I just started learning game development alone. It's been about 1 year since I begin to learn c and c++...
1
vote
0answers
78 views

Grass swing/shake effect in 2D game

I want to make the grass swing/shake whenever the player walk through it. Like shown in this gif Grass Swing Effect from this article. I know I have to move the x coordinates of the vertices factored ...
0
votes
1answer
207 views

Should I call SDL_ConvertSurface right before SDL_CreateTextureFromSurface?

Is there a significant benefit (or any benefit at all), when I convert SDL surface and create a texture from optimized surface? Here is example of what I mean: ...
1
vote
2answers
129 views

Is it possible to make desktop visible behind drawn object using SDL2?

I would like to draw an avatar over the desktop, something similar to those word 97 assistants, my idea so far is to make only the background transparent but I haven't had any luck, any suggestion? is ...
1
vote
1answer
167 views

How to implement a camera for a TiledMap with SDL2 and Box2d?

I m writing a game engine using mainly SDL2 and box2D, I implemented TiledMap class that loads a tmx map and everything is fine it even support animation and objects that later will generate Box2D ...
0
votes
1answer
253 views

DirectX 11 - Depth Stencil not working

I'm currently working on a game for university in DirectX 11. I have tried to add in a depth buffer to my project, but since adding it in none of my objects show. ...
0
votes
2answers
181 views

How can I represent a 2d UI?

So, I wanted to start building a desktop application, which is of course with an interface, and I thought that OpenGL would be best. The problem is, once I started following TheChernoProject's ...
0
votes
1answer
194 views

Why is my Zombie enemy not chasing the player?

I am using C++ and SFML to make a top-down Zombie shooter. For now I have a player I can move around who can shoot but I am trying to have a basic AI for a Zombie who chases the player based on player ...
-1
votes
2answers
189 views
1
vote
1answer
270 views

Creating a real loading screen between levels in Unreal Engine 4

I'm trying to create a loading screen to pop up between levels in Unreal Engine 4. I want to have a traditional loading screen such as the loading screen in Skyrim, where the player presses play and ...
1
vote
1answer
184 views

Drawing many separate lines using mouse OpenGL(GLFW/glad)

So, in order to draw a line, I track the coordinates of the mouse, then I add them to the array and capture it as GL_LINE_STRIP_ADJACENCY. However, for example, I completed drawing a line1 at P1 and ...
0
votes
1answer
128 views

Use a different language for engine and game

Just a quick question that I haven't been able to find an answer to, I am creating an engine for a game, I have begin making the engine in C++ but I want to make the game in java. My question is, is ...
0
votes
1answer
626 views

Read access violation, pointer was nullprt

Im trying to figure out how to use pointers to make a single instance of an object that in this example will just change direction on x-axis. Splav.h (eng. Paddle.h) ...
0
votes
1answer
195 views

Initializate float4x4 in vertex shader

Forgive me for my English. I am trying to create a 4x4 matrix in vertex shader, but it is not initialized correctly. Why is this happening? Vertex shader: ...
0
votes
2answers
568 views

Removing a pair from array of pairs

Im making a Breakout clone game and im stuck with deleting objects after they are hit. There are 3 rows. Each contains 12 blocks. I'm trying to delete a pair in the array of pairs. The array contains ...
0
votes
1answer
108 views

Directx 12 Root signature compatibility with pso

Can you bind a different root signature than the one that pipeline was created with? If so does it have to have exactly the same parameters or could it have like one more but the pipeline will ignore ...
1
vote
0answers
58 views

glDrawElementsInstanced rendering always rendering the last instance at the origin

I'm in the process of adding instanced rendering to my engine, to do this I'm adding an offset attribute with a divisor of 1. But for whatever reason, OpenGL is consistently rendering 1 instance at ...
1
vote
0answers
113 views

Is native performance of C++/C etc. relevant for game servers? [closed]

I am wondering if the performance of unmanaged languages like C++, Rust etc. is relevant when developing a game server or is it more about the network. For game clients, it makes sense and is probably ...
1
vote
0answers
33 views

How to apply a visual filter to what I am drawing?

I'm looking to apply a sepia filter to what I'm rendering. Perhaps we could just apply the filter to the view or pass it to the draw method to draw everything with the filter (I'm using one draw ...
1
vote
0answers
124 views

Are most cross-platform C++ libraries really not cross-platform for game developing? [closed]

Sorry for my poor English. Some cross-platform C++ libraries are useful for game developing, e.g., Eigen, Skia, OpenCV, Tensor Flow. I am not sure whether they are really limited to officially ...
1
vote
1answer
52 views

Texture won't appear using a vector of unique pointers of an Object

I am working on a top down 2d shooter game. I have a player Sprite and a Bullet class. I made a vector of pointers to Bullet to store the bullets. Here is the code of the vector and the functions I’m ...
0
votes
2answers
3k views

Error saying attempting to reference a deleted function while using a vector list

I’m making a 2d top down shooter game and I was working on shooting bullets. Im using a vector for the bullet in my player class: std::vector b; And I have coded a shoot function which shoots the ...
0
votes
2answers
135 views

While loop running in thread, but not doing anything [C++]

I am trying to multi-thread my game so that one thread updates and renders the player, while the other listens for inputs. I used a while loop to keep my detached thread running in the background, ...
5
votes
1answer
948 views

Why loss of floating point precision makes rendered objects vibrate?

I'm working on an open-world game. I noticed glitches when I move far away from the origin. The objects seem to be shaking or wiggle. Especially the z-fighting seems to wiggle. And the objects that ...
0
votes
0answers
22 views

android native app is crashing

I am trying to setup android native framework so that I can receive events and touch inputs. I have created a cpp file which has android_main and configured CMake... ...
1
vote
2answers
102 views

Pros and Cons of making one complex mesh vs more simpler ones

Looks like I have a problem with basic understanding of how OpenGL works. Lets say I have a mesh made out of three cylinders that is shown on the picture: So are there any major difference in ...