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

How to organize data transfer between the client and the game server?

I have a game like minecraft, I can run, set and delete blocks. The world consists of a limited set of chunks. I want to write a server for it with the help of a library called boost asio. I need help ...
1
vote
1answer
481 views

Why can't this simple SDL app be closed without task manager or rapid clicking of x button?

I wrote a simple app that generates a window, a raster, and redraws the raster once every 16ms. Right now the calculations are empty, it just draws a solid color. I don't know how, but I have created ...
0
votes
0answers
11 views

combine two translation/rotation/scale triplets without matrices

Let t1/2, r1/2 and s1/2 be two sets of transformations. Translations are vec3, rotations are quaternions and scales are vec3. Lets assume that all common operations are defined (overloaded operators ...
1
vote
0answers
22 views

Multiple Viewports/Windows Dear IMGUI c++

How do I use IMGUI with multiple GLFW windows? I know Dear IMGUI already has a virtual viewport system going in the viewport branch but I found that to be lacking a bit on how to use this new system. ...
0
votes
0answers
21 views

Can your file save the progress that you ofstream it c++? [on hold]

Dont worry about the #include's. Can you for example : struct book { string name; } using namespace std; int main() { book a; ofstream myfile; myfile.open("example.txt"); cin >> a.name; ...
0
votes
0answers
22 views

Can't figure out why my mouse picking code doesn't work

I am trying to create code to check for intersections between bounding spheres and the mouse. I get a mouse ray but it doesnt seem to point in the direction you think it should Attached is a ...
2
votes
1answer
75 views

Overlaying Menus with a State Machine

I'm working on developing a game with C++, SDL, and OpenGL. I created the engine from scratch, and implemented my own state machine to handle menus and general gameplay. Each State gets pushed into a ...
0
votes
0answers
27 views

Steps to learn how to create MMRTS? [closed]

I played cool game Kingdom Wars But it was incomplete and abandoned by developers :( I would like to improve it is idea, my main stack is JavaScript and PhP, ofc SQL. Acquainted with client server, ...
1
vote
1answer
62 views

Frustum Culling bug in program

I did Frustum Culling in my engine, but it does not work correctly. All shown in the video: Video If the approximation is too close, the model disappears. On the right in the console you can see ...
0
votes
1answer
25 views

draw concave polygon from set of edge points

I'm having troubles trying to rearrange a set of points where each point is part of the edge of a concave polygone. My set of points is not sorted in any order, they are just randomly put in an array. ...
0
votes
1answer
38 views

Huge input delay although framerate is stable - possibly related to the DirectX Tool Kit?

I'm in the process of learning how to use the DirectX 11 API and came upon the following problem: Although my rendering function executes quite fast at around 150 fps (as one expects considering how ...
0
votes
1answer
30 views

2D Rotation of an object along a curve line

I would like to rotate an object along a curve. I managed to move the object along the curve using bezier curve algorithm. The hard part is to rotate the object constantly(no limit on maximum angle), ...
3
votes
1answer
40 views

Calculate angle between player and end point

I have such question: how to calculate angle between player and end point? Things, which i have: Player. I have X, Y, Z position of player and his Z-angle (0-360) Endpoint. I have only X, Y, Z ...
0
votes
0answers
15 views

(C++, DirectX 11, UWP) - How do I update the ByteWidth of a VertexBuffer without recreating it?

I want to have one buffer used for all dynamic properties but the amount of vertices in this could vary from just a few for an interface to the whole scene. As such if it's becomes initialized with ...
0
votes
0answers
32 views

Vulkan - preallocating chunks of memory and resource memory requirements

I would like to allocate a bigger chunk of memory and then suballocate from it but I don't fully understand how memory requirements work, is there a chance that when I allocate a piece of device local ...
0
votes
2answers
72 views

DirectX11 - CreateInputLayout() Vertex shader linkage problem

I keep getting the same error every time, I really have tried everything to fix the problem but it's still not working. Basically I'd like to draw a simple cube. The error(s): ...
0
votes
1answer
19 views

Replacement for glDrawElementsBaseVertex in OpenGL ES?

I am porting my game engine(c++) to Emscripten, which unfortunately only supports OpenGL ES 3.(Not 3.2) Therefore I don't have access to glDrawElementsBaseVertex, which is needed by my renderer(...
0
votes
1answer
49 views

Using GLFW and GLUT together

I'm new to OpenGL Lets say I create an OpenGL window using glfw and I need the UI feature from glut (such as popup menu). Is it possible to use glfw and glut in one program? Thank you
0
votes
0answers
39 views

How should I send large amounts of data from java to c++ (within the same process)

I'm writing a game that is mostly in Java (because that's the language I'm most comfortable with) while the graphics are in C++ (because of speed, and because the Vulkan API is hard enough to learn ...
0
votes
1answer
71 views

SDL Sliding Collision

I'm working on a 2D SDL C++ project, and I'm having a bit of trouble with collision detection. Currently the player collides with the edges of the level and with the SDL_Rect objects in the level, ...
0
votes
1answer
38 views

Rotate object around a dynamic object

I'm trying to rotate an object (shield) around another object (player) like this question. My use-case is this: I have players moving around a field. Their respective shield is orbiting in a constant ...
1
vote
3answers
167 views

How to efficiently store a large amount of data?

I am doing minecraft-like game. I have a limited world in size 32x16x32 chunk. Each chunk is a structure in which there is a three-dimensional array containing the values ​​of the blocks located in it....
0
votes
0answers
24 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 ...
-1
votes
0answers
22 views

Keeping a Third Person Camera at a fixed distance - DirectX 11

I'm attempted to create a third person camera which will rotate around the player as I move the mouse left and right. I've worked out a right vector to move the camera along by which should change as ...
-1
votes
0answers
18 views

Vulkan creating shader module from spirv generated with -fhlsl_functionality1 flag

Whenver I compile the shader with this flag for semantic reflection and I try to create a module from it I get this error: ...
0
votes
1answer
28 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
59 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
140 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
votes
0answers
48 views

Good way to dynamically set uniforms during rendering (C++)

I'm trying to create a renderer generic enough so that it can dynamically set uniforms for a variable number of shaders. For instance, say mesh A uses shader A; mesh B uses shader B. "shader A" ...
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
61 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
53 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
45 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
96 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
41 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
46 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
27 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
19 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
29 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
38 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
41 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
127 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
65 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
95 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
65 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
23 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 <...
-1
votes
0answers
21 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
2answers
162 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
114 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 ...