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

learn more… | top users | synonyms

1
vote
1answer
232 views

How do I render my DirectX C++ engine to a C# Panel?

The title pretty much sums it up. I'd like to know how I can get the HWND of my C# Panel object to my DirectX engine so I can render to it. I know it involves making a C++/CLI wrapper, but I'm not ...
1
vote
0answers
45 views

When to Use Spatial Hashing vs Bounding Volume Hierarchy?

I've been slowly working on implementing a spatial hashing function into Bullet Physics to see how well it will work in my game engine as a general use. Though as I'm starting to design it, I do ...
3
votes
0answers
82 views

How can I fire a bullet from an actor's position?

I want to shoot a bullet from an actor. I know I need a location in space to fire a bullet from, which I've got in the form of a model set as an actor. Now I need to create a new object (in this case,...
0
votes
1answer
55 views

Cocos2d-x build failing on linux

I was trying to compile cocos2d-x on my linux machine, because they do not provide a binary copy of the library. However, I received the following error during the build: /home/ryan/Downloads/cocos/...
3
votes
1answer
59 views

OpenGL cube map is always black

When creating and rendering a skybox with a cube map texture, the skybox is black. Here is how I create the cube map texture: GLuint loadCubemap(std::vector<std::string> faces) { GLuint ...
2
votes
2answers
75 views

Jump-through & drop-down platform

I'm creating platforms in my game where the player can: 1) Jump through them from the bottom and land on top of them 2) While on top of them, drop down through them I've been able to get #2 working ...
2
votes
1answer
94 views

Translation Matrix not working properly

Hello, I get this result when i try to scale and then translate a vec4 in my shader. I created a mat4x4 class on my own and some functions wich return some matrices for me, everything works, but not ...
2
votes
1answer
71 views

I need to find intersection point of a vector in an axis aligned rectangle

I need some help, I have one vector in a rectangle like following (Ops, first A2 point on the top should be A1, assume it is A1) Let's say the vector is like above It doesn't have intersection ...
6
votes
1answer
162 views

How to find out at runtime if Vulkan and/or OpenGL support is available?

I'm building an engine, which has Vulkan for its primary rendering engine. But to have at least some backwards compatibility with devices that don't get drivers for (Mainly mobile) it I want to ...
2
votes
1answer
65 views

OpenGL GLSL using projection,view and transformation

I have been trying to get a simple triangle to render on the screen but an unable to using the Projection, View and Transformation Matrix's but an unable to get anything to the screen. Main loop ... ...
0
votes
0answers
24 views

Bullet Physics: 2dArray into Collisionshape

I'm fairly new to bullet physics and I am wondering how to make a collisionshape out of an 2dArray(x,y) with height informations. I figured out I have to use either btBvhTriangleMeshShape or ...
2
votes
0answers
52 views

What happens to Buffer data that isn't used?

I have a vertex struct that has 5 glm::vec3 but some of my objects only use 2 or 3 of those members. So I have two questions : 1.) What happens to the large buffer I create, even though I don't use ...
1
vote
1answer
44 views

Specular Light not working (Phong Lighting)

There seems to be a problem with my current Phong Shading implementation. I have been using the per fragment approach. The specular highlight aspect of the technique is not rendering as it should, as ...
-1
votes
2answers
121 views

What is the most efficient way to render water?

Would I create the water surface mesh in C++, and control the movement/animation in the CPU, and afterward apply any shaders (reflect/refraction/caustics/etc..). Or should I only create the mesh in C++...
1
vote
0answers
45 views

Perspective correct interpolation of normal values

I'm currently writing a software rasterizer and I'm at the point where I can draw arbitrary triangles with vertex colors and perspective correct texture mapping. I do point and directional lighting by ...
0
votes
1answer
62 views

drawing of heightmap gives weird single pixels

I'm working on a game where I want to generate a heightmap, however it draws a bunch of random white dots in a mostly black background, the function I have looks as following: void heightmap::layer1(...
1
vote
1answer
92 views

