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

learn more… | top users | synonyms

1
vote
0answers
49 views

When does data move from the system memory to the GPU memory? [closed]

I am starting off with a basic idea. My understanding is when a game loads, the assets are loaded into the system memory, images, sounds, maps etc. So say you have an open world game, AFAIK, the ...
0
votes
0answers
70 views

Simple Bullet Physics Collision Detection

I've been looking into bullet physics a lot here lately to handle my collision detection. I was using XNA collision but once I started to implement momentum into my physics simulation true and false ...
36
votes
1answer
6k views

Why are all OpenGL function calls prefixed with “q” in the Doom 3 source code?

Why is every OpenGL call prefixed with a "q" in the Doom 3 source code? Are they custom functions or a different library, and if so, why use that over OpenGL? Any Google search comes up with the Qt ...
0
votes
1answer
87 views

2d canvas representation in c++ code

I would like to create a basic 2d graphics program to do very simple editing of in game assets. My question, starting out how could I represent the canvas? Let's say I know i'll need a canvas ...
-1
votes
1answer
68 views

Leading Zero's in int returning weird number c++ [closed]

I'm doing UTs on a class of mine, and I tried the edge case of putting 05421 in the ctor instead of 5421. As far as I know, putting a leading zero in an integer results an octal number, but seeing as ...
0
votes
2answers
66 views

Is Global location using OpenGL bound by the shader?

I have recently started writing a game engine in C++ with OpenGL and using some tutorials online. So far from what I have seen, shaders are the way to manipulate an object's position in worldspace. Is ...
0
votes
0answers
29 views

Adapting qml-box2d to work with QGraphicsScene: transform origin is incorrect

I'm taking the convenient QObject wrappers from the Box2D QML Plugin and using them with a QGraphicsScene-based game. My motivation is to save time writing them myself, as I need to expose stuff to ...
0
votes
1answer
80 views

glDrawElements and Texture Coordinate

I just move on from Immediate Mode and try Vertex Array method using glDrawElements and I got the texture is mess. How to draw the texture correctly? This is a piece of my render code ...
2
votes
1answer
130 views

Creating a Collision Detection system [duplicate]

I'm currently working on 3D project (C++) and I have now come to writing the collision detection systems. Basically my question is regarding how to architect it. All the collisions are either ...
-2
votes
1answer
53 views

how to rotate a sphere around centre (x y z) [duplicate]

I have centre of sphere at x y z. now I want to rotate any point (a b c) on the sphere about centre. how can I do it in c++.
1
vote
0answers
109 views

OpenGL Texture Loading

I've been using OpenGL for a bit so I have a general idea of what I'm doing. Recently, I've been working on a framework to let me test stuff more easily. As part of the framework, I split up loading ...
1
vote
1answer
90 views

Game Object, components priority?

