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

learn more… | top users | synonyms

0
votes
0answers
12 views

Config SFML in QTCreator with file.pro

I know that are a method with cmake , but i wouldlike config my project in Qtcreator usinig qmake and my doubt is what my file .pro must have for work it ?. I will run in windows , maybe later linux . ...
1
vote
1answer
66 views

How do I correctly shift arrays on a Tetris line clear?

I'm writing a Tetris clone in C++ and I am at the last stage, I need to delete a row when it is full. Once a piece falls it is stored in a boolean array grid[20][10]. For example I check which row is ...
0
votes
0answers
24 views

OBB Collision Intersection Problem

I'm trying to create OBB's around objects and then collide them using DirectX 11 and C++. It all works fine until I rotate one (or more) of the boxes and then the collision detection returns true too ...
59
votes
10answers
15k views

Is UDP still better than TCP for data-heavy realtime games?

I know that UDP is usually recommended for real-time multiplayer games with high data usage. Most articles are serval years old, and since ~80% of all data transmitted on the internet is TCP, a lot ...
2
votes
4answers
575 views

Why is my A* Pathfinding incredibly slow?

I'm trying to use A* to make my enemies move about, but it takes up to 20 seconds to get a path to walk. My grid is only 64*64. This is my code: #include "AStar.h" #include "Node.h" #include ...
0
votes
1answer
83 views

How to Load and Apply a Cube Map with DDS Texture Loader?

So I have been spending a lot of time recently implementing a working skybox/skysphere, and have almost completed it. The last thing that I need to do is to load my given texture, a skybox texture ...
0
votes
0answers
31 views

OBB/OBB Test in OZCollide

I want to know if anybody, who tried OZCollide (http://www.tsarevitch.org/ozcollide/), knows whether OBB vs. OBB Tests are possible or not. I know there is a AABB vs. OBB function but I can't find one ...
0
votes
1answer
78 views

Create a crosshair openGL

How do I draw a white crosshair in the middle of screen in openGL, it's all well and good knowing how to render objects in 3d space, but I have literally no idea on how to draw something that sticks ...
0
votes
0answers
14 views

Unreal Engine Physics creation is slower in Editor

I just figured out that when UPrimitiveComponent::CreatePhysicsState() is called, it calculates the mass, but only in editor, also when i build for non-editor it is faster (standalone) this is not ...
0
votes
1answer
36 views

Drawn frustum does not match with glm::perspective

I am working on a personal project and I got a 3d viewport with moving camera working nicely. Now I am working on being able to freeze the time and switch to a debug camera and move in the game ...
0
votes
1answer
44 views

Trouble applying a texture to a cube

Currently working on applying a texture to a cube and I am at a road block. I am using UV coordinates to apply the texture. Currently using 24 uv coordinates with indices. I am using glDrawElement and ...
0
votes
1answer
44 views

SDL Key Input previous and current key states not working as expected, how to fix?

Here is my code that's part of the main game loop: // ResetKeyState stores currentKeyState in previousKeyState // and then clears currentKeyState engine.ResetKeyState(); // Fill ...
1
vote
0answers
58 views

C++ Modern OpenGL - Calculate Vertex Normals

I'm learning modern OpenGL and i just got started so go easy on me :). Right now im trying to understand normals but im having some difficulties. On my program i have this class which i use to draw ...
1
vote
3answers
109 views

C++ Platformer Collision

This is very simple, but I have spent nearly 6 months messing with this and it is always messed up. This is a tile platformer, everything is "normal", x and y correspond to tile. Tiles are 32 x 32 ...
0
votes
1answer
65 views

Rendering three-dimentional array of tiles (as a tilemap)

I'm trying to create 2d game engine in C++ using SDL2 (actually some code was migrated from SFML). I want to have a flexible multilayer tilemap that can store different types of tiles. My current ...
0
votes
0answers
41 views

Sfml c++ scrollbar

Im making a program and i need to create a scrollbar class.My prgrams screen is 1200x800;The size of the little left arrow and little right arrow is 15x15; I calculate the width of the scrollbar in ...
1
vote
0answers
35 views

OpenGL texture not loading onto the model

I am still learning and I'd like to apologize if I don't explain something clear enough or anything like that. please forgive me :) So I am experimenting with 3D graphics for my university ...
1
vote
0answers
17 views

