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

learn more… | top users | synonyms

0
votes
1answer
89 views

why is glVertexAttribDivisor crashing?

I am trying to render some trees with instancing. This is rather weird, but before sleeping yesterday night, I checked the code, and it was in a running state, when I got up this morning, it is ...
14
votes
5answers
1k views

Optimizing collision engine bottleneck

If this is your first time on this question, I suggest reading the pre-update part below first, then this part. Here's a synthesis of the problem, though: Basically, I have a collision detection ...
0
votes
1answer
273 views

How do I determine the look-at vector of a free-look camera?

I'm trying to create a free-look camera with DirectX 10. I've figured out how to get the directions for forward and back and left to right. However, I don't know how to rotate the look-at vector of ...
1
vote
2answers
54 views

Suggestions on audio layer and entity system

i need some suggestions on the following, i have a basic entity system in place, i need now to put some audio in the game, i would like to make a "Database" like kind of class, that would watch over ...
0
votes
1answer
38 views

Mesa: Howto enable OpenGL 3.x functionality via extensions?

How can I enable OpenGL 3.x functionality via extensions? I'm new to OpenGL development under Linux. Currently I have #define GL_GLEXT_PROTOTYPES #include <GL/osmesa.h> #include ...
0
votes
0answers
9 views

Computing Field-of-View from window dimensions

I'm looking into computing the vertical Field-of-View (FOVy) based on the projection parameters of my camera. From this source, I've found an equation that seems to work. float ...
3
votes
2answers
50 views

How to detect Lagoons and Lakes on a random Island Map

I have an engine which generates random Islands. At the moment it tends to generate quite a lot of lagoons and lakes. I would like to know of a feasible way of detecting them so that I can mark them ...
0
votes
1answer
231 views

Should I drawing directly on CCLayer or CCSprite?

Now I am a little confused in my cocos2d-x cpp project. I want to draw lines with user's finger touch. Following the screenshot of a CCScene: In the screen, there are two squares. I want show an ...
0
votes
1answer
204 views

Sorting for 2D Drawing

okie, looked through quite a few similar questions but still feel the need to ask mine specifically (I know, crazy). Anyhoo: I am drawing a game in 2D (isometric) My objects have their own arrays. ...
0
votes
1answer
81 views

Loading Wavefront Data into VAO and Render It

I have successfully loaded a triangulated Wavefront (.obj) into 6 vectors, the first 3 vectors contain the locations for vertices, UV coords, and normals. The last three have the indices stored for ...
0
votes
1answer
96 views

Bullet 3D Physics Objects Not Rotating?

So I've got Bullet 3D controlling the motion of objects rendered with DirectX. In the clipping below I've got 2 identical rectangles & 5 balls. The lowest rectangle has a mass of 0 and doesn't ...
0
votes
0answers
13 views

How can I animate a sprite in cocos2d-x 2.2.1 c++? [duplicate]

Is there a way to do an animation without a .plist file? I'm having a hard time doing swap animation with sprites. For example, doing an animation while the user is not doing touches and the other ...
9
votes
3answers
12k views

How to play animations in Cocos2d-x?

I'm new to Cocos2d-x and looking for a good way/tutorial on how to play animations in Cocos2d-x.
1
vote
5answers
2k views

Entity System creating Components

Over every entity system I see implemented in C++, or even in Java/C# (e.g. the Artemis framework). I see components not allocated via a new operator (or something similar, e.g. std::make_shared). For ...
2
votes
1answer
68 views

Informing objects within a particular state of the world state

Following the State pattern, every state in my game is a derived object that reflects a particular segment of the game (MenuState, PlayingState, GameOverState, etc.) Each of those state objects holds ...
-1
votes
0answers
49 views

Object not texturing properly [on hold]

So I am trying to texture a cube, however things aren't quite turning out as planned. The results always look similar to this: Where in this picture the texture is supposed to be a red/black ...
1
vote
1answer
122 views

Entity Component System Coupling

