C is a general-purpose computer programming language used for operating systems, libraries, games and other high performance work.
0
votes
0answers
29 views
What technologies and libraries do I need to write a good 2D game in Python/C++? [closed]
I've been coding on and off for some time, doing some minigames up to several hundred lines here and there. I know how to write clean and documented code when it comes to decent game loop scripts with ...
0
votes
0answers
32 views
Writing a preprocessor, optimizer, and “back end” for a compiler for my own language [closed]
I am currently developing my own programming language designed to be used by game developers, dubbed the Motor Game Development Language. I am reading the book "Compiler Design in C" by Allen L. ...
0
votes
0answers
16 views
OpenGL ES 2.0 + Cairo HUD
I have posted this on StackOverflow before finding this Q&A so please excuse the double post but I think there will be more experts in terms of OpenGL around here.
I am trying to render a HUD ...
0
votes
1answer
32 views
traversing the area
i want to move point along spiral like hexagon for example i want to traverse the whole area and my player (point) is standing where i have placed it manually. now i want to start from this point and ...
0
votes
0answers
89 views
How do I extract the right information from my projection matrix for frustum culling?
I've tried several different tutorials for Frustum culling, however I cannot understand them.
Here's my function that sets up my projection matrix (someone else helped me with this, but I don't know ...
1
vote
1answer
32 views
Quaternion rotations & transforms from global to local space
I am trying to solve this problem and getting no where,
could really use some assistance.
Rotation is defined as X (rotate left/right), Y(rotate up/down), Z(roll)
Coordinates are X: Forward/backward, ...
1
vote
1answer
105 views
Setting up an efficient OpenGL rendering loop
This is the code that I use to setup my shader
char* vertexShaderSource = getResource("vert.shad");
char* fragmentShaderSource = getResource("frag.shad");
vshad = readFile(vertexShaderSource);
fshad ...
0
votes
1answer
47 views
opengl matrix multiplication
Can someone provide some type of example of multiplying a 4x4 matrix without using loops?
typedef struct matrix4
{
data[16];
} m4;
can someone provide a sample of how you you'd multiply two of ...
0
votes
1answer
44 views
a shader type class in c
Is it possible to setup something sort of like a class in C++ but in c in the simplest terms? I want to avoid using c++ but I would like to create a simple struct that has glsl shader program.
for ...
0
votes
1answer
37 views
Segmentation fault on reallocation of memory but why? [closed]
I have been learning to code in C from this amazing resource http://c.learncodethehardway.org/book/
I am on exercise 17. Basically creating your own simple database using Malloc. I modified the ...
0
votes
1answer
35 views
Cannot Get The Texture Showed Up Correctly glDrawElements
I still have this problem almost 1 month. Tried to search on Google but did not find any solution to this. I have loaded all the data correctly but don't know why the texture came up like this.
Here ...
0
votes
2answers
80 views
Move towards view direction opengl?
I'm trying to get the basics of 3d with opengl 2.0(I know, I know, it's deprecated etc, etc. It's just for the sake of prototyping). I'm trying to get a cube on the screen which you can move around. I ...
3
votes
1answer
153 views
2D day night mapping
I'm looking for this kind of effect MINUS the lights and snow (Another problem).
It needs to change depending on the time of year.
Doesn't need snow or city lights.
Now I'm pretty new to shaders ...
1
vote
1answer
85 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 ...
0
votes
2answers
76 views
Is there any easy way to understand the Alpha Beta for Othello?
I'm stuck with coding the Alpha Beta algorithm for a console-based game I'm developping at the moment. I tried to understand how it works for a week but still no idea how to get started with it.
Here ...
1
vote
2answers
163 views
Are SDL games trivially portable from Linux to Windows?
I have a small game made with SDL2 and I want to port it to Windows. Would I hav eto write a lot of #ifdefs to port it or will the very same code work on Windows and Linux? Or is it more complicated?
...
0
votes
2answers
131 views
What's the correct way to move 2d sprites in opengl 2.1?
I'm getting into Opengl 2.1 and wanted to know how can I move 2d sprites.
I already created my vbo and ibo, and the vertex data is already there. But, how can I move a sprite once it's already drawn?
...
1
vote
1answer
107 views
opengl : Running at least 25 windows with different Draw callback
I need to run at least 25 windows concurrently with each window rendering a different game state.
I am storing all the 25 game states in the array of type GameState allGameStates[25].
For each of the ...
2
votes
2answers
124 views
Rogue Door Connection logic
I'm having a bit of trouble developing code to figure out which doors connect in Rogue which is written in c. Not the actual path making. I just dont understand how they link to each other.
If rooms ...
3
votes
1answer
138 views
Where can I find OpenGL state changes profiling?
Is there any benchmark that actually measure state changes cost in OpenGL 3.x/4.x and gather an average statics for all graphics cards? (I don't want to optimize only for my old AMD card, I'm not even ...
0
votes
2answers
61 views
Overload how an object instance of a class is treated when used
So I've made this struct that encapsulates a glm::vec4. This is because vec3s are treated as 16-byte in GLSL, but I don't want to assign a vec4 if I only really need 3 components. Anyway, my question ...
1
vote
1answer
216 views
C++ Ray Traversing in 3D Voxel game
I'm currently working on a Voxel game in 3D and need a tad bit of help to figure out what Voxel the player is looking at. This is the data I currently have:
GRRLIB_Camera3dSettings(Player.x, ...
1
vote
3answers
87 views
c - Starting an user defined function after the current one ends
The game I am creating displays a menu before starting, the user may select to start the game, or do some stuff. When the user selects an option, I need to call another function which actually does ...
1
vote
1answer
49 views
How can I send matrix data to shaders without the Effects11 framework?
I'm making a Direct3D engine but I'm stuck with this one little problem.
I want to not use effect files but instead use shader files. What can I use to send matrix variables to shaders if I don't use ...
2
votes
2answers
628 views
How to detect graphics API at runtime with SDL2?
Using SDL2, is there a way to determine at runtime whether the application is using OpenGL, OpenGLES, or DirectX?
EDIT: If there is a way to figure it out without using the SDL2 API, I'm willing to ...
2
votes
1answer
601 views
Emscripten code and three.js
I would like, if it's possible, to use Emscripten code generated from C/C++ with the Javascript library three.js. For example, from emscripten code I want to pass rendering information to the three.js ...
0
votes
1answer
91 views
Can I directly pass a Boost ptr_vector list to glBufferData?
I have a data structure like this:
typedef struct vertex_ {
float x;
float y;
float z;
float s;
float t;
}vertex;
Then I add to a list called: boost::ptr_vector<vector> vertices;
Is there a ...
0
votes
1answer
886 views
Scaling an SDL Surface
I want to create a button for a game's UI. The background uses a gradient and then I blit a surface on top of the gradient and use SDL_SetColorKey to delete the unwanted pixels. The surfaces are not ...
0
votes
2answers
153 views
which quarter of a triangle the point is in
I've got a world made out of squares. The square are devided in four triangles like this:
The corners have their heights stored in a 2D array and the center height is the average of the corners. To ...
0
votes
1answer
163 views
SDL Surface clipping mask
I am creating a GUI for my game, so I use some buttons like . So you can see it is only text surrounded by a rectangle. But I currently use a huge png image with all the buttons I need arranged as I ...
1
vote
1answer
68 views
Accelerated Motion
I'm making a menu for my game with SDL, when you click on an option a sub menu slides down and is shown, just sliding down is really boring, so I want it to accelerate(like if gravity was pulling it) ...
5
votes
3answers
1k views
Is it a good plan to use 2D physics for a 3D racing game? [closed]
I am working on a 3D racing game using SDL and OpenGL. I thought it would be easier to use a 2D physics engine, since I really don't need the 3rd dimension. There will be no flying cars or jumps, they ...
3
votes
1answer
177 views
How to get scripted programs governing game entities run in parallel with a game loop?
I recently discovered Crobot which is (briefly) a game where each player codes a virtual robot in a pseudo-C language. Each robot is then put in an arena where it fights against other robots.
A ...
-2
votes
2answers
2k views
Which library to choose between SDL and GTK for C game Development (Begginer) [closed]
Note: I know that this is a opinion based question
I've been programming in C it's been some time, now I want to get into game development but I'm not sure which GUI library should I use between SDL ...
3
votes
1answer
159 views
Collision detection in Pong clone
Well I'm trying to create a pong clone using SDL and I had some problems with the frames and some times the ball would go through the paddles despite the fact that at other times the collision worked ...
0
votes
2answers
260 views
Is networking programming quite generic
I have only looked into the basics, at least I assume it gets more complex. So does network code really change from one game to the next or is it pretty much portable. For example I can create say a 2 ...
0
votes
1answer
930 views
Render two images to an SDL_window
I want to create a menu for an SDL game, so I load an Image to an SDL_Window as the background, then I try to load the next image which will be a button but it doesn't display the button to the ...
1
vote
1answer
543 views
Background color gradient with SDL
I want to create a menu for a game using a color gradient as the background. Is there a way to create a gradient background instead of using an image for it (since I don't know what size the window ...
0
votes
1answer
44 views
Problem with .hdr/.pic format
So, everything was clear from the specification point of view, but when I moved to reading through some of the original implementations and reimplementations, I ran into this:
f = ...
-6
votes
2answers
120 views
Is padding brackets objectively the best way to write C programs? [closed]
void Function( int, char )
versus:
void Function (int,char)
My friend keeps saying otherwise. What is objectively the best way to write brackets?
1
vote
2answers
194 views
Using Lua for configuration and localization data
Since my game is already going to be scripted with Lua, I've decided to make all my configuration and localization data defined using Lua tables. For example, this could be a basic locale file:
-- ...
1
vote
1answer
133 views
How to draw or translate into world space?
I've been hacking around with OpenGL, but there's a few concepts which I can not find the answer on.
I want to draw three GL_QUADS next to eachoter like so:
1[2][3]
I know GL_QUADS are deprecated, ...
4
votes
1answer
108 views
Dealing with interpolation and object creation/destruction
I've implemented a game loop similar to that in Glenn Fiedler's Fix Your Timestep! article. I have an update step running at 50Hz and a render step running at 60Hz (monitor refresh rate). To keep ...
1
vote
1answer
417 views
How to adjust a font to fit inside a speech bubble?
I'm creating a game that contains a speech bubble for dialog. The idea of this function is to allow one call to set new text in a speech bubble. The speech bubble will adjust in size of the new font ...
1
vote
1answer
367 views
Update and Render logic with interpolation
I am working with C and SDL2 and just wanted some insight as to how to properly apply interpolation to the rendering.
EDIT - some clarification, update() input() and render() are just hypothetical ...
0
votes
0answers
196 views
bones programmatically in assimp
I am trying to animate a 3d hand object programmatically in Assimp, I have the 3d model being export to collada using Blender. But I have no idea how to go from one bone animate it and then go to the ...
1
vote
0answers
80 views
Sampler object not changing texture filter
I am currently binding a sampler object to a texture (GL_TEXTURE12 to be specific) with
glBindSampler(12, sampler);
and the initial settings are very visible compared to the textures own settings. ...
0
votes
1answer
171 views
Linking error at tessellation shaders in GLSL
I'm testing the triangle tessellation from the link http://prideout.net/blog/?p=48#shaders . All the shader are compiled correctly, but when I try to link the program using the command:
...
1
vote
1answer
148 views
When creating the horizontal blur, how is the vertex shader being called for each pixel?
I am following this tutorial. I am confused as to why the VertexShader is being called each time for the PixelShader. I was under the assumption the VertexShader is called only 6 times during the ...
0
votes
1answer
894 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