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

learn more… | top users | synonyms

0
votes
0answers
49 views

Resolving 2D AABB collision problem

I'm adapting the collision resolution code from learnopengl.com for my own engine and since this my first time doing this, I have a problem with how the player position is being modified by the ...
0
votes
3answers
73 views

I have my mouse coords converted to world coords. Now how do I detect objects with it? (C++, OpenGL, FreeGlut)

I found a way to convert my mouse coordinates to world coordinates that I can easily understand but now I need to know how to use it to check if the mouse is currently over any of my rendered objects. ...
1
vote
2answers
45 views

glViewport offset and ortho projection

In all tutorials I found about creating projection matrix based on viewport size all of them assumed that left bottom coordinates of viewport will be (0,0). Now I want to draw to the different parts ...
23
votes
2answers
6k views

Is it safe to use Sleep() in game loop (on Windows)?

Is it safe to use Sleep() function on Windows in game loop (C++)? I want to have fixed frame rate.
1
vote
1answer
75 views

Parsing .OBJ to fit the gldrawelements() call. c++/opengl

I'm struggling trying to get this to work like it should. Ive been able to make an obj loader that fits the glDrawArrays() call, with uv and facenormals, but when trying to modify it to fit ...
1
vote
2answers
82 views

Bullets Stop Working Error

I've made a vector which is used by a universally accessible namespace called 'BULLET_HANDLER'. This vector stores and updates all bullets that are produced from the 'shootBullet' function. The ...
2
votes
2answers
409 views

How do I find voxels along a ray?

I am making a voxel engine, and I want to make it possible to create and destroy voxels with the mouse. I use C++ and OpenGL, so C++ examples would be best. So far, I have the camera position and ...
0
votes
1answer
47 views

DirectX 12 Questions about the command queue and command list?

