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

How can I handle mouse input and cursor in a WinAPI window?

Hello I'm studying game engine programming, but I got stuck with mouse input. As for now I have only WinAPI window, which has a message pump and processing. For the mouse I used RAWINPUT, but there ...
1
vote
1answer
79 views

Move and rotate one object to another C++ [3D]

I have two object, need attach 'TWO OBJECT' to 'ONE OBJECT'. I have vectors 'angle' 'origin' of ONE and TWO objects. I tried do "TWOOBJECT.origin += ONE.origin - ONE.oldorigin", this just attach ...
0
votes
0answers
32 views

Update movement actor with collisions in 2D game

I have the algorithm for moving an actor. The actor has: 4 states: Stay, Move, Jump, ...
0
votes
2answers
70 views

SFML - How to animate two Sprites with the same Clock?

I'm making a basic Street Fighter style game in SFML, and I use Clock and Time() from SFML to time the animations. Here's the ...
3
votes
1answer
92 views

How to load game resources correctly regardless of the working directory?

I am writing a resource manager for a hobby game project that reads textures/fonts etc. Up to now, I was giving the location of the files relative to the executable path, like: ...
0
votes
0answers
51 views

Keeping track of moving sprites in 2D grid

I'm working on a 2D tower defence game in C++. The game world consists of a grid of Cells, that are managed by a Map: ...
0
votes
1answer
121 views

God rays shader - Trouble with sun position

I have found a shader that I like here: https://www.shadertoy.com/view/4dyXWy The code for the fragment shader from the link above is: ...
1
vote
0answers
39 views

ImGui, how to get value that the mouse is pointing at in a VSliderFloat widget

I am using ImGui::VSliderFloat to create a vertical slider in the GUI of my application. To do this I just copied the imgui demo code (imgui_demo.cpp), which reads something like ...
0
votes
1answer
49 views

How can I create a Texture2D out of an array of color data?

I'm trying to make a simple engine with DirectX where you can draw to the screen with a function Draw(x, y, r, g, b). The function sets the pixel at x,y to the color r,g,b. The engine has a parameter ...
1
vote
0answers
48 views

Shadows are not showing up

I am fairly new to graphics programming, and I am working on a rudimentary game engine in C++. I had some old graphics code written in Java that I translated, but for some reason the shadows are not ...
0
votes
0answers
35 views

Solve Constraints with linear factor of 0 in Bullet Physics

In my code I need to set the linear factor for velocity to 0 (sometimes). For example, game->rigidBody->setLinearFactor(btVector3(0, 0, 0)); When this is done,...
1
vote
0answers
17 views

btBvhTriangleMeshShape useQuantizedAabbCompression Crash

I use btBvhTriangleMeshShape for static world collision. Generally this works fine, but recently I have encountered situations where the construction of btBvhTriangleMeshShape would crash. In debug ...
0
votes
0answers
29 views

Cascaded shadow map proplems

I am implementing the cascaded shadow map technique with OpenGL and C++, I have some strange behaviors I think my issue with calculating the frustum orthographic matrices, corners and cascaded ends, I ...
1
vote
0answers
39 views

Issue with creating a view in a tilemap environment (SFML)

I'm experiencing a problem with my simple 2d tile map game. I have a character on screen that moves in all directions in a world made up of tiles/blocks. Basically I have created an array that with ...
0
votes
0answers
34 views

How to use opengl3.3 with CUDA using OpenGL Interoperability

I want to render a mesh whose vertices and surfaces are populated and constantly updated inside the GPU. For simple rendering using opengl3.3 alone, I have brought out the data from the GPU to CPU ...
2
votes
1answer
62 views

(SFML) Moving in one direction a time

so i've been making a pathfinder on a grid. I've succesfuly implemented the A* algorithm so the next step is making the AI follow a path. I got it to move to the desired destination but the thing is ...
0
votes
0answers
37 views

Instancing with Directx11

I'm a total beginner with Directx/3D programming. I need help with implementing hardware instancing on Directx 11. I'm trying to render multiple cubes on the screen, to create some sort of Minecraft-...
1
vote
0answers
63 views

OpenGL VAO buffer rebinding vs binding switching

I'm considering two different approaches to vertex buffer management in my OpenGL game engine. The first one seems to be pretty usual, but I haven't seen the second one being proposed or used anywhere....
1
vote
1answer
29 views

Displaying debug line in custom raytracer implementation

Not sure if I should post this here or on the Math forum, but I will try my luck. Some background. I made my custom raytracer. The processing happens purely on the CPU for now, no GPU interaction ...
0
votes
1answer
121 views

Is unzipping SDL2 necessary to set it up on a Visual Studio project?

Some tutorials, such as the one on WikiHow.com, suggest to download SDL and use it without unzipping it. The instructions there read as such: Download the version for Visual C++. It is SDL2-devel-2....
1
vote
2answers
71 views

Collision Detection in Direction (SFML) [closed]

I am experiencing a problem with collision detection, an efficiency problem. Right now I want to make it so that my player square stops traveling in the direction of collision into the static object. ...
0
votes
0answers
32 views

Calculate animation weights based on two variables

I am working on a custom engine and have been tinkering with animations using the Cal3D library. My previous experience with animations was based on prototyping a bit with Unity's Mecanim. Right now, ...
0
votes
0answers
30 views

Alpha blending works when rendering to an FBO, but not when rendering to the screen buffer

My rendering pipeline goes something like this- Bind multisampled FBO Render GameObjects Render Transparent Objects Blit multisampled FBO to normal FBO perform any Post processing Render a quad ...
2
votes
2answers
131 views