Lately I've been working on a small personal project which is basically an Entity Component System framework with autoupdated Systems. While I have a pretty good idea on the way the framework should ...
0
votes
2answers
173 views

Is it possible to use C++ with Unity instead of C#?

The title kind of says it all. Is it possible to replace C# with C++ on a game using Unity?
3
votes
1answer
118 views

How do I render from one render target to another?

I have two render targets: a fake backbuffer; a special render target where I do all my rendering. a light render target; where I render my light fx. I'm sure I'm rendering correctly on both. The ...
-1
votes
0answers
36 views

2D MMO Engine/Library? [closed]

I was wondering if anyone knew any good libraries, frameworks, snippets of code, or engines that could make MMO networking easier or make 2D MMO games? I've been trying for a few weeks now with C++ ...
0
votes
0answers
13 views

Error In SFML Audio [closed]

This is my code: #include <SFML/Graphics.hpp> #include <SFML/Audio.hpp> int main() { sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!"); ...
-1
votes
0answers
62 views

c++ gamedev beginning signals [closed]

So I've been working on learning c++ for Game Development and had a question about the language. I have learned a little bit about Actionscript 3 and how it uses signals to process events. I was ...
1
vote
1answer
39 views

Compute billboard rotation

I'm trying to compute a matrix to have object always facing the camera. For the moment, my result look pretty good, the problem is that my original billboard scale isn't preserved (Every billboard ...
2
votes
1answer
142 views

Anti-Aliasing in OpenGL [C++]

I'm trying to make anti-aliasing work inside of OpenGL, here's what I've tried: glEnable(GL_POINT_SMOOTH); glHint(GL_POINT_SMOOTH_HINT, GL_NICEST); glEnable(GL_LINE_SMOOTH); ...
0
votes
0answers
46 views

Which way would a character face if he is moving one way, but pointing his gun a different way? [closed]

So I am creating a 2D platform game in C++ with SFML, in which the character wields a 2 handed grenade launcher type of gun. The character is controlled with they keyboard (arrow keys or WASD), and ...
1
vote
1answer
104 views

C++: Checking if an object faces a point (within a certain range)

I have been working on a shooter game in C++, and am trying to add a feature whereby missiles shot must be within 90 degrees (PI/2 radians) of the direction the ship is facing. The missiles will be ...
0
votes
1answer
48 views

Proper way to encapsulate a Shader into different modules

I am planning to build a Shader system which can be accessed through different components/modules in C++. Each component has its own functionality like transform-relevated stuff (handle the MVP ...
1
vote
1answer
119 views

Using unordered_multimap as entity and component storage

The Setup I've made a few games (more like animations) using the Object Oriented method with base classes for objects that extend them, and objects that extend those, and found I couldn't wrap my ...
0
votes
0answers
49 views

C++ OpenGL trouble trapping cursor in window

I am using OpenGL and I try to trap my cursor inside my game window (using both SetCursorPos and ClipCursor) But, these conflict with my camera rotation code as my camera is rotated with ...
-3
votes
1answer
75 views

Rotate camera with mouse? [closed]

Once again, using tutorial 10 at NeHe. I want the code if (keys[VK_RIGHT]) // Is The Right Arrow Being Pressed? { yrot -= 1.5f; // Rotate The ...
0
votes
0answers
8 views

Create a kind of Interface c++ [migrated]

I'm writing a little 2d rendering framework with managers for input and resources like textures and meshes (for 2d geometry models, like quads) and they are all contained in a class "engine" that ...
1
vote
2answers
271 views

UV Atlas Generation and Seam Removal

I'm generating light maps for scene mesh objects using DirectX's UV Atlas Tool( D3DXUVAtlasCreate() ). I've succeeded in generating an atlas, however, when I try to render the mesh object using the ...
0
votes
1answer
81 views

filling the empty spaces in a certain region in a grid using c++

Hi guys i am struggling to find the optimal way to fill the grid of a certain region. In the above example lets say my player is at (7,5) and traveled (2,0) and i have the information of all the ...
0
votes
1answer
44 views

Filling up the empty blocks when the player touches the safe zone again! using cocos2d

Hi guys i am stuck with filling up the data of all the blocks which are empty like the ones in the image. As you can see there i have a pacman like object where i will be moving around. But when ...
1
vote
3answers
116 views

How do I correctly multiply an XMMATRIX by a scalar?

Using DirectXMath and its XMMATRIX structure in C++ and Direct X 11, how does one multiply that matrix structure by a single float scalar? I want to implement the operation B = A * f; where A and B ...
0
votes
2answers
129 views

How to set HUD elements position and size depending of resolution [duplicate]

How can I set HUD elements' position and size when changing resolution and maintain the desired layout? All HUD elements (including menu items such as play button, setting button etc) need to get some ...
0
votes
1answer
40 views

Box2D `ApplyLinearImpulse` is not working whereas `SetLinearVelocity` works

I need to mimic jumping behavior for the player in my game. Player consists of two fixtures with circle and rectangle shapes. Rectangle I use to detect ground and it is a sensor. Is some point for ...
7
votes
2answers
192 views

How do I find the closest points(thereby forming a polygon) enclosing a particular point?(see image)

I am working with a game engine, and my task is to add code for simulating fracture of rigid meshes. Right now I'm only working on breaking a cube. I am using Voronoi's algorithm to make a ...
0
votes
1answer
39 views

speed up the update of glutidle()

I have a client that sends data at 1KHz (i.e. 0.001 sec) to a master over Internet using UDP protocol. In Master, I need to draw an object, but the problem is that the update of GLUT is slower than ...
3
votes
1answer
304 views

Dynamic Quad/Oct Trees

I've recently discovered the power of Quadtrees and Octrees and their role in culling/LOD applications, however I've been pondering on the implementations for a Dynamic Quad/Oct Tree. Such tree would ...
1
vote
2answers
155 views

How to detect graphics API at runtime with SDL2?

Using SDL2, is there a way to determine at runtime whether the application is using OpenGL, OpenGLES, or DirectX? EDIT: If there is a way to figure it out without using the SDL2 API, I'm willing to ...
0
votes
1answer
54 views

DirectX9 Drawing Sprites out of place due to offset

This is my very first time into DirectX. Im trying to make a simple 2D game, just for learning the basics. And i've achieved that. The next step is to draw an animation using sprites. For that, i ...
1
vote
0answers
405 views

How do I mix 3D skeletal animations?

I'm trying to create a 3D-model skeletal animation system for C++/Open GL. I would like to be able to mix animations by allowing animations to only affect specific bones. My game has ride-able ...
-1
votes
1answer
71 views

Smooth radial collision

I'm trying to make collisions smoother in my game. Currently, entities will stop completely when they collide with an obstacle. I saw the following article recently: ...
1
vote
2answers
79 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 ...
10
votes
1answer
294 views

How are entity systems cache-efficient?

Lately I've been doing a lot of reading on entity systems to implement in my game engine (C++/OpenGL). The two key benefits that I constantly hear lauded about entity systems are 1) the easy ...
1
vote
1answer
64 views

How to implement camera pan like in Maya?

I am trying to implement camera pan like the one in Maya. I've got it almost working. The problem is that the mouse cursor is moving faster than the 3d mesh (in fact I am moving the camera but I ...
1
vote
1answer
196 views

Calculating shadowmap coordinates for cubemap in shading pass?

I'm trying to implement shadow mapping with cube maps. I believe I've done the first stage by filling the cube map, but for the final shading pass I am unsure how to exactly calculate the cubemap ...
0
votes
1answer
83 views

SFML Stuttering issue with Linux

I wrote a little game of a bouncing ball, using SFML and Box2D. When running on Windows, the graphics animate smoothly. The problem is on my Linux machine. The animation stutters randomly. To be ...
-5
votes
1answer
73 views

Slot machine effect on c++ [closed]

Am making some slot machine game in c++ and sfml for fun. Wanna have an idea to make the REEL effect wheen spin button is pressed.