I have been wondering this question for a while. Would this command ThrowIfFailed(m_command_list->Reset(m_command_allocator.Get(), nullptr)); m_command_list->ResourceBarrier(1, &...
1
vote
2answers
77 views

How can I access the members of XMVECTOR?

So I have been reading these articles, and I find implementing them a trouble. Currently, all I am trying to do is add two vectors together, leaving my question more specifically this: How can I add ...
0
votes
1answer
268 views

AABB Collision Problems in SFML

I have a problem with AABB collision. I am making a top down rougelike in SFML and my collision algorithm does't quite work properly. HERE IS A GIF OF THE PROBLEM. It mostly works, except for when ...
1
vote
1answer
57 views

How to enable depth test with QOpenGLWidget? It renders black screen

Currently I am writing a small application with Qt and OpenGl and I choosed QOpenGLWidget for rendering graphics. That's how I declared my widget: class GLWidget : public QOpenGLWidget, protected ...
3
votes
3answers
2k views

Visitor-pattern vs inheritance for rendering

I have a game engine that currently uses inheritance to provide a generic interface to do rendering: class renderable { public: void render(); }; Each class calls the gl_* functions itself, ...
1
vote
2answers
155 views

OOP Question for Team System

I'm not quite sure right how I should create my "Team System". Lets say I have 2 teams with 4 players in there. The teams are Team Blue and Team Red. A team knows the amount of its members, the amount ...
0
votes
2answers
276 views

Good design for skills (heal,dmg etc)

I'm trying to create a good designed "skill system" for my game, but curious if anybody knows a good design? Skills can Heal,Damage ofc, they can be single target,multiple(chain), AOE. Instant dmg/...
1
vote
1answer
49 views

Allowing a unit to equip only certain types of weapons

I'm making a FireEmblem style game, and I am working on items at the moment. I have a Weapon class from which Sword, Axe, etc. are derived. I also have character classes like Swordsman, Mage, etc. I ...
4
votes
0answers
573 views

Why are god objects so common in game programming? [closed]

This is a bit of a philosophical question. Excuse me if it's out of place here. Most modern games developed in C++ use (or at least purport to use) an object-oriented approach. A common axiom of ...
0
votes
1answer
77 views

QuadTree nice design for nodes

I'm using c++ and have some problems with the QuadTree design. I have some components which are not related to the QuadTree directly. These components are eg. RenderableMesh, PointLight, etc. Some of ...
1
vote
1answer
75 views

Entity-components pattern and memory management

I indent to use a level-entity-components hierarchy in my c++ game engine where level is just a placeholder for entities. However, since I'd like to setup all the levels at once (and thus entities and ...
0
votes
1answer
100 views

Bullet: No Bouncing off the walls

I'm using Bullet Physics for Collision Detection in a first person game. The collision basically work fine, I cannot walk through objects. But if I walk against the wall and release the key I get ...
11
votes
2answers
1k views

Removing delay at start of a key press

I'm making a simple game, and one of the problems I encountered is the annoying delay when pressing a key continuously. So basically, when I press (for a very long time) for example Up, my object ...
3
votes
0answers
99 views

Tick frame: update order problems

Sorry, it's a bit long story but I hope you can help me. First of all: I have an entity class called SceneObject. The SceneObject has components (eg. RenderableMesh, Camera) and transformation data (...
1
vote
1answer
85 views

Shooting Projectiles

I am using cocos2D-x and am trying to achieve the effect of enemies going past and shooting projectiles at the player who is moving around the screen. I am using the code below, which is based on this ...
12
votes
5answers
9k views

SIMD C++ library

In the past, I've used Visual Studio with the DirectX XNA math library. Now, I'm using the GNU compiler collection. Can anyone advise a SIMD math library with a good documentation?
3
votes
1answer
76 views

How to make expanding ring with constant thickness?

I need to generate this burst or (donut-shaped) pulse. I'm having a difficult time how to generate such shape. At first, I was thinking of scaling the image but that didnt work out because the line or ...
1
vote
1answer
91 views

C++ Data structure pattern preferability?

So im looking at ways of handling large amounts of data in situations such as an entity manager or particle system. So i have concluded to use an object pool, and there are two things that I could do ...
9
votes
1answer
168 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 ...
3
votes
1answer
158 views

When should i use GL_TRUE or GL_FALSE values?

When using GLboolean, should i just use true and false or should i use GL_TRUE and GL_FALSE, when should i prefer using GL_TRUE and GL_FALSE? or maybe i shouldn't care at all (Because both works)? ...
0
votes
0answers
46 views

3d rotation of a cube using DirectX

I can't solve an apparently simple problem: i have a cube, similar to the one in the following picture I've tried to write a small demo where i can rotate the cube by dragging the mouse, but i can'...
0
votes
0answers
103 views

How to convert mouse location with respect to any camera/object in Unreal?

I am currently working on a VR project (First Person Shooter) where the player can shoot any where on the screen. I am using a Render to Texture method. The VR part is working fine. The problem I am ...
3
votes
2answers
236 views

Do I need to delete a texture after calling SDL_DestroyTexture()?

Let's suppose I have this texture: SDL_Texture* txt = IMG_LoadTexture(renderer, "path"); /* various code */ SDL_DestroyTexture(txt); delete txt; // <- Is this part really necessary? Doesn't ...
0
votes
3answers
146 views

How to “reload” a TTF Text during runtime?

As the title says I would like to know how to reload a TTF_SDL Text during runtime in C++. What I want to do is to update all the values of the text each frame so I can, to example change the font ...
2
votes
1answer
160 views

How i can make better jump to my game? - C++ SFML

So, I ask question about my 2D game, actually it is not game, but it is something like poor game. Well i made moving system and now is time to make jump. I made some kind of gravity with tutorial but ...
1
vote
0answers
161 views

OpenGL ArcBall Camera

I'm currently working on a OpenGl Project and I have alot of difficulty understanding how arcball camera work. From what I have read online, all I have to do is to rotate a camera around a target and ...
0
votes
1answer
48 views

How to rotate a 2d line?

Its a very simple question. How can i rotate a line by one of its endpoints by the angle rad? Heres my current code ( I couldnt find a different solution ) void displayPlayer() { float rad; ...
0
votes
1answer
48 views

Draw a square given 2 corners

I am at the moment trying to come up with a simple method to extract some data points, given two corners. A*************** **************** ***************B I tried to illustrate my situation above....
1
vote
0answers
47 views

Renderering problem with flat terrain

i was testing out my game engine last night, but stumbled across this unexpected result. Here is a picture: As it appears, it is renderering 1 triangle and not renderering the other triangles. I ...
0
votes
0answers
38 views

sphere to sphere interpolation

I am at the moment trying to come up with an scheme that interpolats between a current state and a desired state. Each state consist of an 3d coordinate and a rotation matrix, orienting an camera ...
3
votes
0answers
81 views

“UObject” has no member “BeginPlay”

so I loaded up UE4 to work on a new project. I created 2 C++ classes, one for a bullet, one for a canon. Upon loading into Visual Studio 2015 I immediately get the error "UObject" has no member "...
0
votes
2answers
114 views

Tetris implementing rotation

I am currently at the last stage of the Tetris Clone using SDL library, the only thing left is rotation. For each piece I have a separate class, and in order to move the pieces down I use a method: ...
0
votes
1answer
40 views

Cocos2d: Tweening primitive data-types

I asked in SO, but no responses so I'm posting here since it's probably more relevant here. EDIT: SO question closed. I'm trying to tween primitive data-types the way Action tweens position to ...
0
votes
0answers
24 views

cocos2d c++ Collision between edge physics bodies

I'm working on a game with cocos2d, need to detect collision between two PhysicsEdgeBody. I've created an EventListener for contact and added it to the layer i'm working on, PhysicsContact and ...
0
votes
0answers
63 views

Weird Collisions in ODE

I'm trying to get a basic OBB/OBB Collision System working. For this I use ODE. My problem is: Whenever I use the dSpaceCollide and pass in my Space and my Callback, my Callback shows me, that a ...
0
votes
1answer
37 views

Moving at constant speed and angle [duplicate]

The picture illustrates I cannot figure out the math on this. The "arrows" should move at the same speed in both examples.
1
vote
0answers
23 views

trouble getting correct transforms for multiple meshes from assimp importer

I have had excellent success in extracting almost everything i need from a collada file that i imported with assimp, however I am struggling to get the correct transforms for each mesh in the file. ...
2
votes
0answers
40 views

Moving Draw functions out of GameObjects

This is basically the issue as in Tactics for moving the render logic out of the GameObject class with the topic already discussed here and here However I'm not really satisfied with the given answers....
0
votes
0answers
14 views

Update constraint pivot position in world space in Bullet Physics

The task is: we have N rigid bodies connected with each other by point-to-point constraint. In every frame we have new position of point where first rigid should be attached in world space. How to ...
4
votes
2answers
2k views

C++ Role-Playing Design Best-Practices/Suggestions?: [closed]

Foreword: I have worked extensively with Java, but less with C++. I have an understanding of the general language and how it differs from Java, but could really use some help here. Additionally, ...
7
votes
4answers
1k views

Any learning/studying material for C/C++ that use game programming as learning context out there? [closed]

As most of game programming is done - I read on this very site - in C/C++ I was wondering if there is any learning/studying material for C/C++ that would target specifically game programming. I am ...
0
votes
2answers
2k views

c++ opengl sdl game engine tutorial

I have a decent knowledge of sdl,opengl and fmod. i am looking for a recent tutorial or book on the basic of making a game engine. Most of the book and tutorial i found are using old dead library like ...
6
votes
2answers
26k views

Where to start learning OpenGL with C++? [duplicate]

Possible Duplicate: What are some good learning resources for OpenGL? I have learnt C++ and made some cool text based games and such but I would love to start graphical programming. I'm a ...