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
7 views

Drawing outlines around 2D objects OpenGL

I am trying to draw an outline around any arbitrary object using OpenGL and shaders with a different color than the original object, while also retaining compatibility with alpha values <1. I am ...
0
votes
0answers
5 views

How to render in a imGui Window

I am learning OpenGL by glfw3 lib and I am using imgui to make a interesting application. However, I can not render what I want in a imgui window. I searched google and get below link: Render in a ...
0
votes
0answers
7 views

OnActorHit not calling hit function in Unreal Engine

I am trying to make a pong game in a 3D landscape. I want to make the ball bounce around the box or the Pong pad. But the ball just goes through the walls and pad, but the pad collides with the walls. ...
0
votes
1answer
19 views

Get FVector from Blueprint tick function

In my BluePrint Tick function for my character, I have a FVector that always changes, and in my C++ component, I want to get this changing FVector and use it in my C++ Tick function, is that possible ...
0
votes
1answer
54 views

How To Use Unity With C++?

In the C++ Visual Studio installer, there is an option Game Development With Unity. However, after selecting that, I didn't find ...
-1
votes
0answers
33 views

Syntax for for loop [closed]

Could you explain what this for loop is doing inbetween the ()s? I am only familiar with the usual syntax. Is this an iterator of some sort? ...
0
votes
1answer
17 views

Get BP FollowCamera Rotation and Location

I'm accessing my FollowCamera https://imgur.com/a/vbFagxg from my BluePrintCharacter class in my C++ code, with this following line : ...
0
votes
0answers
23 views

How i can make click and points 3d game by c++ and directx [closed]

How i can make 3d click and point game with c++ and directx ? What is the steps i must do?
0
votes
1answer
20 views

SDL Difference Between using Surfaces and Renderer (C++)

I am new to SDL and I've been following some tutorials, in one tutorial he used Surfaces(a window surface and image surface) and BlitSurface function to draw images without using any renderer(used SDL ...
0
votes
1answer
73 views

Bouncing Ball in c++

Background I've been making my own game from scratch. I've made my own collision system and there's a situation I'm having an issue with. Problem Pictured: a ball going in one direction and ...
0
votes
1answer
58 views

How to correctly reset vertex attributes after modification

I am trying to use the same vertex shader for two different use cases to preserve memory, but I am having issues where the modifications of one shader run are passed on to the next run, even after ...
0
votes
0answers
29 views

Is there an easy way to calculate the velocity of an object on a pendulum?

Want to have a rope travel to the mouse on m2 click and then act as the pivot of a pendulum, with the player being the bob. Used some math I don’t really understand to get the angle of the mouse ...
0
votes
1answer
14 views

How can i write automated tests for some SDL2 objects?

For eg having a class that is rendering something on the screen, could be even a point or a line if not an image or whatever. How is possible to write some tests for that class only? or just a small ...
0
votes
0answers
14 views

Does PerObjectConfig work when loading?

Is PerObjectConfig supposed to work when loading (not saving) the configuration? I did a lot of tries but never succedded to make it work. It worked for a per class basis when droping PerObjectConfig ...
3
votes
1answer
110 views

How do open world game engines allocate memory?

My troubles I've been trying to create a game engine but since I am not well experienced in C++ I am having trouble deciding on how to load new scenes efficiently level by level or just an open world....
0
votes
0answers
43 views

FreeType Library - Text on multiple lines

I am rendering text using the FreeType library allong with OpenGL, but say I want to render a long line of text, as seen in the ...
0
votes
1answer
27 views

My app crash using OpenAL but only in Release Mode

I'm building up a complete game engine so, basically, it integrate a sound system. The problem is that a line make me crash in my code. The strange thig is that my app crash ONLY when I compile using ...
0
votes
1answer
22 views

UE4. How to create a reference to the physical material asset (which I create in editor) in C++

Oftenly, when we want to assign asset to the particular component in C++ we write code like that: ...
1
vote
1answer
51 views

How do I initialise levels sequentially?

I have been learning opengl and I have made good progress over past few months. However I still struggle to understand game logic in C++, I am new to C++ too. Say I have this program. ...
1
vote
2answers
60 views

Third person and LineTracing C++

Problem I have a crosshair in the middle of the screen. I need to create a lineTrace that passes straight through this crosshair. As this is a third person game,...
1
vote
1answer
34 views

SDL window crashes when mouse goes below a certain point

I added code to check the rgb values of my surface, and whenever i call the function it seems to work fine! the only problem is that whenever the mouse goes under y = 400 the entire window crashes... ...
0
votes
0answers
28 views

OBB Frustrum Culling in Clip Space

I've been trying for a while to implement a frustum culling method using a per-computed AABB in object space and transforming it's corners into clip space. ...
0
votes
0answers
10 views

How can I 'pass' multiple render targets to an Unreal compute shader?

I need to access three things from a compute shader: the current textures being drawn to two render targets, as well as the previous output of the same compute shader. Essentially, I am trying to ...
0
votes
1answer
38 views

Debug in OpenGL & GLFW (version >= 4.3)

I try enable debug system in OpenGL with helps debug output in OpenGL version >= 4.3. My code: ...
0
votes
0answers
20 views

Help with Minecraft-like AABB-AABB collision detection and resolution

I am currently working on a Minecraft like game with OpenGL and C++. I've gotten as far as abstracting a Camera object and setting up movement and even defining basic gravity like simulations, but I ...
0
votes
1answer
248 views

Text Rendering using FreeType library not working correctly

I am currently implementing font rendering into my 3D game engine using the FreeType library. I have followed this tutorial: https://learnopengl.com/In-Practice/...
0
votes
0answers
30 views

How to properly do smooth speed degradation?