Is it feasible to create a game in godot using little to no GDScript [closed]

I am trying to get more into game development, I have very little experience with it. I've been messing around a bit with the Godot engine and am slowly starting to understand it more. I have some ...
0
votes
0answers
30 views

Value returned is different to the value of the original object

I was wondering if someone could help me resolve a small roadblock I encountered aha... Essentially, in my Pickup.cpp file you can see that I'm trying to establish a behaviour wherein the object being ...
0
votes
0answers
50 views

Particle system and 3D scene not getting rendered together

I have been following this lesson for implementing a particle system inside a 3D scene whose code is here in github. My entry point and initialization looks like : ...
1
vote
1answer
90 views

glReadPixels with GL_DEPTH_COMPONENT into PBO is slow

I need to read depth buffer back to cpu memory. It may be few frames old, so I use glReadPixels with a buffer bound to GL_PIXEL_PACK_BUFFER. I use several buffers and ping-pong them. Finally, I read ...
0
votes
0answers
11 views

What is the best way to create a level shortcut for menu with cocos2d-x?

I have a PageView and I want on every page to have an array of MxN items. Each item is a level icon. What if I want to make not ...
0
votes
1answer
81 views

OpenGL 2D Game Render Help

I just recently started using C++ and OpenGL and I am running into an issue. I am not totally sure what I am doing so could you please tell me what I am doing wrong and what I could improve? Here is ...
1
vote
0answers
47 views

Random lines drawn on screen while all vertexes are correct

I'm writing a 2D program in which a monocycle follows a Catmull-Rom spline. My problem is when I write the circle, the drawing goes crazy. There is one line on the screenshot (which seems to be 3 when ...
0
votes
0answers
26 views

When trying to render a texture in opengl after including the stb_image.h file in the project i get a linker error

Initially i gave the path of the stb_image.h & stb_image.c file location C/C++ include directories as adding the header file directly to the project was not working.
0
votes
1answer
85 views

Bullet Physics Integration - direct movement of rigid bodies

I'm adding bullet physics to my engine. The physics simulation bits are all working nicely, but one bit I'm struggling with is being able to move objects using their co-ordinates, and then have them ...
1
vote
2answers
127 views

Wrong FPS calculations in GLFW game

In my game loop, ...
0
votes
3answers
107 views

weird behaviour doing simple XMMATRIX multiplications

I have the following function: ...
0
votes
1answer
76 views

ue4 - create a instance of a c++ class within a blueprint

i'd like to create a instance of a c++ written class in a blueprint. that's my current approach, but the instance is 'None'. any advices? =)
0
votes
1answer
24 views

Uninitialized Variables with Deactivation of Objects in Game Maker Studio 2

I am currently working on some map generation for my GMS2 game, and I have run into an issue that I absolutely cannot figure out. (I am very new to GMS2, so bear with me). I am working on map ...
0
votes
0answers
37 views

Problems setting up Epic online services in an Unreal Engine 4 project

I have been attempting to get the new Epic online services APK working in a UE4 project. When I add the header files and the .lib file to the project, Visual Studio does recognize the various ...
0
votes
0answers
32 views

32 bit record encountered in module ***.ASM (*** has a file name)

I am reading Amazing 3D Games Adventure Set by Lary Meyers. The book is old, and I have got the .lib file compiled correctly onto my computer. The issue is, however, when I run the actual demos from ...
0
votes
0answers
115 views

AI movement in a tile based game

I've been tryin to make My AI follow my A* path in grid. the problem is that is goes off course and doesn't move along the path very well. currently got it to move only left and up. how I intended ...
0
votes
0answers
50 views

GLFW Handling best practice

I'm currrently working on a small Game Engine using OpenGl. For Window and Context managing I'm using the common glfw library. At the Moment my glfw calls and callback functions sit kind of loseley ...
0
votes
1answer
76 views

DirectX depth/order render issue

I have what appears to be a depth or order rendering problem which I have never seen happen before. My terrain and water are rendered with my displacement shader, and at the moment all other models ...
0
votes
1answer
58 views

Getting Position of a Player in a grid

So I am making a pacman-like game. the game has tiles/grid. I keep the node data in a struct: ...
2
votes
1answer
159 views

2D isometric pixel art technique

I recently started to work on a project which consists in developing a game similar to the Urbz on Gameboy Advance (the Handheld version of the game developed by Griptonite Games). This is mainly a ...
0
votes
0answers
77 views

Godot - Is there a way to pass a specific subclass of Node to a GNative C++ class?

I have a GDNative class that looks like this: ...
2
votes
1answer
101 views

UE4 crashes on launch when using custom components in C++?

I created SM_Door in my Editor with a custom Actor class named "Door" to fire some events like open and close. The problem is, ...
0
votes
1answer
34 views

Z rotation matrix inverting object

I'm currently creating a 3d game where I need to rotate shapes. To do se, I created a rotation matrix for each axis, X, Y and Z. X and Y are giving me expected results, but not Z who kind of "inverts ...
0
votes
1answer
129 views

3d isometric projection matrix?

I have 3d vectors that I want to project as 2d vectors to draw my shapes. I got a 3d vector cameraPosition, a 3d vector cameraDirection, a float renderDistance. I need to create an orthogonal / ...
2
votes
2answers
127 views

C++ create array of multiple types

I tried to create an array Entity[] with elements Human and Zomby. ...
1
vote
1answer
121 views

Passing a value to a stuct

So I've been making a 2D grid and pathfinder using SFML. Now I ran into a problem. I've been making a vector for the path nodes. ...
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 ...