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
1answer
83 views

DirectX 11 generate normals for tessellated triangles

I've spent a couple days looking for an answer to this - How can I access the newly created triangles of tessellation and generate normals for them? I've followed much of the shader code from the ...
0
votes
1answer
174 views

Integrating Bullet3 into a C++ project - Linking to libraries

I've been following the BulletQuickstart guide and I get as far as generating the vs2010 solution and converting to newer. I've also been following this very good answer from a few years ago and have ...
2
votes
1answer
113 views

How can I create a pixellated, limited-palette appearance in modern OpenGL?

I wanna get some old art style (256 color, dithering, etc) in modern OpenGL in an effective way. Maybe using a low resolution (320x240) rendered at a bigger space so that the pixels looks "bigger?" I'...
1
vote
0answers
32 views

How to make only-head rotation in UE4?

I've made a character, attached a camera to it and setted input. But now i want only character's head to rotate with mouse, but not a whole character (player capsule rotates with Q and E keys). I ...
0
votes
2answers
195 views

How can I benefit when I don't use gpu?

I am trying to make a 3D game with C++, SDL, and OpenGL. My program roughly looks like this: control function has only CPU operations. draw function has CPU and OpenGL functions operations. I just ...
0
votes
0answers
159 views

Having a hard time trying to render an OpenGL scene to ImGui window with deferred rendering

Here's the imgui window that i want my scene to render to. ...
0
votes
0answers
102 views

Making a weapon stay with a first person camera

I was looking all over the internet for any information on how to get a gun to stay with a camera as done in FPS games. I am using OpenGL and GLSL to carry this out. I knew a way of how to do this ...
0
votes
1answer
101 views

How should rendering be structured using SDL?

This question is probably well documented but I can't find any resources. Basically I'm not sure how to structure rendering with SDL in my code. I made a render class which calls the api and the ...
1
vote
1answer
100 views

Handling localization strings in a performant game engine c++

I'm wondering what's the approach for handling localization in a modern game engine. Typically I'd reference a string that would serve as a tag (say: AURA_POISON_CLOUD) in the code and then later in ...
0
votes
1answer
71 views

One VAO takes more time than more than 40 put together despite being simpler

I was running visual studio's CPU profiling tool when I noticed that of my RenderScene call, my skybox was taking up 30% of the frame time. This is particularly weird, as as you can see the Object3D::...
0
votes
1answer
46 views

mouseButton.y and mouseButton.x is -858993460 for every event except MouseButtonPressed

Using SFML, every event type will produce a large negative value for x and y of -858993460. ...
0
votes
0answers
83 views

Array-Backed Entity Component System with Component Polymorphism

I'm tinkering with an array-backed ECS in C++ along the lines of EnTT. Components are stored in a struct-of-array fashion where each component type lives in its own homogeneous contiguous memory block....
0
votes
0answers
41 views

initialising constructor

I am using the SFML library to create a 2D grid. i use grid cords so I can place my players on the grid: I use struct to hold information of the nodes ...
0
votes
1answer
172 views

Game Engine Renderer Architecture

I'm currently building a game engine renderer but I got stuck when I had to separate engine and client code. I had been following OpenGL tutorials to learn about buffer creation, etc so all my code ...
0
votes
1answer
37 views

How to use This Keyword and using iterators to call class methods?

I've been over this for a long time, I can't seem to understand what is wrong, is the use of the this keyword right? I want to add the instance of the class that is being created to the vector '...
0
votes
0answers
33 views

SDL_WarpMouseGlobal does not work in game

I tried to use SDL to move mouse in game. The function works fine only in menu, when I join a game, the function does not work. I checked coordinates with ...
3
votes
1answer
259 views

SDL render surface from byte array efficiently

In my current project I need to fill a 256x224 screen with the pixel values from an array. The array is declared this way: uint8_t *vram = new uint8_t[7168]; So ...
0
votes
1answer
47 views

Direct3D & Assimp Texture is inverted weirdly!

I'm working on a rendering engine but even on the first mesh is something wrong. I use assimp for mesh importing! In the Assimp Viewer it looks correct: And in my software it looks like this: Look ...
0
votes
0answers
60 views

How to make the screen not flicker?

I want to be able to draw all my text, lines , triangles and other stuff to screen and then clear the screen and draw something new, BUT this method makes the screen flicker, and all the drawings dont ...
5
votes
1answer
163 views

Linking Unreal Engine with OpenCV libraries built with RTTI on Linux

Unreal Engine has a plugin for integrating with OpenCV. Currently that plugin works on Windows. I'm trying to modify this plugin to work on Linux. I've worked through many issues but I have one I can'...
0
votes
0answers
52 views

DirectX 11 - Input Assembler - Vertex Shader Linkage error - SpriteFont

I'm trying to render text in my DX11 project, by using SpriteFont and SpriteBatch. Everything worked before adding the code in,...
0
votes
0answers
101 views

OpenGL mouse to world position

I'm trying to implement an editor like placing mod with opengl. When you click somewhere on the screen an object get placed in that position. So far this is my code ...
1
vote
1answer
271 views

How can I exit an Unreal game with a specific exit code?

How could I quit out of a Unreal game with a specific exit code? In Unity you can just Application.Quit(exitCode); but I could not find anything regarding Unreal. ...
3
votes
1answer
70 views

How to access internal data from separated rendering-layer?

I am currently rewriting a project I have been working on last year and I’m utterly stuck trying to "correctly" separate the game-logic from its representation. I know why this is beneficial and I ...
1
vote
0answers
168 views

Game Engine Class and Subsystem Architecture

I have a quick question for those who have experience coding their game engine and such. I was wondering what a better approach would be when designing my own game engine. Right now I plan on having ...
0
votes
0answers
63 views

what is the sequence in using the “send” and “read” commands on the game client and server? boost asio

I have a voxel game in which you can run on blocks (chunks), jump and set/delete blocks. I want to write an asynchronous TCP server for it and choose boost asio as the network library. I have two ...
0
votes
0answers
33 views

Center of World Map not the same as the center of my Bullet Physics World

As you could see in the image, the center of my map should be located at the intersection of the diagonal lines. When I import 3D buildings within the area into my Bullet physics world, I want to set ...
1
vote
1answer
117 views

Getting AABB Collision to work - C++

I've been trying for weeks to get AABB collision set up on my DX11 project. So far, I have a 'condition' set up in place, so that when both cubes collide the 'light' cube will show within the scene. ...
0
votes
0answers
113 views

Dual Quaternion - How to apply the dual quaternion as a transform (Without converting to a matrix)

I've been trying to implement dual quaternions for a bone system and I have a few questions about them. I started by reading the beginners guide to dual quaternions (link: http://wscg.zcu.cz/wscg2012/...
0
votes
1answer
123 views

Sprite Management

I'm working on a game right now using my own engine. In the engine, I have a State Machine which handles input for, updates, and draws the current State - the one at the back of the vector. The game ...
0
votes
0answers
58 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
647 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
27 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
233 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
1answer
69 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
139 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 ...
1
vote
1answer
89 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
92 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
54 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
40 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
60 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
23 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 ...
1
vote
1answer
71 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
157 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
60 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
245 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
50 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
144 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
47 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
198 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....