at the moment I'm using this: playerclass.xspeed += (playerclass.xvelocity * loopclock.getElapsedTime().asSeconds()); to build up speed To ramp up speed and ...
0
votes
0answers
41 views

Random world Points in GLSL for tree placement

I'm doing tree placement in the geometry shader in GLSL. I've made a seeded random vec3 function based on gold noise that looks like this: ...
0
votes
2answers
112 views

Algorithm for units to attack each other in strategy games [duplicate]

I am creating a strategy game with many objects, in which the objects will be able to attack each other. If an object is within attack range of another object, it will be attacked. But I only know ...
0
votes
1answer
99 views

How to set the value of each index in a uniform array

I am currently implementing "instancing" into my game engine to allow the drawing of 1000 tree models following the tutorial found here: https://learnopengl.com/Advanced-OpenGL/Instancing. I have ...
0
votes
1answer
87 views

Time to render each frame is proportional to the amount of models in the scene

This question is deliberately written in a "High-Level" manor to avoid screeds and screeds of code snippets, hopefully I can get my point across, I am using C++ and OpenGL. I have a game engine, and ...
0
votes
2answers
103 views

How do I move Space Invaders like enemies in groups efficiently?

So like the title says I want my Enemies to move on a Grid like in Space Invaders. Say I have 8 rows and 12 columns. Now there are 10 Enemies in each row and there are 5 rows filled. In total I have ...
0
votes
0answers
36 views

Further improvement on algorithm A *

i have a game use A*, this algorithm find path is good in many case. But if I could not find the way to the destination, it would have to go through many nodes (my map is in gird format). I am ...
0
votes
1answer
29 views

Broken model matrix builder

I'm trying to setup basic render pipeline in Vulkan and am currently setting up the perspective, view and model matrices. The line that calculates the position in the vertex shader is this: ...
0
votes
2answers
67 views

C++ Generate random float values between a range

In my current situation I have a game world, in that game world I want to place loads of tree models. It is a waste of time for me to actually explicitly define the x y and z values of each tree model,...
0
votes
0answers
42 views

Box2d ContactListener function. Problem calling a function on the collided objects

I created a ContactListener class which derives from b2ContactListener. I am following the excellent tutorials found here: https://www.iforce2d.net/b2dtut/collision-callbacks Collisions are detected ...
0
votes
0answers
58 views

OpenGL viewport is stretched

For this project I am using GLFW, glad and glm. My window looks like this: The dimensions of the window are correct, but the viewport is stretched, making my square into a rectangle. How do I use a ...
0
votes
0answers
33 views

Frustrum culling without per-mesh positions

I am trying to implement frustrum culling in a C++ renderer im writing but I feel like I hit a brick wall. The plan is to load the Sponza level and per mesh create a collision box using Bullet ...
3
votes
1answer
148 views

How to generate random waves for a bullet hell game that feel balanced and natural

My game consists of 'waves' of objects called 'spawners', which once every certain amount of time (their firetime), move to a new place on the screen and spawn an enemy. Each wave has 4 important ...
0
votes
0answers
37 views

Tiled Map Editor. How is the correct texture chosen per tile? (tmxlite)

I am still a beginner, this question is probably quite silly. I made a map in Tiled Map Editor. It contains 3 layers 'sky, water, solids'. Right now, I am just trying to build my sky tiles. I had ...
0
votes
0answers
26 views

DirectX: MFC OnIdle limited to 60 fps

i have a very particular issue… i have directx classes for rendering to a window. I have created a GUI with MFC c++ and integrated my DirectX classes with it. I am initialising on OnInitDialog ...
0
votes
1answer
106 views

Is Windows window creation faster / more efficient than GLFW window creation?

Are there any benefits to using Windows window for OpenGL or Vulkan rendering, rather than using GLFW window? Is there any performance hits when using C++ Window creation over GLFW since it provides ...
0
votes
0answers
24 views

Rendering to framebuffer object not working

There is a problem when I am trying to render to texture from the framebuffer object. I get the message that the FrameBuffer Object is Complete but apparently all I get is a black texture. this is ...
0
votes
1answer
42 views

Box2d Raycast C++. Always returning false? (trying to check if player is grounded)

I'm trying to add Box2d to my C++/SFML platformer game. I have my ground tiles with a b2staticBody. And the player character is b2_dynamicBody. My usual method to check if player is grounded is to ...
1
vote
1answer
60 views

GLM conversion from euler angles to quaternion and back does not hold

I am trying to convert the orientation of an OpenVR controller that I have stored as a glm::vec3 of Euler angles into a ...
1
vote
0answers
40 views

SFML Separating Axis Theorem collision detected outside shape

Trying to implement the SAT in SFML using SFML's ConvexShape. Some shapes, like rectangles, seem to work but others trigger the collision outside the shape. I tried drawing the normals, or the axes ...
0
votes
2answers
73 views

Forward declaring in SFML C++ . How to know whether to #include in .h or .cpp?

Hello I am trying to teach myself about the how's and why's of OOP in C++. So I am trying to seperate most of my code into specific classes and methods that do specific things. I've also been reading/...
1
vote
0answers
85 views

Generate road mesh from a graph

I want to generate a mesh for the entire road network(later I'll probably want to split it into chunks but for now this will do). My road network is stored as a ...
1
vote
1answer
113 views

SDL2 C++ How to make enemy move in random directions

How do i make an Enemy move in random directions? I tried this but it doesnt work how i want it to.. thats why im asking what i need to do, to achieve that? (Pseudo code would be cool) ...
0
votes
1answer
25 views

GLFW window becomes unresponsive when asking for input!

I am trying to write a simple C++ game using OpenGL. In my render loop i ask for text based input from the user but this causes the GLFW window to become unresponsive. I suspect that this happens ...

1
2 3 4 5
77