So, my first attempt to create a component based game object is this: class GameObject; class GameObjectComponent { public: virtual ~GameObjectComponent(); virtual void Update(GameObject* ...
0
votes
0answers
55 views

Awesomium Input + SD2

In my project I use Awesomium GUI and SDL2. I want to create simple button. In HTML document I write <html> <body> <button onclick="app.sayHello()">Say ...
1
vote
1answer
75 views

Game is unable to load assets

I programmed a game in c++. Now I want to pack the finished product. Game runs fine from within the compiler. But how can i link the assets(like images, music etc) of the game to the exe ? When I run ...
1
vote
1answer
178 views

How to import Cocos2d-x in codeblocks ide?

Is it possible to import cocos2d-x in codeblocks just as in xcode ?? How can I do that ? I use ubuntu. It is not possible to use xcode in ubuntu. Cocos2dx is in c++. How can I use codeblocks for game ...
0
votes
2answers
185 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 ...
0
votes
1answer
49 views

useful way for coloring 3ds object in opengl

I have been working in making plane in blender and it has many materials over than 90 , and now I need it in an opengl project with c++ , but as you know if I but the 3ds file the plane color is ...
1
vote
0answers
39 views

Find camera coordinate of vanishing point

Given a vector and a camera (position, angle, up vector, field of view, etc), how would I find the vanishing point of the vector in camera space?
1
vote
0answers
41 views

Passing an SDL KeyboardState(Uint8*) to Lua

I'm working on my first big project and I've decided to integrate Lua with my C++ framework. Everything's worked out so far, but the only way I've managed to pass the SDL_GetKeyboardState(NULL) array ...
0
votes
1answer
34 views

How to set a struct as a Direct3D9 vertex shader constant?

I have a vs_2_0 shader like this: struct ConstantBuffer { float4 diffuse; float4 specular }; shared uniform ConstantBuffer g_cb : app_constantBuffer; void PS(out float4 Color: COLOR0) { ...
1
vote
1answer
62 views

Will Frame Independant Movement break collision

Using my game loop to give my game movement which is independant from the framerate, has been working fine for me but, I've started to consider my games running on machines which cannot keep up with ...
0
votes
0answers
28 views

SDL_ShowCursor not showing in Mac

I have the following code to create a software cursor in SDL: void Breakout::createAndActivateCursor() { int i, row, col; int hot_x, hot_y; Uint8 data[4*32]; Uint8 mask[4*32]; static const char ...
1
vote
1answer
76 views

Registering a C++ callback with Lua API without additional libraries

Basically, I'm trying to register a callback into a Lua state like this: class MyClass { public: int myLuaFunction(lua_State* L) { //do something } }; I ...
-3
votes
1answer
162 views

Performance of programming languages and frameworks [closed]

I want to program an online 2D MMORPG with graphics like in this game. Since I develop in javascript and python mainly I chose python for my first games and the game library pygame which is pretty ...
0
votes
2answers
282 views

Map Generation Algorithm [BOMBERMAN]

I'm looking for some wise tips concerning a specific game development : Bomberman-like. I am currently implementing a "random map" generation for the game, but I feel like I'm not doing in the best ...
-1
votes
1answer
40 views

Direct3d 9 z-buffer fails drastically [closed]

I have just completed my custom mesh class and my engine is very basic right now, but now I am facing this strange issue. I have posted the pictures bellow, it seems like z-buffer is not working ...
0
votes
5answers
280 views

How to properly pass sprites to a std::vector without destroying the sprite's texture in SFML?

From the official SFML tutorials, The White Box Problem:- "When you set the texture of a sprite, all it does internally is store a pointer to the texture instance. Therefore, if the texture is ...
0
votes
1answer
86 views

loading a texture in Opengl

I am working on a graphics project I want to make a city using opengl with c++ anyway in the last few days I have been trying to load a texture but it didn't work with me in any way I have tried many ...
1
vote
0answers
179 views

How to architect systems is Enity Component System, in C++ [closed]

When creating an ECS in C++, what are good, simple approaches to architecting the systems. Should each system be a static function of a dedicated class (is this semantically different than just ...
1
vote
2answers
42 views

glutPostRedisplay() is not redrawing after updating model view matrix

I am trying to change the rotation of my object with keyboards, when I move the object in the direction of x, y or z it is okay, it is responding correctly. But when I try to change rotation, it does ...
14
votes
1answer
811 views

Is it possible to use the Unreal Engine as a big C++ library, without using the editor?

I want to write a game entirely in C++, but I would like to profit from the possibilities offered by the Unreal Engine, especially in terms of graphics and physics. Nevertheless, I strongly dislike ...
1
vote
1answer
290 views

How do I Rigidbody.AddForce(Vector3) in Unreal Engine?

I am coming from the Unity Engine, and trying to get my feet wet with Unreal Engine 4.8.x. I want to add a one-time force to an object. To accomplish this in Unity 5, I would use: void Start(){ ...
1
vote
0answers
62 views

SDL_Mixer - Mix_LoadWav_RW returns NULL (Unrecognized sound file type)

I am loading sounds from resource file (Doom2.wad from game Doom 2: Hell on Earth), converting them into WAVE and then trying to play them using SDL_Mixer. If I save the converted sound into a .wav ...
1
vote
1answer
119 views

Bullet Physics - Collision not working when moving btBvhTriangleMeshShape

I have a robot (btTriangleMeshShape for each component) and a chain of boxes used as a cable, which is anchored on two components of the robot. I want to rotate a robot component and when this ...
3
votes
1answer
125 views

Optimizing the “visibility cone” calculations for a 2d game

I'm creating a simple 2D game and got a little bit stuck with this algorithm. What I wanted to achieve - and achieved - is to draw a visibility cone influenced by walls and other obstacles on the map. ...
0
votes
1answer
72 views

Calculating density of an object

I'm using Box2D for physics in my game, and one of the things it needs to know when creating a shape for a physics body is the shape's density. I had no idea what value I should specify, so I went to ...
2
votes
1answer
448 views

Communication in a simple GUI (C++ / SDL2)

I've spent a few months now working on a fairly simply 2D game engine with SDL and C++. I'm now trying to develop a simple but well-featured GUI suitable for most games. Right now I'm really ...
0
votes
1answer
115 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 ...
0
votes
0answers
59 views

OpenGL - Cubemap “Rotating” Proportional To Camera Movement

I'm doing a simple planet rendering project and am running into an issue with accessing cubemap textures correctly. The planet terrain is generated using the diamond square algorithm done 6 times and ...
1
vote
1answer
46 views

Modern OpenGL Texture Displaying Incorrectly [closed]

I've been working with this code and have simplified it to the most basic form possible, and even then I cannot get a texture to display properly at all. Here is the code: ...
1
vote
1answer
90 views

Improving performance for flocking behavior?

I have a game that I am trying to make. It is a twin-stick shooter that I want to design to have a LOT (Up to 500) of enemies on the screen. The game's base design comes from that of Geometry Wars, ...
2
votes
3answers
139 views

How does Unity call “update()” in the scripts?

I understand that you can expose your C++ code to a scripting language such as ChaiScript. From this you can call code that you've made in C++. In Unity, however, they have functions in the script, ...
0
votes
1answer
136 views

Handling input with callback functions

I'm not sure if I understand callback functions completely - they are functions that another function calls? This seems like a powerful tool, especially w/r/t handling input. I've written up this ...
0
votes
1answer
171 views

How can I store additional attributes on DCEL edges?

I am currently working on a city generator, and I've ran into some issues with data storage while working on the roads. I currently use a doubly-connected edge list (DCEL for short), to store the road ...
1
vote
1answer
111 views

3D GUI Shader Problem

So I want to create one of these in my directX11 project. The little axis there that shows you the direction. I have a nice 3d shader for my world geometry that I tweaked from Frank D. Luna (He ...
0
votes
1answer
203 views

DirectX11 Equivalent of OpenGL code

I am currently porting parts of my engine over to D3D11 from OpenGL and was trying to figure out how I would accomplish the following blending functions in D3D11. glEnable(GL_BLEND); ...
38
votes
7answers
3k views

When prototyping, how can I more easily explore game behaviour?

I build indie games myself, but I'm usually out of energy once I've taken a newly developed game to a level where it's possible to play with behavior, so I settle for refinement instead of ...
1
vote
2answers
102 views

SDL draw dynamic select box

this might seem obvious to many, but I'm stuck and I cannot find any tutorial which helped me, so it would be great to find the answer here. I tried to make a rectangle like you have in RTS games, so ...
0
votes
2answers
179 views

Solitaire Game: Transferring Cards Design in C++

So, I'm working on a Solitaire game. I already created a the classes: Card, Pile, Stock. Each work as expected on it's own. My question is: What possible design for managing moving card(s) between the ...
0
votes
1answer
103 views

SDL pixel access very slow

I'm using SDL and need to plot pixels one by one on the screen. When I do this, it's extremely slow. I followed the tutorial here: http://www.programmersranch.com/2014/02/sdl2-pixel-drawing.html ...