C++ is a statically typed, free-form, multi-paradigm, compiled, general-purpose programming language.

learn more… | top users | synonyms

0
votes
1answer
78 views

Sprite quickly disappears after rendering

I'm currently making space invaders and I'm using the game loop pattern as described here. I have an entity class from which there is a spaceship derived class. The base entity class contains all of ...
4
votes
1answer
86 views

How to solve Sweep and prune false positives concerning large floor plane

I am developing a 3d sweep and prune module for a project, and it is producing false positives. The pair generation code is as follows: for (unsigned int i = 0; i < mXExtents.size(); i +=2) ...
2
votes
1answer
252 views

Immovable object impact physics

I am trying to do some physics calculations from scratch, and as a result am creating a small bouncing ball example. However, I have some issues getting correct results from my impact physics when the ...
2
votes
2answers
107 views

Example/Tutorial of passing structured data over network C++

This is very general question, about strategies how to pack same informations about state of my game-world on server ( e.g. position/orientation of players, projectiles, etc. ) into data stream so ...
1
vote
0answers
64 views

Memory leak with glfwSetWindowTitle? [closed]

I am using GLFW for a game, and I have a function which allows me to set the window title. // PROBLEM WITH INCREASING MEMORY USAGE void WindowSystem::setTitle( const string & title ) ...
0
votes
0answers
32 views

Screen Size 2D Gameboard Background

I am trying to get the screen size of the current monitor and then render the game board to match the screen orientation but currently I am scaling the game board to a larger size which not the best ...
0
votes
1answer
83 views

Updating a multithreaded Entity-Component-System

I am currently trying to implement an (sort-of) Entity-Component-System. I've got the gist of it, that is, how an ECS is supposed to work. So far i have 4 classes in my design (not yet fully ...
4
votes
0answers
73 views

Screen tearing in fragment shader on R9 380 GPUs

two players are encountering an issue with my game where the screen is tearing when it uses a fragment shader but it only seems to be doing this for players with a R9 380 GPU. Here is what it looks ...
2
votes
2answers
65 views

Calculate matrix transformation components separately

It is possible to calculate the translation, rotation and scale that were used to build a matrix? I mean if I have a matrix M can I calculate the rotation, scale, and translation it represents? Of ...
0
votes
1answer
62 views

How can I correctly instantiate an octree in UE4?

I tried to create a simple Octree like this: (I looked at the FMeshTriOctree source code since no question in answers.unrealengine.com helped me) // My FVertex class is slightly more complexe, but ...
1
vote
1answer
239 views

How do I render a 2D overlay with DirectX 9?

I'm working in C++ with DirectX 9 on a 3D game, but I want a 2D overlay for rendering a HUD. I've heard that I could use D3DXMatrixOrthoLH, but I'm very confused on how to use it. I'm more familiar ...
0
votes
0answers
44 views

Why won't my object go 3D DirectX11?

I am trying to make a 3d mesh within my code. For some reason it looks deformed, which makes no sense because I specified the vertices correctly I am pretty sure. Also sorry that I am posting loads of ...
0
votes
1answer
39 views

D3D11CreateDevice leads to syntax error [closed]

I'm following the book Introduction to 3D Game Programming with DirectX 11 by Frank Luna (link) and I'm trying to make the empty project in Chapter 4 (don't worry, I don't expect you to read the book) ...
1
vote
1answer
108 views

GLSL strange if statement problems

I'm trying to use if statement in my fragment shader. I want to compare my in int finalLightType[4]; Here is my vertex shader code and fragment shader code: Vertex: #version 400 core in vec3 ...
0
votes
0answers
22 views

Pleats and folding

We have a C++ module that produces mesh dynamically and simulates it with a physics engine. We want pleats on the surface of our mesh, pleats that remain sharp and folded during simulation while ...
0
votes
1answer
128 views

How to rotate a triangle towards the point in Qt?

I have an issue with items rotating. I have a point and a triangle which needs to be rotated with its apex point towards the taregt point. The right side of the picture represents how it is should to ...
0
votes
1answer
92 views

Best way to structure SDL2/C++ game? [closed]