QT SFML Integration Trouble

I have been having trouble linking sfml to qt creator I have downloaded the pre-compiled libraries and headers for MINGW on the sfml website here : http://www.sfml-dev.org/download/sfml/2.3.2/ This ...
0
votes
1answer
34 views

Texture Wrapping isn't being applied properly

I've debugged my application with codeXL and can verify that my texture is getting these attributes applied: GL_TEXTURE_MIN_FILTER: GL_LINEAR GL_TEXTURE_MAG_FILTER: GL_LINEAR GL_TEXTURE_WRAP_S: ...
1
vote
1answer
23 views

Texture Wrapping isn't getting applied to my object

I have a Drawable Class, a Cube Class, and a Texture class. I feel like the texture wrapping isn't being applied due to some values being passed by reference, or just being discarded. My cube just ...
3
votes
1answer
37 views

Optimizing black and white matrix block drawing

Disclaimer: I am uncertain if this is the best place to post this question, so please advise me of how I can best find the answer if I am doing something wrong. I am asking this question because I am ...
0
votes
1answer
31 views

Events aren't working (Allegro5)

I've been using allegro for some time, and the timer event worked in all my previous projects, but I don't know what happened this time, I want to move a piece as long as the game is going, but it isn'...
9
votes
2answers
175 views

How can I support component-to-object communication safely and with cache-friendly component storage?

I'm making a game that uses component-based game objects, and I am having a hard time implementing a way for each component to communicate with its game object. Rather than explain everything at once,...
2
votes
1answer
79 views

Monitor external window events with SDL2

I'm trying to render my game (SDL2, C++) in a Windows Form application (C#) using C++/CLI to interface with my underlying C++ code. The purpose of the form is to create an editor which can monitor/...
2
votes
0answers
103 views

Texture Mapping to procedurally generated geometry

How can I calculate texture coordinates of such geometry? The angle shown in the image (89.90 degree) may vary, therefore the geometry figure is changing and is not always such uniform.(maybe like ...
1
vote
1answer
65 views

glViewport and single-pass cubemap rendering

This question is related to another question of mine on StackOverflow. The problem I'm facing is that while I'm rendering to a cubemap in a single pass using a geometry shader (like I show in my ...
1
vote
2answers
92 views

Drawing a level in SFML (C++)

So in an attempt to move out of the console environment I have set up an SFML poject in Visual Studio. I am currently trying to draw a stage from a vector within a vector (Matrix?), and the results ...
0
votes
1answer
96 views

How can I make only the hit brick disappear upon collision with the ball in breakout?

I want to make Breakout, but I am having problems destroying the bricks upon collision with the ball, all the bricks disappear upon collision, however, I only want the hit brick to disappear, how can ...
0
votes
0answers
19 views

rendering moving terrain using midpoint displacement algorithm in sdl

This is in addition to the question I asked over here. midpoint displacement algorithm in sdl. The answer there helped me but I am facing another problem regarding the moving part. The terrain ...
1
vote
1answer
47 views

midpoint displacement algorithm in sdl

I am trying to implement moving random hills in SDL. I am using midpoint displacement algorithm to create some random terrain and I have also accomplished to move the terrain too. But the problem is ...
0
votes
1answer
45 views

Some OpenGL code not working, but some is

I'm just starting out using GLEW and GLFW in a C++ project for my rendering code, but I'm having trouble actually getting anything to render. I know OpenGL is working in some capacity, because I am ...
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 ...
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
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 ...
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 ...
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 ...
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 ...
0
votes
1answer
49 views

Load 2 triangles in a simple DX11 example

I'm following this tutorial, where they show how to setup a simple dx11 demo with a green triangle in the middle. I'd like to be able to modify it so that it shows 2 triangles instead, i modified the ...
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
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 ...
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
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 ...
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)? ...
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 ...
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 ...