Stack Exchange Network

Stack Exchange network consists of 175 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
1answer
54 views

Bullet Physics DebugDraw Unexpected Results

I'm integrating Bullet Physics into my project for collision detection and have just gotten some debug draw functionality to work. However, the results are not what I'm expecting. I have tried to draw ...
0
votes
0answers
47 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 ...
3
votes
1answer
80 views

Shader is distorting a Texture of a sprite it's working on

I've been testing out fragment shaders in SFML, trying to learn how to write and use them and I've run into a recurring problem. Every shader distorts the texture. Top left is the distorted test ...
1
vote
1answer
53 views

rotation matrix problems - opengl and own types

In an effort to learn things deeper I'm writing my own mathematics for the first time instead of using libraries. As far as I can tell my matrix multiplication is correct, and translation and scaling ...
4
votes
1answer
151 views

Fixed Timestep with Interpolation | Blurry & Choppy

I've been implementing a game loop with a fixed timestep which uses interpolation as described in the (legendary as I have come to find out as it is referenced in almost every post I have read trying ...
0
votes
1answer
34 views

Apply 2D Texture on all faces of a 3D Cube

I am trying to render a 3D cube, and apply a single texture to all the faces of the cube. I feel like I am missing something critical here as it is applying to the front and back faces of the cube, ...
0
votes
2answers
22 views

Unity crossplatform native plugins

I need to create a c++ native plugin for my game. If I want to support macOS and Windows, do I need to write my plugin twice - one in XCode with a bundle project and another in VS for windows or is ...
0
votes
0answers
36 views

C++ Mouse picking for ray to plane intersection

I'm making a C++/OpenGL application (decidedly without GLM), and I'd like to understand how to create a ray from the camera eye to the mouse pointer, as well as detect an intersection point from the ...
0
votes
0answers
28 views

Yaw on a spherical world

I am trying to make a game where the player can walk along the surface of a spherical planet, and am not sure how to handle orientation. Pitch is relatively easy, as it is simply how much "above" or "...
1
vote
1answer
48 views

How to parse User-defined types from String?

I am trying to save data about various entities in each Level in my game in a JSON file and load it at Runtime(Like a Scene file in Unity). I can save simple stuff like floats and ints and parse them ...
0
votes
0answers
15 views

SDL2 Block collision with player Bug

I am currently working on a small 2D Games Engine with SDL2 for fun. The engine works in a way, that you can define a tileset, which accesses the engine and allows you to place tile by tile on the ...
0
votes
1answer
45 views

Why is integer value not updating as a text?

I have a space shooter game and I am trying to create a shield power for the player ship. My mechanic for shield is working. When I press the shield power button(P), the shield power decreases from ...
3
votes
1answer
164 views

Handling input in a custom ECS engine

I've been implementing an Entity Component System into my custom toy engine so I can learn more about it. Currently I have the following problem: I can't think of a way of implementing input as a ...
2
votes
1answer
114 views

RogueLike - Map and Entities - how to store it?

Started to write my own RL, and already fell into analysis (paralysis?) when implementing map class. My TILE class looks like: ...
-1
votes
1answer
80 views

Convert 3D direction vectors to yaw/pitch/roll angles

I have the code below that takes a set of yaw, pitch, and roll rotation angles (in degrees), and populates forward, right, and up basis vectors to express this rotated orientation as a Cartesian ...
0
votes
1answer
33 views

Set / Get UserPointer - What Do They Do?

I see a lot of talk about glfwGetWindowUserPointer() and glfwSetWindowUserPointer() but I can't for the life of me understand what these functions actually do. From http://discourse.glfw.org/t/what-...
9
votes
2answers
4k views

Storing voxels for a voxel Engine in C++

I am trying to write a little voxel engine because it's fun, but struggle to find the best way to store the actual voxels. I'm aware I will need chunks of some sort so I don't need to have the entire ...
0
votes
2answers
72 views

Problem Implementing SAT Collision in 3D, OBB vs OBB

I am trying to implement SAT collision detection between 2 OBBs, however, I am getting a lot of false positives, can anyone help me figure out what I am doing wrong, thank you in advance. This is my ...
0
votes
0answers
20 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
68 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
29 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
62 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
87 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
45 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
111 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
30 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
46 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
46 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
33 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,...
0
votes
0answers
13 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
27 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
35 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
27 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
59 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
35 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
49 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
28 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
120 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
64 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
31 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
27 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
103 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
29 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
43 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
52 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
9 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
74 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 ...