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

learn more… | top users | synonyms

1
vote
1answer
74 views

Fixed-Timestep still updating too fast

I'm trying to figure out if I'm approaching my simple fixed-timestep implementation correctly, following examples such as: Gaffer (without RK4), and DeWitters Currently, I have a game object which ...
0
votes
1answer
33 views

SFML RectangleShape won't render

I have a sf::RectangleShape in my code which is defined like this : sf::RectangleShape shape_1; And it's values are set like this : shape_1.setFillColor(sf::Color::White); ...
0
votes
1answer
29 views

SFML dynamically loading images

So I'm screwing around with c++ and SFML, when I thought to myself the following: If the images are compiled into the executable, with enough sprites for the game, memory might become a problem at ...
0
votes
0answers
22 views

SDL touch input on Android (3D camera rotations)

I have a question regarding rotating a 3D camera on an Android device using SDL for touch inputs. The desired effect should be when the user touches and moves their finger on the screen the camera ...
0
votes
1answer
60 views

Clearing memory from variables? [closed]

So, I've heard of the delete keyword, which clears variables that use the new or new[] keywords. I have a class called Box, which I made a object of in my main.cpp. What if I want to clear a ...
1
vote
2answers
49 views

c++ Opengl handle elements drawn

I am currently working on a game and I want to know if there is any way of handling with the elements i am drawing . For example : if i draw in a loop 100 cubes , how can i show / hide the cube number ...
1
vote
0answers
27 views

Direct3D11: Directional Shadow Maps

I've recently implemented shadow maps on my project. However, I'd like to add a feature that allows the light direction to be dynamically changed, so that the terrain can be viewed using different ...
0
votes
2answers
98 views

sf::RectangleShape's position is not same as I set it to

When I try to print my box.getSfShape()'s position it does not print out the position I set it to have. ( The box.getSfShape()'s position is by default set to 0 ) Wrong output : ( printing the ...
3
votes
1answer
103 views

Efficient vertex buffer memory management?

I am building a voxel engine with a similar mechanism to minecraft(yes, I know...). It works by loading and unloading individual chunks of 16*64*16 cubes each in a square grid around the player. This ...
3
votes
0answers
31 views

How to link assimp lib to universal app

I cannot make assimp object loader work with universal app, and I got the same problem as this one: Assimp and directX12 universal apps I tried the static library approach mentioned in the answer of ...
1
vote
1answer
77 views

C++ : Library for creating 3d view picture [closed]

I've got a numerical simulation, where I have as an output 3d matrix of billion elements - the visualisation of data is 2d flat image: When I was starting I was just outputting 2d data to gnuplot, ...
2
votes
2answers
174 views

Cost of Using Virtual Methods to Query Properties?

Let's say you're making a tile-based roll-playing game, and you're obsessed with OOP. You have an abstract base class Tile which will be inherited from by many derived classes, like Grass Sand and ...
15
votes
3answers
3k views

Should I use a database for storing game content? [closed]

I have a 2D Game written in C++ using SFML. I want to make the game expandable in such a way that content like items or entities could easily be added by adding a line/entry/row to a file or ...
2
votes
2answers
53 views

Should I be returning weak/shared_ptrs or unique_ptr's to my resources?

A friend of mine told me instead of normal pointers, I should use unique_ptr, i asked him why unique_ptr's if some resources are going to be shares, like multiple grass tiles, or enemies. I currently ...
2
votes
1answer
197 views

Why do my Box2D bodies not fall, even though world.step is called?

I have SFML set up with a Box2D world that has gravity, but my bodies won't move. I std::cout'ed the position of the body in the game loop, but it's always at (0, 14)! No errors or warnings, just no ...
16
votes
6answers
4k views

How do I correctly use singletons in C++ engine programming?

I know singletons are bad, my old game engine used a singleton 'Game' object that handles everything from holding all data to the actual game loop. Now I'm making a new one. The problem is, to draw ...
2
votes
1answer
58 views

Simple 3D OBB-Collision (DirectX9, C++)

I'm trying to implement a simple OBB vs. OBB collision detection! I don't need to know where the collision occures, I only want to know whether a collision occures. The problem is, that after lot of ...
1
vote
1answer
30 views

What happenes if you leave out buffers for the inputassembler that the vertex shader expects?

I'm working through my first attempt at a "graphics engine" (I use the term loosely as I'm not aiming for much more than something that will display a few meshes). I want to leave my classes as ...
0
votes
1answer
105 views

