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

learn more… | top users | synonyms

1
vote
1answer
82 views

Static SFML 2.2 libraries and Code::Blocks on windows 7 [closed]

I am starting to program games for the first time, but I've been doing general programming for a couple years now. I have Code::Blocks, which I am fairly comfortable with, but now I am struggling with ...
0
votes
1answer
37 views

how to close lua file call luaL_dofile?

i created tool that generate lua script on each level which contain lot function, and they named based on the object+id format. ex : trigger1(), etc; so every level may have same function name, what i ...
0
votes
1answer
42 views

How to merge 2 textures into single SRV

I have 2 textures in 2 different ShaderResourceViews. What's the fastest/least expensive way to merge them into one? I would use CopySubresourceRegion but copying a texture is quite a bit expensive. ...
1
vote
2answers
117 views

Elegant ways to handle rendering with DirectX 11

I'm looking for a design pattern that's going to help me to elegantly handle the rendering of my game objects. Lots of game development guides talk about how to handle the game objects themselves, ...
0
votes
0answers
18 views

alpha blending rendering black

I'm using blending in my game here is my blending equation: D3D11_BLEND_DESC blendStateDescription; ZeroMemory(&blendStateDescription, sizeof(D3D11_BLEND_DESC)); ...
-1
votes
0answers
52 views

How do I pixel plot through the z-axis?

