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

learn more… | top users | synonyms

13
votes
1answer
1k views

Is * calling *= (or *= calling *) slower than writing seperate functions (for math library)? [closed]

I have some vector classes where the arithmetic functions looks like this: template<typename T, typename U> auto operator*(const Vector3<T>& lhs, const Vector3<U>& rhs) { ...
1
vote
0answers
65 views

2d grid vision(eye sensor) for a neural network bot?

I have a 2d grid and neural network bots living above it. What is a good way to give them vision of tiles in front of them? Below I describe my idea that I don't know how to efficiently(or ...
3
votes
2answers
102 views

Reusable component design

I'm working on an engine for my game (in C++). I've done the graphics related stuff and I've started working on UI (user interface). When I was working on buttons I've realized that hardcoding every ...
2
votes
0answers
163 views

OpenGL Render Queue Design

I am currently designing the rendering system for a 2D game built in C++ and OpenGL, and am unsure about how to go about implementing a sorting procedure to maximise efficiency and minimize OpenGL ...
0
votes
1answer
47 views

Error : No default constructor exists for “Sprite” [closed]

What i want to do is make the Player class inherit the Sprite class. So I inherited it like this : class Player: public Sprite {}; But when I go to my Player.cpp I get the following error : ...
1
vote
0answers
81 views

Loading FBX Files into a DirectX 9 Application

I'm having an extremely difficult time trying to convert an FBX file into a format that can be used with DirectX. I've read a lot of articles on forums all over the internet and have followed ...
4
votes
1answer
88 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) ...
0
votes
1answer
44 views

Resources for making iPhone apps in C++? [closed]

I would like to start making games for the iPhone and I only know C++. I have picked up a book on Swift development, and through my research I have found it is possible to create iPhone games through ...
-2
votes
1answer
314 views

Check if a vector element exists using std::find? [closed]

