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

learn more… | top users | synonyms

0
votes
1answer
114 views

Set Sampler states: Linear, Bilinear, Trilinear Filtering/Interpolation

How do you set each of these sampler states in the hlsl Linear filtering Bilinear filtering Trilinear filtering
1
vote
1answer
152 views

How to create and populate a 2D Texture Arrays in DirectX11

I have generated a bunch of ID3D11ShaderResourceView that are a 2D textures that have a depth map screen shot for my lights shadows. I would like to take all of these textures and put them into a ...
0
votes
3answers
186 views

Send info about gun shots via UDP

I am writing a small multiplayer game in C++. But I am confused about how to send info about gun shots to achieve best performance. I am thinking of different ways to do that: Let's say we have a gun ...
1
vote
1answer
95 views

SFML image extension for best performance

I am using SFML library in my 2D game. The Texture Class has a method to load an image from file: Texture.loadFromFile("image.*") Which file extension should I use to achieve best performance? ...
0
votes
1answer
113 views

Where to store OpenGL object id:s

When working with OpenGL, you often recieve integer id:s to keep track of OpenGL objects. For example, representing a simple mesh, you may have a number of references to objects like so: GLuint ...
1
vote
2answers
259 views

SDL 2.0 filtering mouse events

I have a simple 2-D breakout clone. It works fine, except for one bug. If I move mouse over game window, it will get input from mouse(mouse movement), and event queue will instantly be flooded with ...
2
votes
4answers
239 views

Using forces to reach a specific velocity

In my game, I currently move the player by directly setting its velocity on key press events. This makes the game feel very responsive and allows the user to quickly change direction. However, I ...
3
votes
1answer
174 views

Multiple pixel shader passes

I currently have a pixel shader that calculates the texture and I have another that calculates the light. I want another shader that does both. What I would ideally like to do is instead of creating a ...
1
vote
1answer
146 views

OpenGL Texture loaded but wont draw on Bind

I wrote my entire Texture loader by hand. I'm not using any Libraries. From what I gather the loading part is done correctly and stored in the texture class: Texture* TGATextureLoader::create(const ...
0
votes
2answers
661 views

C++ OOP Implementation of a game [closed]

I've been recently trying to get into Object Oriented Programming by porting a game I've made in C to C++. The problem is, even though my implementation works, I don't know if is the best approach. ...
1
vote
1answer
148 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 ...
2
votes
2answers
228 views

Handling cyclic dependencies in entity/components system

I built an rather standard C++ entity/component system (a bit like this one). Components can access other components through their associated Entity. This is usually done by getting some kind of ...
0
votes
0answers
47 views

Powder physics, how to efficiently find out where other particles are [duplicate]

You might be familiar with games like powder toy or powder game or some variation of it. I'm working on a very basic and similar game with just sand and water to learn a bit how it on works. I use ...
3
votes
1answer
161 views

Spliting up VAOs?

At the moment I have one vertex/fragment shader, but I am looking to add another shader program to deal with shadow maps. In my "final" shader I have VAO which define positions, normals, texcoords, ...
2
votes
1answer
328 views

Finding Z given X & Y coordinates on terrain?

I need to know the most efficient way of finding Z given X & Y coordinates on terrain. My terrain is set up as a grid, each grid block consisting of two triangles which may be flipped in any ...
4
votes
2answers
166 views

Shadowmap first phase and shaders

I am using OpenGL 3.3 and am tryin to implement shadow mapping using cube maps. I have a framebuffer with a depth attachment and a cube map texture. My question is how to design the shaders for the ...
2
votes
0answers
412 views

Arcball 3D camera

I have checked multiple threads before posting, but i havent been able to figure this one out. Ok so i have been following this tutorial, but im not using glm, ive been implementing everything up ...
0
votes
1answer
237 views

c++ most used libraries [closed]

