Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [c++]

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

0
votes
1answer
34 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
votes
0answers
38 views

OpenGL 3.x: How to make smooth transition between lo-res and hi-res tiles?

So, I have some tails (his position and texture) and I want to make effect like smooth transition (seems like animation) of this tiles, so, when I'm zooming I want to new tiles didn't load with a ...
0
votes
0answers
30 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
0answers
58 views

3D Rendering c++

I'm trying to make a rendering scene with camera but I'm clearly missing something as, it displays well, but when i want to rotate my camera, it rotates my object instead. Could you check and tell me ...
0
votes
2answers
70 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 = ...
0
votes
1answer
27 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
0answers
28 views

Rotate according global axis c++ Quaternion

I'm trying to rotate a camera in c++ but all I succeeded to do is rotate the object himself or rotate the camera around the object i can't figure it out. What I want is rotate the camera on itself ...
0
votes
0answers
22 views

Client-Server by TCP socket SFML transmit packets incorrectly

I can't understand why packet can't be transmited on the connection. Ip = 127.0.0.1, port = 5000. Server code: ...
0
votes
1answer
42 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
0answers
24 views

Using a dynamic array on multiple instances of a class causes problem

I managed to get a A* pathfinding algorithm to work on my game and I want the enemies to all behave according to their path but only one at a time can follow his path and the others just get stuck ...
0
votes
0answers
20 views

Picking object using ray tracer in opengl using inverses

I have a scene with many objects and I'd like to be able to pick them out using ray tracing. I used to have just model transformations happening in the vertex shader and I was able to pick out the ...
0
votes
0answers
18 views

Load Textures Stored as Embedded Resources?

I am currently trying to re-write some of my loading methods and have come across the methods that load textures. I would like to store the texture files inside of the project instead of on the hard ...
0
votes
0answers
27 views

Stencil Rendering?

I may not be searching this properly, but I can't seem to find a decent tutorial on what I'd like to achieve. The only thing that seems to be close is this tutorial on reflections using the stencil ...
0
votes
1answer
30 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
33 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
0answers
57 views

Implementing a system to make an enemy reach the player despite obstacles

I'm working on a top down 2D game in SFML and as a begginer in C++ and programming in general, i'm looking for a way to implement a system where the enemies manage to avoid obstacles to reach the ...
0
votes
2answers
108 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
58 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 : ...
0
votes
1answer
45 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
0answers
57 views

collision sprites [closed]

well I have a odd problem. when I set the screen variable to 0.0f I only get a static collision sprite. However when I set the screen variable to 0.0001f I get the animated sprite to work in the ...
2
votes
1answer
60 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
0answers
19 views

Create AABB Cube from click-and-drag user rectangle? AABB OBB Collision Detection

I'm trying to create a 3D cube from rectangle drawn by ther user's mouse (think click-and-drag selection). My end goal is to use this to implement entity click-and-drag box selection. If you've played ...
0
votes
1answer
29 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
0answers
19 views

How can I add vertex normal support to MD5 model animation?

I am trying to add skeletal animation to my project. I followed one tutorial, but it did not include vertex normals. Therefore I can't perform lighting, bump mapping, etc. How can I add support for ...
0
votes
0answers
33 views

Key-event handling

I'm trying to to understand ECS and implement them in my "toy" project. And now I has come to that I'm needed some sub event-system, like in event-driving prog. But actually, I don't know how I can ...
0
votes
2answers
86 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: ...
0
votes
1answer
36 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
43 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 ...
0
votes
0answers
46 views

How to correctly implement the ray intersections with blocks as in minecraft with lossless performance?

I am doing minecraft like game. We need an algorithm to find the intersection of the beam emanating from the camera with the block that first intersects and select the distance at which to check as a ...
0
votes
0answers
31 views

Unique_ptr window draw, how can i make it work?

How can I access the member functions of my window? I have a unique_ptr for my window and I am trying to draw my circle shape and I don't get it to work. ...
-3
votes
1answer
53 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
0answers
8 views

UE4 Determine refraction hit point inside sphere?

Mac OS UE 4.21 C++. See PIC1 for two spheres which are actors with a static mesh sphere and glass material, and a spherical collision trigger around each. So, I have 2 spheres and through AI/BT I ...
0
votes
1answer
87 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
34 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
87 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
56 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
48 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: ...
0
votes
0answers
33 views

Geometrically aligning two 3D objects together?

Let's say I have 2 similar objects I need to align together about the target's center at runtime. Given their positions (x, y, z) and rotations in the world, how would I do this? They need to match ...
1
vote
2answers
46 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
67 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
0answers
35 views

How can I construct an Actor of Actors?

I have an actor ATile which is a game tile. It has a static mesh which it creates in the constructor. ...
0
votes
1answer
41 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
128 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
112 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
82 views
0
votes
0answers
26 views

Angle Between One Vector and its Reflected Vector coming out to be wrong

I’m making a 2d game where reflection of an object is required. I’m solving the relfection porn=blem using vectors like this: float x = (bullet.x - player.x); float y = (bullet.y - player.y); ...
1
vote
0answers
48 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
62 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
117 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
66 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) ...