Questions tagged [c++]
C++ is a statically typed, free-form, multi-paradigm, compiled, general-purpose programming language.
4,160
questions
0
votes
1
answer
748
views
Failed LockRect of IDirect3DSurface9
I have hooked Present method of the IDirect3DDevice9 interface, and I want to be able to start video capturing.
Taking a screenshoot like this work
...
2
votes
1
answer
738
views
Physics bodies randomly losing Velocity along an axis after impact
This just started occurring and seems to randomly happen during, and between, game sessions. A dynamic moving body collides with a static body and instead of bouncing off looses (almost completely) ...
7
votes
2
answers
400
views
How to generate a multiplier map for radiosity
I am following this tutorial: here
I am at the part where you are creating a hemicube.
I have got the code to render the scene into a texture and therfore an array.
Now how can I generate a so-called ...
0
votes
1
answer
458
views
How to get image component from blueprint in c++
I have a dialog screenwith character icon and I need to be able to set up this image in code. But I don't know how to access this Image component (I put material instances in it).
.h
...
0
votes
1
answer
59
views
How to safely store opengl vertices in a c++ struct
Instead of using a vector of floats, i want to use a struct, so that it can store different types and is easier.
...
0
votes
0
answers
34
views
OpenGL rendering a specific color attachment to the screen
Current fragment shader:
layout(location=0) out vec4 output_0;
layout(location=1) out vec4 output_1;
Here I want to render the output_1 to the screen instead of ...
1
vote
1
answer
4k
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
1
answer
1k
views
Rotate camera around its center in 2D
I'm currently trying to develop my own little game engine (trying to understand maths in games).
I have implemented 4x4 matrices and 2d vectors (I don't need 3d since I'm aiming at orthographic ...
1
vote
0
answers
49
views
Raycasting floor/ceiling textures sliding
I'm writing a raycasting engine in C++ and SFML.
I have the wall texturing done and I'm trying to get floor and ceiling texturing right.
I almost got it but the textures are "sliding" when ...
1
vote
1
answer
2k
views
Assimp - Error loading .obj files
I'm trying to load .obj files in my little game. I decided to use assimp as tool to import those models. But it seems that assimp does not import them correctly.
I looked for a simple cube mesh ...
0
votes
1
answer
49
views
2
votes
1
answer
133
views
How to abstract VAO as a class in c++
I read the khronos docs on Vertex Array Objects, and it says that VAOs do not copy any data but refer to VBOs and EBOs/IBOs. So i created an abstraction class vbo which creates a vertex buffer from a ...
8
votes
2
answers
478
views
Why isn't my cbuffer updating?
I am really frustrated because my cbufer isn't updating.
This is my VS:
...
0
votes
0
answers
31
views
Can't load the textures when using Mac's .app format with stb_image & OpenGL
When I test the game, I run the game with $./main, it loads the textures and everything is fine.
However, when I put the executable in MacOS's Apps folder and the ...
-1
votes
1
answer
102
views
How will you go about designing A* pathfinding for a pong game?
I want to design A* path finding in the pong 2d game.
As far as I know I can just simply design an Ai as in
...
3
votes
1
answer
1k
views
How to correctly synchronize a shared surface?
I am trying to share a direct3d9 surface between two processes. One process (let's call it A) writes to the surface, and the other (B) displays it on screen. Currently, process A does a StretchRect of ...
1
vote
2
answers
551
views
How to render a bevel effect with SDL2 Texture?
I develop 2D games using CodeBlocks (C++) with SDL2.
I can load a texture (ex. a gray square) and render it to the screen. All is fine. If I want to change the color of the square? Yes, I can do it. ...
0
votes
0
answers
43
views
How do I resize an OpenGL texture created using new DSA?
My texture class uses new function glTextureStorage2d() (which OpenGL recommends), but the problem here is that this function makes the texture size immutable, ...
0
votes
2
answers
81
views
Perlin algorithm generates weird artifacts
I'm writing a Perlin noise generator in C++ for terrain generation but the generator produces weird JPEG-like artifacts instead of proper noise.
I've tried doing it using C# in Unity and confirmed the ...
0
votes
0
answers
44
views
How do you display a bitmap every screen update in Windows / C++?
I'd like to write a program in windows / C++ with one thread doing calculations on a bitmap (represented as an array of bytes) and the main thread displaying that array as a bitmap every screen update ...
2
votes
1
answer
1k
views
Using UPawnMovementComponent to control a Pawn with Keyboard sharing code between Pawns
I've just started to learn Unreal and reading the tutorial Components and Collisions I have found that they use the UPawnMovementComponent to control their ...
0
votes
0
answers
38
views
How can I correctly draw semi transparent textures in a VBO in C++/openGL
I am using C++ glew/glfw to make a game, and I currently have different areas of the map and different entity classes using their own VBO's. So far this decision has been informed from a large part of ...
1
vote
1
answer
680
views
Passing heightmap data to btHeightfieldTerrainShape constructor
I was searching for a couple of hours, but I didn't find final solution, after trying many ways.
I'm trying to get heightmap heights data, and pass it to btHeightfieldTerrainShape.
Let's say my ...
0
votes
2
answers
54
views
Efficient way to organize your collectible Actors
Assuming I want to make a RPG, where I can pick up different stuff, like plants and weapons.
How would you create the Actors?
More precisely:
Would you create an Actor for every item, maybe deriving ...
1
vote
1
answer
96
views
How do I make multiple circles bounce of each other
How will I calculate the direction of the circles when they hit each other? (there is no change in speed, there is no mass, and all circles have the same radius)
...
2
votes
1
answer
38
views
Box2D not updating b2Body* positions
For context, this is inside my custom 2D game engine. Inside the editor code, when the 'play scene' button is clicked, the scene creates it's b2World and then ...
0
votes
1
answer
2k
views
How do I clear streaming textures in SDL?
I need to clear a streaming texture before I draw into it on the next frame, because only a part is updated, and it's random enough that I can't predict which part will be clear.
I don't want to ...
1
vote
1
answer
562
views
Box2D simulation running slower on lower FPS(even when the desired FPS is lower than the actual) [closed]
I´m playing around and trying to make myself an easy platformer using the Box2D physics, before that I was not using it and was using my own physics implementation(just simple movements with timestep)....
1
vote
0
answers
25
views
Execute both exec ports in the same frame
I made the following:
Notice the [Button] node has two execute ports.
The CLICKED exec port is executed when a button is clicked. The other exec port is supposed ...
1
vote
0
answers
32
views
How to reduce required memory when collecting cells in a portal engine that represent open areas?
My engine is based on Cells and Portals.
From the Current Cell, I traverse the portals recursively. While doing so, I cache the clipping rect. When rendering the cells, I use the cached clipping rect ...
0
votes
1
answer
150
views
Constructing a world ray from mouse coordinates
I've got the following c++ code. It produces a Ray from the mouse coordinates given. However the z coordinate is wrong, I expect it to be on the near plane of the ...
-1
votes
1
answer
99
views
Batch rendering model matrix to shader
I'm working on a batch renderer. I'm limited to using one shader per batch (one draw call for everything).
I want to use a TBN matrix for my lighting. To calculate the TBN matrix for each object I ...
0
votes
0
answers
24
views
When calling SDL_CreateTextureFromSurface using SDL2 it sets all other textures to be white boxes
I have a game loop which shows 6 heroes, and 1 is assigned to the user; if the user clicks the left mouse button, I want to spawn a bullet.
All of the heroes show fine and render works when the game ...
0
votes
0
answers
29
views
How do I generate Landscape actor based on player coords in UE5.1 c++?
After searching everywhere and only finding blueprint ways to do something similar using regular meshes in UE4, I've landed here.
I tried RTFM but I have severe ADD and get lost in tangents that never ...
0
votes
2
answers
226
views
Defining path for tower defense game
I'm currently developing a tower defense game as a part of a group project in school. This game will be programmed in C++ using SFML. We are having trouble with finding a good way to define the path ...
0
votes
0
answers
70
views
UE4 - How can I show in image using Slate?
I am working learning Slate for doing the UI. I am having a problem setting a background image. The background is all black and I do not see the image anywhere. What am I doing wrong? I have done ...
0
votes
0
answers
50
views
2D physics engine collision issues
I'm currently stuck developing my own simple physics engine. I'm getting an issue where objects wont come to rest. Instead, they jitter and eventually are shot off into the distance, and some even ...
0
votes
2
answers
71
views
Interactable actors should be implemented via components or inheritances?
I am new to game development and I am learning Unreal Engine right now.
When a player character APlayer wants to interact with other actors (such as ...
0
votes
1
answer
93
views
OpenGL 4 tracers
We have implemented a glow map into our renderer. It basically uses a blur filter on the glow map pass. But, I cannot figure out how to do tracers in OpenGL. Someone suggested using a couple of ...
0
votes
2
answers
695
views
Getting cameras from World to set up a static camera only game
I'm trying to use ACharacter for my characters, but the game uses ONLY static cameras (ie. they shouldn't even logically be attached to the mesh of the characters). ...
0
votes
2
answers
437
views
Game movement in 2D SFML game
I am making simple 2D game, imagine it as 2D Minecraft where you can dig blocks and build other things.
Currently I am struggling with movement. I have none experience in game development, but I am ...
0
votes
1
answer
100
views
OpenGL 4 depth of field
I am implementing depth of field. My fragment shader has the following code in it:
...
0
votes
1
answer
72
views
OpenGL 4 hidden line removal
I'm having trouble with hidden line removal in OpenGL 4. I use a vertex/geometry/fragment shader to draw the lines. I call
glDepthRange(0.01, 1.0);
before I draw ...
1
vote
1
answer
132
views
Why is my Moon not orbiting Earth in my physics demo
I am in the midst of making a gravitational body demo for my physics engine. For the demo, I am trying to simulate both all the inner planets' (Mercury-Venus-Earth-Mars) orbits around the sun, as ...
1
vote
0
answers
50
views
Improve performance of hexagonal tiles
I am trying to create a game similar to a board game on a hexagonal grid (also similar to Civilization game).
I want the tiles to be able to display various textures and of course be able to detect ...
2
votes
0
answers
63
views
How can I write a fold expression in Unreal 5?
I'm trying to write a variadic function template that would fold a parameter pack over an expression in UE5.
However, the compiler fails on the fold expression.
Since my function is a little complex, ...
0
votes
1
answer
96
views
Calculate the Right and Up vectors using yaw and pitch in right-handed coordinates
I have an assignment where they ask me to calculate Vector Right and Vector Up, it's for a camera creation using C++ and DirectX. For the Vector Right, they specify I should use 90-yaw, so I got:
\$ ...
0
votes
1
answer
142
views
How to set up server architecture using C++
I'm trying to make a Multi User Dungeon (MUD) game, and obviously a pre-requisite to that is a server.
I've seen stuff like this:
...
1
vote
2
answers
800
views
SDL: Certain bitmap not displaying
I have come across a very wierd problem. Here is my code:
...
0
votes
0
answers
76
views
Server-Client Communication
I have a client, and it's basically a potato client. What I mean by that is it's code is something like this: (This is a junky version of the code, just to make a point)
...