error: ‘struct RakNet::SocketDescriptor’ has no member named ‘socketFamily’| [closed]

when i run my client code i get this error i using code::blocks and im linux system in the tutorial that i follow the code working without any errors my includes files in the project #include ...
0
votes
0answers
22 views

Skin Mesh Animation Shader Issue

I'm having troubles with properly animating a skin mesh from an .fbx file. I feel like the issue is in the shader, but not sure what is going on. All I know is that I am getting unexpected results ...
0
votes
0answers
51 views

vertex shader doesn't work properly

Linux, OPenGL 3.0, GLSL 130 (Intel card) I'm learning OpenGL and successfully rendered a triangle, but as soon as I create the matrix of projection I get an error. The shader compiles and works ...
0
votes
0answers
17 views

Fbx Importer/exporter groups

I want to create Groups (empty transforms in a Scene Graph) but i find no documentation on how to go about it, to create a fbx loader which can create groups or show the different objects in that ...
1
vote
1answer
64 views

Rotating A model in 3D so it matches its direction of movement

So I have a model of a spear and when it gets thrown I want to set the orientation of the spear to its direction. ( I also want to use this for other things like bullets pointing in the direction ...
4
votes
1answer
67 views

How to buffer an image in winbgim?

So ive always had problems with buffers and never used them before. I read up on the topic online but since winbgim is so old i couldnt find any definite answers to the topic. So im gonna ask them ...
0
votes
0answers
19 views

Box2d capsule stumbles on ground

I am working on a game with box2d and sdl. I Created a character and some boxes as ground, but faced the problem where the character would run a few meters, and stumble on one of the boxes' edge. I ...
-2
votes
1answer
71 views

Is there any limit to the amount of threads you can run at the same time? [closed]

So i have a decent CPU with 2 cores and 4 threads, Will that effect the number of threads i can allow my program to run simultaneously? In my case, im using a thread for each player on a server.
3
votes
0answers
59 views

Easing towards stepped value

I'm currently developing this rhythm game in lua (on top of a c++ engine) and I'm having trouble keeping a steady playhead position for the song currently playing. The playhead position that the ...
1
vote
1answer
122 views

Collision isn't working in pong

I've posted about another pong problem a while ago, but now I'm having another problem with the ball collision with the paddle , when the ball collides, it doesn't bounce back, why is that? Here is a ...
0
votes
1answer
51 views

Why is xcode not letting me use my static variable? [closed]

I'm pretty sure I'm making some stupid mistake. Can't seem to find it, and no good results when googling it either. When I run my SDL project I get these errors : Undefined symbols for ...
0
votes
1answer
32 views

Send OpenGL video flux via UDP [closed]

It is possible to send the video flux of an OpenGL desktop app via UDP on Linux ? I looked up FBO and off-screen rendering but I still can't figure out how to extract the video flux and send it. I'm ...
0
votes
1answer
57 views

Intersecting rectangles in space

I need to intersect 1 million spatial polygons (specified using their Minimum Bounding Rectangles) with 4 completely disjoint MBR's (MBR1,MBR2,MBR3,MBR4) in space. MBR1, MBR2, MBR3 and MBR4 divide the ...
0
votes
1answer
75 views

Moving a character to a point without any floating point operations

So I'm writing an adventure game for MSDOS, just a fun challenge for me. I'm trying to get the character to walk along a straight line to his destination (either the next navMesh node or where you ...
0
votes
0answers
29 views

Jumping to tiles in y coordinate before displaying all tiles in x?

I am learning how to load in tile maps and I have successfully done so, sort of. The problem is that the program is jumping to the tiles in the y coordinate before displaying all the tiles in the x. ...
0
votes
1answer
56 views

SMFL C++: IntRect intersection not working?

I'm trying to find free space to place rectangles, but even though I check for a collision using .intersects(), it still places them through eachother and somehow doesn't see the intersection ...
0
votes
1answer
92 views

How should my engine Identify objects

I'm making a fairly basic openGL 3D engine, at the moment, when you load an object, you would write manager->LoadObjFile("cube.obj"); manager->AddParent("uvmap.bmp", "cube.obj", "cube", ...
2
votes
1answer
65 views

Should I Include the W-component of a vector when calculating it's length or dot product?

The reason I'm asking this is because I saw an implementation which did it that way but I don't quiet understand it. I mean, usually I want to get the distance between two points in 3d space and if W ...
3
votes
2answers
118 views

How can I make the ball in pong move even if no event is taking place in Allegro5?

I've been trying to make a pong game with C++ and allegro5, I found moving the ball around easy with SFML, but in allegro5 I don't know what I can do to move it around, right now, it moves but only ...
0
votes
1answer
66 views

DirectX 11 Problem with texture loading

I am trying to load a texture into my 3d graphics application. I am having trouble with my sampler state specifically. There are no errors generated just my little popup window saying, "Texture failed ...
0
votes
1answer
68 views

Player position not updating when referenced in seperate class?

In my player class I have my players position set to update when you tap the directional keys, that works fine, but when I access my Players position variables, in my projectile class constructor, ...
0
votes
2answers
79 views

Convert a direction vector (normalized) to rotation?

Say i have something like this: pos += glm::normalize(target - pos) //PLEASE NOTE: pos is a glm::vec3 and so is target This makes "pos" translate towards "target", but what if i want to make my ...
0
votes
0answers
55 views

Boost vs cereal for Serialization

I am preparing to make a simple 3D game with OpenGL and one thing that came up pretty quickly was storing the required data. If I recall correctly, Java has a class called "ObjectWriter" which ...
0
votes
1answer
45 views

Unable to load two enemies with same pic in sdl2

I have loaded two enemies(with the same pic) into my game. However, when I draw them onto the screen it only draws and animates one enemy, instead of two. I can't seem to figure this out. Here is my ...
0
votes
1answer
49 views

Strange shadow behavior when light direction is parallel to a plane

i have a strange problem with shadow acne. It occurs when the light direction is parallel to a plane. Here is my code and a few images of the problem: //this calculates the shadow matrix ...
2
votes
0answers
46 views

How come these 2 lines of code are causing a memory leak? [closed]

I'm confused, I commented these 2 lines out resulting in no memory leaks, and when I added them again it's leaking. However I can't understand why it's actually leaking? This is the 2 lines of ...
0
votes
0answers
32 views

Non-real time simulation of overlapping repulsive balls

I want to make a non-real time simulation of overlapping repulsive balls, initially in 2D and later in 3D. With "non-real" I mean that rendering is not needed after each time step. First of all, ...
2
votes
1answer
72 views

How to replicate Unity's Rigidbody.AddForceAtPosition in C++?

I am trying to replicate the function Rigidbody.AddForceAtPosition of Unity in C++, it means, to apply force to a body offset from its center. How could I achieve that in C++?
0
votes
1answer
60 views

Irrlicht app: Creating STL exception leads to segfault

I'm developing application with C++ language and Irrlicht engine. When I add std::runtime_error("err") expression into my code, I got segmentation fault at address 0 (before entering to main). If ...
1
vote
2answers
118 views

How can I represent a tile-based map and related properties on disk?

I'm trying to load a tile-based map in my game. I've been watching SDL tutorials for a while now but they never covered how to represent the map in a file? How can I represent a tile map on-disk in a ...
0
votes
3answers
134 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 ...
0
votes
0answers
28 views

Should all textures be power of 2 in SDL2? [duplicate]

I come from Gamemaker background, and I know that anything you give Gamemaker is put onto a texture page that is power of 2 size, but I am now making an SDL game engine and I am wondering, should all ...
0
votes
1answer
25 views

How can I clear the screen in Xcode?

so I am following a tutorial to make a snake game in my Xcode console. But the tutorial i am following is using windows and therefore the "system("clear")" command isn't working with my mac, and all ...