I'm trying to find out whether or not I want to switch from Java to c++ for my OpenGL game programming. I now have setup a test project in VS 11 professional, with GLUT. I created my windows with ...
0
votes
1answer
106 views

Setting up cube map texture parameters in OpenGL

I see alot of tutorials and sources use the following code snippet when defining each face of a cube map: for (i = 0; i < 6; i++) glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, ...
0
votes
2answers
142 views

Implementing `fling` logic without pan gesture recognizers

So I am trying to port over a simple game that I originally wrote to iphone into cocos2d-x. I've hit a minor bump however in implementing simple 'fling' logic I had in the iphone version that is ...
1
vote
0answers
160 views

SFML 2.0 Too Many Variables in Class Preventing Draw To Screen

This is a very strange phenomenon to me. I have a class definition for a game, but when I add another variable to the class, the draw method does not print everything to the screen. It will be ...
0
votes
1answer
153 views

How do I get information about the level to the player object?

I have a design problem with my Player and Level class in my game. So below is a picture of the game. The problem is I don't want to move on the black space and only the white space. I know how to do ...
1
vote
1answer
533 views

glm quaternion camera rotating on wrong axis

I'm trying to get my camera implemented with a glm::quat used to store the rotation. However, whenever I do circles with the mouse, the camera rotates along the axis I am viewing (i.e. I think it's ...
2
votes
1answer
335 views

Improving Click and Drag with C++

I'm currently using SFML 2.0 to develop a game in C++. I have a game sprite class that has a click and drag method. The method works, but there is a slight problem. If the mouse moves too fast, the ...
1
vote
2answers
216 views

OpenGL position from depth is wrong

My engine is currently implemented using a deferred rendering technique, and today I decided to change it up a bit. First I was storing 5 textures as so: DEPTH24_STENCIL8 - Depth and stencil ...
0
votes
2answers
170 views

Normal map applied as diffuse textures looks wrong

Diffuse textures works fine, but I am having problem with normal maps, so I thought I'd tried to apply the normal maps as the diffuse map in my fragment shader so I could see everything is OK. I ...
0
votes
0answers
17 views

How to Point sprite's direction towards Mouse or an Object [duplicate]

I need some help with rotating sprites towards the mouse. I'm currently using the library allegro 5.XX. The rotation of the sprite works but it's constantly inaccurate. It's always a few angles off ...
0
votes
2answers
220 views

Normal maps red in OpenGL?

I am using Assimp to import 3d models, and FreeImage to parse textures. The problem I am having is that the normal maps are actually red rather than blue when I try to render them as normal diffuse ...
1
vote
0answers
292 views

Cocos2d-x CCFollow Zooming issue

Hi I am currently building a cocos2d-x game which incorporates pinch zoom using CCLayerPanZoom class which can be found here The problem is basically when using CCFollow and zooming and out, it ...
5
votes
2answers
424 views

Rotating object around moving object/player in 2D

I am trying to implement a camera which rotates around the world around the player. I have found many solutions online to the task of rotating an object about the origin, or about an arbitrary point. ...
0
votes
1answer
73 views

Action Script 3.0 datatype to match C++ iterator? (Code convertion) [closed]