How do I through c++/SDL 1.2 "Yes I know it's old version whatever" pixel plot through the z axis. I know how to alter a 2D axis like so: void putpixel(int x, int y, int color, SDL_Surface ...
0
votes
0answers
22 views

mouseWorld Coordinates Box2D

I have one simple question in Box2D: if you want to get the world coordinates of mouse, this is the function you gonna use in Java: void update(int x, int y) { if(mousejoint !=0) ...
0
votes
1answer
56 views

Calculate slope for linear interpolated movement

I want to move rectangles to their targets the "smooth" way with linear interpolation. I hope this is right. float slope(float x1, float x2, float y1, float y2) { return std::abs((y2 - y1)) / ...
-1
votes
0answers
63 views

InputManager/InputDevice design for large-scale, script-friendly game engine

I'm asking for a bit of help. Right now i'm stucked from days to create an decent InputSystem class with abstracted InputDevice in C++, i tried many input system/managers code, i tried to adapt it ...
0
votes
0answers
4 views

How to release resources from shared_ptr ResourceManager [migrated]

I implemented a simple ResourceManager - everything was fine until I tried to implement its destructor for (emergency) clean up(for example in case of fatal exception). I was not able to find a single ...
-1
votes
0answers
56 views

How to move a sprite across the screen back-and-forth

This is a 2d game, which contains moving platforms that are spawned randomly along the X axis. I need to move them across the screen horizontally, but when they hit the edge, they will move in ...
0
votes
1answer
86 views

Understanding Scene Graphs and Graph Edges

So I'm trying to getting to grips with using Scene graphs and nodes in my code (game coding in C++) and I think I understand the basics of them and how they are used (and I can definitely see the ...
2
votes
1answer
79 views

Frame independent buoyancy using Substepping

I am having trouble with a frame independent buoyancy force using substepping in Unreal Engine 4. The original problem (which I am attempting to solve using substepping) is that when you apply a ...
0
votes
1answer
119 views

OpenGL 4.3 in C++ : Drawing static Triangle (“Hello Triangle”). Color does not appear (Triangle is just completely white)

I am going through an OpenGL book trying to get the examples to work. I am using Glew, Glfw, and that's it beyond Opengl 4.3, which my I know my graphics card supports completely via the OpenGL ...
0
votes
1answer
62 views

Good Configuration Manager System Design for medium-large sized projects?

I've create smaller games which simply needed a class which basically opens an INI file (with feather-ini-parser library) with config values for the whole game (rendering ops, music, bindings). But I ...
0
votes
1answer
82 views

Ray->triangle collision math seems to not work?

First time asking, pardon any mistakes I make :) I am programming a game from scratch, and the collision detection is giving me issues. I have AABB in place to check proximity, and if that reacts, ...
0
votes
0answers
94 views

Alternative to a timer in a separate thread in a turn-based game

I'm making a 2d turn based game and I'm having some difficulties with the timer itself. 3 characters vs 3 characters, two players. A timer giving them a chance to preform acts within a set amount of ...
0
votes
0answers
46 views

Updating sprite Rect each frame

I have made a struct which sets 4 variables that define a rect void setDestSize(int width, int height) { Width = width; Height = height; } void ...
0
votes
0answers
37 views

How to convert OpenCV camera capture to Irrlicht texture without killing fps?

I am looking to include images captured from the users webcam into my application so I've been looking into using OpenCV to capture from the webcam and then render it in Irrlicht. I've created a basic ...
0
votes
0answers
39 views

Frustum Culling not working when objects are transformed

I've been implementing some frustum culling and my code looks like this. // Frustum Culling XMVECTOR detView = XMMatrixDeterminant(cam->View()); XMMATRIX invView = XMMatrixInverse(&detView, ...
0
votes
1answer
69 views

Instancing effectiviness

At about how many instances would instancing become effective? DirectX dynamic buffers seem to take a little more out of the fps than an immutable one would. So obviously you wouldn't want to make a ...
0
votes
0answers
85 views

Setting up local players in Unreal Engine

I'm trying to make a 4 player 2D local multiplayer game. I have tried a lot of stuff to get to this stage, but as far as I have been told, a method called CreateLocalPlayer creates a local player, ...
0
votes
1answer
52 views

Textures not rendering on part of Cube [closed]

Hello all I have been trying learning opengl and have rendered a colorful cube and decided to texture it, now when I run the program the textures render on all of the faces except for the back face ...
0
votes
0answers
57 views

SFML - Rendering a torch with a fire animation [duplicate]

I have coded a 3D maze simulator in SFML using raycasting. However, I want to add a torch to the screen, so that the lighting seems more realistic. From my understanding, I would have to use ...
0
votes
0answers
51 views

'Bad' triangles when doing affine texture mapping

I am really clueless about what i must do. I wrote a function to do affine texture mapping, but i get in most situations 'bad' triangles. I really didn't want to ask this question as it probably is ...
0
votes
1answer
62 views

DirectX 8.0 SDK

I know this in unprofessional and probably doesn't follow the question asking conventions on this site, but I cannot find any other, more suitable (in my opinion) network on stackexchange to ask this ...
0
votes
1answer
47 views

What are .fxo and .cod files for?

I've been reading about shaders and looking at code. I found this in the code I'm looking at and it obviously has "Basic.fxo" there. BasicFX = new BasicEffect(device, L"FX/Basic.fxo"); Now my ...
2
votes
2answers
102 views

Destroying object from object method

My game uses an entity manager and entities to represent everything including the player, enemes, items, ..everything in the game. In my engine it's the responsibility of every entity to update ...
1
vote
1answer
41 views

Handle vertex indicies in a vbo batch drawing call

I'm new in the OpenGL 2 world and want to render a lot of cubes (> 150.000). How can I render such kind of cubes in practise? My idea is to split the cubes to a set of vbo's (Maybe 2000 cubes per ...
2
votes
1answer
54 views

Box2D Issues determining the side of collision

I'm trying to determine which side of my object a collision is happening. In all of my searching, I have found 2 different proposed solutions, but each one has a major issue. I'm hoping that someone ...
0
votes
0answers
71 views

C++ - SFML - OpenGL - GLSL - smooth waving texture

I have this shaders: Fragment: uniform float time; uniform sampler2D texture; void main() { float t = time; vec2 aux = gl_TexCoord[0].xy; // This would also make waving/deform the ...
1
vote
1answer
141 views

D3D11/C++ Inaccuracies in uv interpolation in pixel shader. How to avoid?

I'm trying to draw a quad with a texture onto the screen such that texels and pixels perfectly align. Sounds pretty easy. I draw 2 triangles (as TRIANGLE_LIST, so 6 vertices) using these shaders: ...
0
votes
0answers
87 views

DirectX Rendering to a texture

I'm trying to implement a rendering to a texture but without success. I've created a class that will(should) take care about all these stuff: class TextureRenderer { public: TextureRenderer() = ...
2
votes
1answer
314 views

How would you implement a simple strategy player controller in Unreal Engine 4?

All player controllers in the C++ game templates are not for strategy games. They all implemented so the player controls just one character. I'm not sure what approach to take when you want to control ...
0
votes
2answers
122 views

Why it’s recommended to keep global variable initialization and the objects’ constructors very simple (C++)? [closed]

Considering game-development? I have this question in a gamedev quiz and I wonder what to answer. Any clues?
0
votes
0answers
118 views

OpenGL - Arcball camera rotation

I'm implementing arcball camera rotation, whereby a camera is looking at a coordinate and rotates around it in the x-axis or the y-axis such that the camera is circulating around it; the y-axis will ...
1
vote
2answers
297 views

C++, OpenGL: Building a polyhedron via geometry shader

I'm stuck with geometry shaders in OpenGL - c++ programming. I want to create simple cube by repeating 6 times drawing one rotated wall. Here is my vertex shader (everyting has #version 330 core in ...
0
votes
2answers
95 views

Drawing a continuous line with onTouchMoved callback

i'm trying to draw a continues spline on every onTouchMoved call, the functionality is supposed to be similar to the line drawing used in the iOS game - flight control. i'm using it in the following ...
0
votes
0answers
48 views

Calculate hit-normal from collision

I am trying to implement a swept test collision between an AABB and a Line Segment and I found this implementation working great ... Except that it doesn't cover how to calculate the hitNormal and ...
3
votes
1answer
186 views

Is it more efficient to transform vertices on the CPU or the GPU?

Working on optimizing the rendering core of my game engine and I have a couple of questions. Is it more efficient to transform vertices to world space on the CPU before you send then stream to the ...
0
votes
1answer
77 views

OpenGL Viewport inside of a Viewport

I'm creating a labyrinth in opengl, and I'm trying to create a minimap. For that, I thought of creating a viewport inside of a viewport. I already tried following a tutorial from Lazy Foo, and I can ...
8
votes
1answer
698 views

Taking advantage of multithreading between game loop and openGL

Talking in context of a game based on openGL renderer : Let's assume there are two threads : Updates the game logic and physics etc. for the in game objects Makes openGL draw calls for each game ...
1
vote
1answer
56 views

Reference keyboard keys as “justPressed”, “pressed”, and “justReleased” with SDL in C++

I'm teaching myself 3D graphics with OpenGL and SDL in C++. I'm at a point where I need to be able to query states of individual keys, like so: if (InputManager::justPressed(SDLK_UP)) {} if ...
2
votes
1answer
71 views

Alternatives to map of strings in regard to performance

I would like to start my first question here with a subjective question. I think it qualifies as constructive. To introduce the situation: I have a 2D tiled map. I also had different arrays of ...
3
votes
3answers
161 views

C++ friend class, rendererer and mesh

I often hesitate to use friend classes in C++. Since it often does not feel right, or just seems to be an indicator of bad design. Though, in this case I think a friend class might improve the design. ...
0
votes
2answers
135 views

Can someone explain to me how setting shader parameters aren't a bottleneck?

I am trying to understand this. So I have a bunch of models that need to be rendered. Each model most likely has various "sub meshes" with their own diffuse, specular, etc textures. So for each of ...
0
votes
0answers
26 views

Eclipse OpenGL include problems [on hold]

I have eclipse and the c++ plugin. C/C++ compiles but for some reason it's including the right stuff except the glut.h. glut.h is in the miniGW folder in include/GL, but it's not finding it some how. ...
0
votes
1answer
59 views

glVertexAttribPointer stride ambiguity

As a hobbyist junior game programmer, I have done multiple small OpenGL projects just to have fun with 3D. I've tested VBOs in C++ and in Java and I found something or rather understood Java tutorials ...
0
votes
0answers
51 views

Playing Multiple Sound effects isssue in cocos2d-x

Please help if someone faced this issue. I have a sound effect 3sec long which need to be played repeatedly for some time of 10 to 15 secs. Implemented like below: ...
0
votes
2answers
46 views

How can I chain together Stencil tests from the same re-occurring routine, but keep the tests separate?

Sorry for the bad title; I don't know how else to explain this. I have a class called a Container. An instance of Container has other elements "inside" it. These elements have independent positions ...