How to make my components only contain raw data?

I'm reading that Components in ECS are just only data and have no logic. I'm trying to follow this and I got that working: class Sprite : public Component { public: Sprite(const std::string ...
3
votes
1answer
287 views

What are “frame A” and “frame B” in btGeneric6DofConstraint's constructor for?

I have a very simple (and maybe too primitive to post here but I’ll try anyway :P) question about Bullet constraints. What are arguments const btTransform &frameInA, const btTransform ...
8
votes
3answers
973 views

Why is it possible to encounter a texture coordinate greater than 1 or less than 0

I'm studying a text about texture mapping and in the preparing to draw session, I read: Define the texture wrapping parameters. This will control what happens when a texture coordinate greater than ...
2
votes
2answers
153 views

How to allow multiple bullets on screen at once

Using my universities API, I'm making a basic 2D game where pacman can shoot ghosts I have a bullet class but at the moment, I only have one instance of the bullet could anyone help edit this ...
2
votes
1answer
40 views

Shaders wont bind to the uniform block

I'm having an issue with interface block binding. Example shader: const char* vertexShader = "#version 330 core\n" "uniform globalMatrices" "{" " mat4 ...
16
votes
4answers
2k views

Is there any documentation comparing/contrasting C++ standard library implementations? [closed]

(This is not game programming per se, but I'm certain if I asked this on SO I'd get told not to prematurely optimize, even though history tells us every large game ends up worrying about these ...
-5
votes
3answers
177 views

Making game totally from scratch [closed]

I'm used to make my games in Java. Java is an awesome language but to launch .jar files you need a good updated JRE. So I thought: "I'm just going to make my games in C# or C++!" Unfortunely, I can't ...
-4
votes
1answer
55 views
2
votes
1answer
138 views

Assimp and directX12 universal apps

I started a directX 12 universal app project on visual studios and started coding some stuff to create a physics engine. I was currently working on implmenting Assimp into the engine too load whatever ...
1
vote
1answer
34 views

Vector out of range (Batch rendering & opengl)

So ive (tried to) implement a batch rendering system, and at the for loop the error pops up and I'm not shure what ive done wrong. Any suggestions to improve the system would be much appreciated. ...
0
votes
0answers
54 views

Trying to get Box2D bodies to fall [SFML, Box2D, C++] [duplicate]

As the title says I'm trying to make my Box2D body to fall, but it won't work. It just stays at the same position. Sorry for the long codes but I have no idea where I'm doing something wrong, so I ...
1
vote
1answer
74 views

Drawing a lines radiating from every angle using Bresenham line algorithm

I am trying to recreate a image like this ... or just each point Using Bresenham line algorithm, but can't seem to able to do so.. The point i receive from my computation doesn't look like a like, ...
16
votes
2answers
853 views

How do you prepare for out of memory conditions?

This can be easy for games with well defined scope, but the question is about sandbox games, where the player is allowed to create and build anything. Possible techniques: Use memory pools with ...
1
vote
1answer
44 views

Converting normalized device coordinates to world space coordinates flipping my sprites

I'm trying to convert my game's camera system to use world space coordinates rather than OpenGL's default normalized device coordinates, however in doing so my sprites are being rendered improperly as ...
-1
votes
1answer
78 views

Turning my main(int argc, char** argv) cpp file into a class doesn't work [closed]

So, I needed to access variables from my main.cpp file in another cpp file, and the best solution for that (to me) was to make the main.cpp file a class. Like this : (sorry for long codes...) ...
4
votes
3answers
342 views

Efficiently Handling Entity-Interactions in a Tile-Based World

I've been programming Roguelike games lately and there's a common problem I always run into. I can't seem to find a satisfactory solution for handling Monster-Monster interactions. For the intents ...
1
vote
1answer
146 views

How can I compute delta time in a cross platform fashion in C++?

I need a way to get time for calculating the delta time. I see that OpenGL and GLFW have methods for it, but unfortunately I can't use them since I need to make server software too. What is the best ...
1
vote
1answer
79 views

Confused about this Timer function C++

I am confused about the argument "m" of this function. I also need to know how to make this work. I am working on a simple 2d game and I am really new to programming. I don't know how to make things ...
2
votes
1answer
82 views

How to prevent tendencies to upper-left corner? [closed]

In a 2D tile-based game I'm making, I have a loop that runs through each of the tiles to check and apply values. One of the effects is intended to make a circle around itself, using a similar method. ...
1
vote
2answers
94 views

FPS drop when detecting collision (sfml, c++)

So, I have this small class with a collision detection function in it, it's called every frame. When I run the game I get around 8000 FPS, but when the collision function gets called it drops to ...
2
votes
1answer
28 views

How can I get direction or link of file in computer

I want to import an .obj file in my Engine or open some files : To do that I write a link or direction of that file in my computer. Like this file.open("../Engine/data/model.obj"); But I dont want ...
1
vote
1answer
89 views

Is it ok to use polymorphism as a way of “interfacing” with objects in a scene? [closed]

I'm designing a class that holds values representing a 3D scene. This includes lights, cameras, meshes, materials, etc. The way how I'm setting it up is that each "thing" has a name. A camera has a ...
1
vote
2answers
90 views

Will DirectCompute run this HLSL code

I found a sample about how to run a HLSL code with DirectCompute. https://code.msdn.microsoft.com/windowsdesktop/DirectCompute-Basic-Win32-7d5a7408 This is the HLSL script I want to run ...
50
votes
9answers
68k views

Easy to use cross-platform 3D engines for C++ game development? [closed]

I want to try my hand at writing a 3D game. However I don't want to start at such a low level of drawing individual triangles and writing my own 3D object loader and so on. I've heard of things like ...
5
votes
2answers
116 views

How do I save a procedurally-generated map as binary level-data in C++? [closed]

For example, I'd like to do something as simple as a generating an array matrix using Conway's Game of Life and then filling each cell with particular data to be saved to a binary file. ...
1
vote
0answers
57 views

C++ - what is the best library that I can use to create GUI if a textview already exists [closed]

I have a 2D char array in the textView.Basically,I need to map each char to a texture and render the whole view. Given a limited time, what is the possible best library that I can use? The header for ...
0
votes
2answers
497 views

3D picking for mouse move event

I implemented color picking recently and I would like to use it as kind of highlight when mouse is over an object but I am concerned about performance. Color picking requires whole frame to be drawn, ...
0
votes
1answer
56 views

glDrawElements Crash

This is the "init" code of the Renderer class: glGenBuffers(1,&_idVBO); glGenBuffers(1,&_idEBO); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,_idEBO); glBindBuffer(GL_VERTEX_ARRAY,_idVBO); GLint lUV ...
0
votes
1answer
165 views

Terrain shader from heightmap opengl GLSL

I generated a terrain from a heightmap and now I'd like to apply shader on it which can contain different textures, based on height but I can't adapt any online code to my project. This is the ...
2
votes
1answer
59 views

Software polygon rasterization with transparency using raw image data

I have an image with shapes in it (squares and triangles with different colors scattered in the image) and I have an algorithm that matches the image and extracts the geometry vertices from image raw ...
1
vote
1answer
204 views

How to Load a Level for use with the Bullet Physics Library

I am trying to use a level in .obj format loaded with Assimp to generate a btBvhTriangleMeshShape to use with the Bullet physics library. I can successfully load btConvexHullShapes as well ...
1
vote
1answer
101 views

Why does SDL_RenderCopy result in a blank screen?

I'm trying to render a texture(picture), but SDL_RenderCopy keeps the window's background black. Here's the relevant code: SDL_Rect rect; rect.x = 0, rect.y = 0; while(!quit) { ...