I am developing a game with Action Script 3.0 using Starling Framework, converting it from C++ C++ Code : for (std::vector<MyObject*>::iterator i = m_listEnemy->begin();i!= ...
2
votes
2answers
322 views

std::map for storing static const Objects

I am making a game similar to Minecraft, and I am trying to fine a way to keep a map of Block objects sorted by their id. This is almost identical to the way that Minecraft does it, in that they ...
0
votes
0answers
135 views

Radiosity using a hemisphere

I'm working on a radiosity processor. I'm projecting scene geometry onto a hemisphere at a high order of tessellation during a visibility pass onto a 1024x1024 render target. The problem is that the ...
5
votes
4answers
551 views

Creating a voxel world with 3D arrays using threads

I am making a voxel game (a bit like Minecraft) in C++(11), and I've come across an issue with creating a world efficiently. In my program, I have a World class, which holds a 3D array of Region ...
0
votes
0answers
42 views

Error loading PCX image in FreeImage library

I'm using FreeImage in C++ for loading texuture from the PCX image. My FreeImage code is as following: FREE_IMAGE_FORMAT fif = FIF_UNKNOWN; //pointer to the image data BYTE* bits(0); fif = ...
0
votes
1answer
67 views

Texture errors in CubeMap

I am trying to apply this texture as a cubemap. This is my result: Clearly I am doing something with my texture coordinates, but I cannot for the life of me figure out what. I don't even see a ...
2
votes
1answer
122 views

iOS Game that Runs Continuously in Background

I'm trying to understand the most logical way of creating an iOS game that runs continuously in the background. For example.. you have tower and enemy waves. The game has endless enemy waves even ...
2
votes
1answer
187 views

“exception at 0x53C227FF (msvcr110d.dll)” with SOIL library

I'm creating a game in C++ using OpenGL, and decided to go with the SOIL library for image loading, as I have used it in the past to great effect. The problem is, in my newest game, trying to load an ...
0
votes
0answers
73 views

cocos2dx and tweenings libs

I know cocos2dx has built-in actions like move-to, etc... to do some kind of tweening but haven't seen any way for example to add different easy ins and outs. Browsing the documentation haven't found ...
2
votes
1answer
220 views

Multiple texture coordinates per mesh?

So far I've used the same texture coordinate for both the normal and diffuse textures on a mesh, yet when reading the Assimp documentation ...
0
votes
1answer
197 views

Problems with 3D Array for Voxel Data

I'm trying to implement a voxel engine in C++ using OpenGL, and I've been working on the rendering of the world. In order to render, I have a 3D array of uint16's that hold that id of the block at the ...
11
votes
5answers
903 views

How should game objects be aware of each other?

I find it hard to find a way to organize game objects so that they are polymorphic but at the same time not polymorphic. Here's an example: assuming that we want all our objects to update() and ...
1
vote
1answer
114 views

Brief pause after keypress

After i press and hold the key it goes forward once then pauses for a second or less then goes forward on forever. My problem is the brief pause I cant locate the issue. Thanks for your help. ...
1
vote
2answers
146 views

How do I reverse the playback of an animation (instead of restarting it)?

I have created a sprite sheet of which consists of six frames of a character whose legs move each frame. Now I have written code so that the animation is running successfully from frame one to frame ...
2
votes
3answers
420 views

Visitor-pattern vs inheritance for rendering

I have a game engine that currently uses inheritance to provide a generic interface to do rendering: class renderable { public: void render(); }; Each class calls the gl_* functions itself, ...
2
votes
2answers
181 views

What common interface would be appropriate for these game object classes?

Question A component based system's goal is to solve the problems that derives from inheritance: for example the fact that some parts of the code (that are called components) are reused by very ...
0
votes
1answer
310 views

GLSL billboard move center of rotation

I have successfully set up a billboard shader that works, it can take in a quad and rotate it so it always points toward the screen. I am using this vertex-shader: void main(){ vec4 tmpPos = (MVP * ...
13
votes
1answer
786 views

Normals vs Normal maps

I am using Assimp asset importer (http://assimp.sourceforge.net/lib_html/index.html) to parse 3d models. So far, I've simply pulled out the normal vectors which are defined for each vertex in my ...
2
votes
1answer
152 views

First Person Camera strafing at angle

I have a simple camera class working in directx 11 allowing moving forward and rotating left and right. I'm trying to implement strafing into it but having some problems. The strafing works when ...
0
votes
0answers
121 views

Getting current time in milliseconds

How to get the current time in milliseconds? I'm working on a hacking simulation game and when ever someone connects to another computer/NPC, a login screen popups with a button on the side called ...