I need to know how to check if a element (object) inside a vector exists. I've heard of std::find but the I don't understand how to use it (even though I've read multiple answered questions here, and ...
0
votes
0answers
100 views

Cubemap texturing issue D3D11 (C++)

I have a texture problem with the cubemap I'm rendering and can't seem to figure it out. I've generated a cube map with direct x's texture tools and then read it using ...
0
votes
1answer
73 views

Bullet Physics Collision is Not Detected

I have created two btConvexTriangleMeshShape objects. One is a cube of size (0.1 x 0.1 x 0.1), and the other is is a plane of size (1.0, 0.1, 1.0). The plane is static, and the cube is dynamic, and ...
4
votes
1answer
583 views

Cross-platform C++/OpenGL ES development (iOS/Android) [closed]

I already have reasonable experience with C++ and OpenGL, and I have recently decided to try out mobile game development. After successfully creating a simple OpenGL ES Android app using Java, I ...
1
vote
1answer
26 views

Vertice combination code crashes when “large” amounts of vertices are introduced

I have a 2D tile rendering system. In my tile storage class, I have a two dimensional array of Tiles, and a build method which combines all of the vertices of the tiles which are not equal to ...
0
votes
1answer
150 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 ...
1
vote
2answers
86 views

Allegro: slow drawing lots of images in 2d sandbox

I want to know if there is any better way to do this. But i want to make a game where its 2d and made of blocks. But a test that draws blocks to the screen and its going so slow that its not even ...
1
vote
0answers
93 views

Using linestrip and geomtry shader for a ribbon trail effect? Problem with vertex orders

I'm using DirectX 11 and c++ and I've been trying to make a ribbon trail renderer. I was hoping to be able to not have to build every vertex on the CPU side, just keeping the, uuh, "keyframes", or ...
3
votes
1answer
48 views

adding radial gradient to heightmap results in jagged edges

I am trying to implement a simple heightmap editor. In this editor, you can elevate the terrain by clicking on a spot in the heightmap, and holding down the mouse button. This will little by little, ...
0
votes
0answers
63 views

Can't display sf::text using custom class, crash

I have my own Text class which uses sf::Text to display text on the screen. First I couldn't get the text to display on the screen, my solution was that I forgot to give the text a font before ...
2
votes
1answer
65 views

Cannot connecting texture to heightmap using mapped uniform location

In my shader program, I have my attributes and uniforms added to a map for each. What I have displayed is a heightmap, but cant seem to connect the graphic texture to display. mUniformList ...
0
votes
1answer
44 views

Using one GLSL shader program for textured and untextured rendering?

Rather than have two separate shaders in my OpenGL code (one for when a texture is bound, one for when none is bound) I usually go for one shader program which handles both. This is my usual fragment ...
0
votes
1answer
36 views

Texture becomes white box when drawing it?

My problem is that when I try to render my sf::Sprite it only renders a white box in my window. I did some reading on this and couldn't really find anything that helped. Some said that it's because ...
-2
votes
1answer
109 views

how is c useful in game development [closed]

I know that C++ is the king in game development especially in the AAA market can anyone tell my how is C helpful I am a Computer Science student in my first year and are they any aspects of C i have ...
6
votes
2answers
377 views

Know if you're fully utilizing the GPU

I render ~17.000 VAOs each frame. 2.840.386 triangles. Only applying texture, nothing else. I have three computers and the performance across them is not as expected. Cheap laptop(i3-4010U & ...
0
votes
1answer
89 views

Unhandled exception at 0x0FE62707 (sfml-system-d-2.dll)

So, turned on my pc today thinking I we're gonna continue making my game but got denied by this error. Have no idea how to fix it and why it's there at all, I haven't touched my project properties in ...
0
votes
1answer
75 views

Where to store persistent player data?

I'm working on a 2d game, where the player can take damage and die. And upon death, player object gets destroyed. However, some attributes of player shouldn't be affected by his death, such as lives, ...
0
votes
2answers
67 views

Text in game with not english alphabet

I need to render some special text in my game. Currently I can render any text that use classic letters of english alphabet, but I have some problems with special alphabets. How do I render text: I ...
0
votes
0answers
47 views

Any call to framebuffer methods causes crash. (MinGW)

For a long time, I have been using LWJGL. This library is pure awesomeness, however I was looking into learning the lower level API that was used in C++. I am new to the idea of pointers and other ...
-2
votes
1answer
102 views

How do 2D shaders work? [closed]

Yesterday I was wondering if an Arduino Uno could run some 2d shaders in a 3110 nokia screen (monochrome). But before all, I want to know understand how they work. Note: I want theory; ideas. Not ...
-1
votes
1answer
78 views

Game crashes when trying to access function inside of a class, inside of a vector

So, I have a object, inside of a vector and I'm trying to call a function in that object : std::vector<Box>entities; entities.insert(entities.begin() +1, Box(&world, ...
0
votes
1answer
47 views

SDL Combining text and Geometry Rendering to one texture

Basically I'm trying to end up with a Texture class that can take in text and have it be drawn over simple geometry (such as a letter 'A' over a filled rectangle). However I'm running into issues when ...
1
vote
2answers
93 views

Binding class method to Lua

If I have class class Game { public: Game() { level = new Level(); } private: Level *level; lua_State *L; } Where the level class has member functions such as ...
0
votes
0answers
107 views

Entity-Component-System and 2D map with tiles : how to do it?

I have a question : I'm currently programming a roguelike game (with tiles) using the ECS programming paradigm, and I'm struggling with how to implement the map. At first, I made every terrain square ...
2
votes
1answer
55 views

Polygon edges visible when using per-fragment lighting (OpenGL)

I have created a mesh in Blender (just a sphere with a texture over it; it's supposed to look like mars) and I've exported it as OBJ. I've tried it both with exporting with normals in Blender's export ...
0
votes
1answer
218 views

OpenGL shows a black screen

I am new at OpenGL, I try this example: http://stackoverflow.com/a/31524956/4564882 but I get only a black widget. The code is exactly the same. this is the code associated to the QopenGLWidget: ...
0
votes
0answers
38 views

A reference to a Blueprint Game Mode

I am new to Unreal Engine with a very basic knowledge of working with the blueprints and code together. I am having trouble with making a reference of my Blueprint Game Mode in the code. The question ...
1
vote
0answers
53 views

Implementing Separating Axis Theorem in 3D with C++/OpenGL

Using an Octree data structure provided to me by an acquaintance that gives min/max bounding box values, I've been able to write an algorithm that takes the global centre points, face normals and half ...
-1
votes
1answer
76 views

Box falls extremely slow? (~1 pixel per second)

As the title says I have a problem where my box2d bodies falls extremely slow. Around 1 pixel per second. My world is stepped like this world.Step(1 / 60.0f, 8, 3);, each frame. The way I update ...
0
votes
1answer
22 views

Does all box2d bodies have collision detection?

What I want to know is if both b2-static and dynamic bodies have automatic collision detection. And how do I tell box2D what it should do when it collides with a specific body?
0
votes
1answer
42 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); ...
1
vote
1answer
94 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
43 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
83 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
65 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 ...
0
votes
1answer
51 views

How to unload/remove body components in Box2D?

I want to know how to release/clear/remove a variable. (specifically b2BodyDef, b2Body, b2FixtureDef, b2PolygonShape types.) I've heard there's a keyword called delete, guessing by it's name it may ...
1
vote
0answers
35 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 ...
1
vote
2answers
54 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 ...
4
votes
1answer
155 views

Event Handling in an ECS

I apologize if this has been answered already. I've looked around here, and read a few blog posts, but none seem to fully answer my question. I am writing an Entity Component System. Entity is a ...
3
votes
1answer
111 views

Reorder a set of points in order to draw a triangle fan (example)

I'm doing a light engine (c++, using sfml), and to connect the light vertices, I thought about drawing a triangle fan. Here is a representation of a triangle fan (sfml documentation): The ...
3
votes
0answers
58 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 ...
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 ...