I was reading some SDL2 tutorials and I noticed that you need to pass your window surface handle to any drawRect calls. Should I create a global surface handle or pass the handle by reference into ...
2
votes
1answer
67 views

DX11 Losing Instance Buffer Data [closed]

I've got a function that basically creates different instance buffers into an array for me to use in my DrawIndexedInstanced call. But when I pass the vertex buffer and instance buffer through to my ...
0
votes
2answers
187 views

Modern OpenGL project in c++ .obj loader

I want to create a class in c++ that loads a model with the obj format.The model gets generated from Blender(3D modeling program).When i try do draw something on the screen without the class(all the ...
-1
votes
1answer
83 views

C++: from LWJGL to C++ with OpenGL

I've been trying my best on porting my 3D game from Java to C++, but to no avail. I use only LWJGL with OpenGL but I cannot find any other library in C++ that supports as much as LWJGL does for Java. ...
3
votes
1answer
63 views

Dynamically generating triangles from points

I'm working on 2D lighting. I have a list of points that have been calculated and when I draw lines from the light origin to the point it works. The problem is connecting the points into triangles. ...
0
votes
0answers
71 views

C++ timer for game loop(consistency across machines)

sorry I have been searching for ages and can't seem to get a good answer that I can understand, I am trying to make a game in my universities TL engine, and I can create a timer class fine, but I'm ...
1
vote
0answers
38 views

Drawing multiple polygons with vertex buffer object

I tried to create program in which I would draw multiplepoygons here is fragment of what I have done: GLuint VertexArrayID; exampleof drawing triangle(I have more polygons, like circle, and so ...
1
vote
0answers
18 views

Updating aiScene in ASSIMP with skeleton data

I am working on a project where I take an unrigged closed mesh, import it using ASSIMP, auto-rig it using the algorithm provided by Ilya Baran and Jovan Popovic and again export it using ASSIMP. I ...
0
votes
0answers
30 views

Open gl blending problem c++

im creating project from nearly scratch in c++.. i created skybox and terrain . the result is catastrophic ! the terrain goes away and the ground also goes away,i dont know why ! i tried to disable ...
0
votes
1answer
64 views

directX rotation of a 3d cube inconsistent

i'm trying to develope a simple 3d cube in directX that can be rotated in any direction by dragging the mouse. It works in the following way: i drag the mouse to the right or left, and the cube ...
0
votes
0answers
78 views

How can I improve my ray casting algorithm

So I finished coding this ray casting algorithm in C++ and I feel like it could be improve, despite that, I believe that it is really good since it is coded using SFML. Here is the algorithm in C++ ...
0
votes
1answer
48 views

OpenGL dynamic font glyph cache library

I have begun work on an OpenGL application (all on my own and with little knowledge) and started with FTGL, rendering true type fonts, which, with alot of text has a great impact on frames per second. ...
1
vote
1answer
89 views

How can I render a texture to a polygon in SDL2? A fake 3D problem

I am working on a fake 3D game recently. The game is based on the perspective principle and using angular perspective. Here is a screen shot: But the problem is that the walls and floor displayed ...
-2
votes
1answer
119 views

Why is my delta time constantly under 1 millisecond?

I have a game loop that looks like this: while (Sync()) { DoStuff(); } The sync function computes my delta time like this: bool Sync() { EndTime = GetTime(); DeltaTime = (EndTime - ...
2
votes
1answer
193 views

How to calculate delta time with SDL?

I have heard that you can calculate delta time with two functions called SDL_GetPerformanceCounter and SDL_GetPerformanceFrequency. I'm not sure how they work completely, but I heard it is a bit ...
4
votes
1answer
86 views

Apply delta time to physics correctly

So I'm trying to create a simple physics engine for the game I'm creating. I'm trying to add jumping to the game. To do this I used (where jumpPower is 30000): impulses.emplace_back(0.0f, mass * ...
4
votes
0answers
99 views

Windows vs OSX Performance with SDL, OpenGL [closed]

I have been writing an SDL OpenGL game in c++ for a couple of years now, writing my own engine for the most part (using Box2d for physics). I'm primarily a mac user, so I've been using xCode to write ...
1
vote
2answers
369 views

Are C and Objective-C sufficient for creating games on the iOS? [closed]

These days, I'm focusing on games development on the iOS. C++ is the lingua franca for games development but seriously, I prefer to code in C programming language, not in C++. So for iOS games ...
5
votes
4answers
5k views

Is ActionScript 3 used by Serious Indie Developers? [closed]

This question is for dedicated independent game developers: My dream is to be a game developer. I am a senior in high school who has taken Computer Science for all four years. I have used Java the ...
0
votes
2answers
168 views

Switching a project written in Lua to a compiled language [closed]

I am experimenting with game development in Lua using the Love2D framework, and while it works fine, I am getting tired of using a dynamic scripting language. I would like to have better performance, ...
0
votes
1answer
38 views

Is there a 'wait' function in Allegro5?

I am creating a game in allegro5 and I have come across a problem. I have a character that fires a shotgun and there needs to be a delay before he can shoot again. The code for shooting his gun is in ...
0
votes
1answer
64 views

OpenGL texture 2d array won't render with depth > 1

Below code uploads my texture memory that's described in the passed parameters. When 'vPixelData' only holds 1 item/texture it is rendered properly, but once there's 2 or more nothing shows up. ...
-3
votes
1answer
78 views

Creating a Zelda-like map in pure C++ not working [closed]

I wanted to create a map like in Zelda, but it keeps showing hashtags instead of 1 on A1 and I don't know why. vector <string> A0 {"#","#","#","#","#","#","#","#","#","#"}; vector ...
1
vote
3answers
1k views

My SDL Game executable cannot run outside codeblocks

After compiling and running SDL programs successfully inside CodeBlocks, when I run them outside CodeBlocks (by clicking .exe file) my program does not run. Instead, it says that libstdc++6.dll is ...
0
votes
2answers
88 views

passing a class type as a parameter [closed]

I have a setup in my game engine where I can add behavours to game objects. All behaviours are based on the class AbstractBehaviour. To easily get access to behaviours from a game object, I am trying ...
2
votes
2answers
175 views

How to stop sinking bodies in physics engine C++

I'm writing a rigid body simulation in C++, and have come across a problem when an object should come to rest on the ground. Because gravity is being applied to it's velocity, the object starts ...
15
votes
1answer
1k views

Is it possible to use the Unreal Engine as a big C++ library, without using the editor?

I want to write a game entirely in C++, but I would like to profit from the possibilities offered by the Unreal Engine, especially in terms of graphics and physics. Nevertheless, I strongly dislike ...
0
votes
0answers
46 views

Get Mouse Location With Respect to any Camera/Object in Unreal

Am Currently working on a VR Project (First Person Shooter) where the Player can shoot any where on the screen. Am using Scene Capture to Texture method. The VR part is working fine. The Problem am ...
0
votes
1answer
585 views

Animation, Interpolation, & Structure

I have been working on animation in my small game engine recently and I am implementing some interpolation to be used with skeletal animations. I know how to do interpolation but I am not sure where ...
1
vote
0answers
47 views

Implementing Browser in Unreal Engine 4.10

I am looking to add some oauth to a game I am working on. I can get the user auth to work in the browser that comes with UE4, however there is not any capability to detect changes to the currently ...
0
votes
1answer
60 views

OpenGL GLSL vector of sampler2D

If im trying to create an obj. file loader in c++ and draw it with opengl i need to use multiple textures in the fragment shader.I know i can just use: `uniform sampler2D Texture1` `uniform ...
0
votes
1answer
54 views

How do I calculate a vertex's position on the CPU?

I'm creating light processor and I need light position and vertex position after translating, rotating and scaling (to calculate distance between them to check if light is affecting my vertex ...
0
votes
1answer
91 views

C++ & OpenGL - Bad orthographic projection matrix?

So I'm trying to render 2D text in my Game Engine using programmable pipeline. Normally I'm using perspective projection matrix but for UI elements I'm trying to create orthographic projection matrix ...
1
vote
1answer
58 views

Mesh slicing/knifing with multiple planes

I have a ginormous mesh which I want to cut with multiple planes. For simplicity I want to know how to cut a mesh with single plane and repeat the logic. Consider a X-Y plane of coords (1,1,0,0) = ...