New answers tagged

0

As far as I know that's the best solution to check if there is an active context.


0

When storing items of a child class in a vector, the vector will call the father's constructor (constructor of the type the vector was appointed to.) To avoid that, you'll want a vector of pointers instead: std::vector<DrawableEntity *> entites; For this approach you will likely have to dynamically allocate your entities manually using, say, the ...


4

I highly recommend using MSYS2 instead of Cygwin. It is basically a well-maintained fork of Cygwin that includes ① the Mingw-w64 toolchain (basically, GCC for Windows), ② a robust package manager (pacman from Arch Linux) and ③ packages for the Irrlicht engine. Once MSYS2 is installed, you can install GCC and Irrlicht from an MSYS2 shell: pacman -S mingw-...


0

There's a couple of ways you could go about such a system, as with anything. I'll try to describe the core of one such system in a pretty general sense here: An animation consists of AnimationFrames. An animation frame contains a bunch of data. struct AnimationFrame { //The graphic for this frame Sprite * sprite; //Duration (for example, ...


-1

With a scene graph you can have child objects that move when parent moves. You can also make some states propagate to children, like hiding/showing groups of objects just by changing the state of the root of the hierarchy. Implementation could be done by game objects having a transform component that has a pointer to its parent.


0

First make sure that your matrices are column-major. Second this call: glVertexAttribPointer( 0, 3, GL_FLOAT, GL_FALSE, 0, (void*)0 ); Should look like this: glVertexAttribPointer( 0, 3, GL_FLOAT, GL_FALSE, sizeof(float) * 3, (void*)0 ); Because you want to move vertex attrib pointer by 3 floats (I ...


0

For this purpose I would use Verlet integration. It's nice and easy to implement algorithm. You can read more about it here.


0

While not having experience with Cocos2D, I'd guess that you'll need to replace isnan with std::isnan. If that works, it's a portability bug in Cocos2D because on some compilers/standard libraries some methods can be called without std::.


0

OpenGL uses column-major matrices, but as I understand from your code you pass row-major matrices. So in GLSL scale[0] is the first column of scale matrix.


3

You actually do not need C++/CLI for this, although you could use it if you wanted. I don't really recommend it. C#'s platform invoke facilities should be sufficient for you. You'll need to make your engine available as a DLL. Doing so is beyond the scope of this question, but there's plenty of information about making DLLs available on the web. Once you ...


-1

You could use a software like Enigma to pack your files and save them into a single .dat. You would need to change the folder of your launcher.


0

The goal is to project the vector onto the correct sides of the rectangle. Using the tangens function we're already halfway done. The rest is basic trigonometry. Input data Depending on how you store the rectangle, we have to transform the input data first. This method expects a rectangle that is defined solely by it's size (width w and height h). It's top ...


0

I was actually able to accomplish this by doing the following (there might be a better way than this, but it worked). This answer below is a bit specific to Box2D, as this was the original question's context. Here are the requirements we want When we make contact with the top of a platform, we want to enable the collision and stop the player If the player ...


2

It turns out that the cube map texture has to be EXACTLY square or OpenGL will break, and for some reason it doesn't throw an error when I do this, so I don't really know if this is a SOIL error or OpenGL error... EDIT: I used a different library to load textures and it seems that the texture still is black when its is not perfectly square.


2

I'm pretty sure you can deal with this by ignoring the collision if the y-component of the velocity is positive (the player is moving upward). Alternately you might be able to use the collision filtering flags. One-way floors are given their own contact group, and the player object can set/unset whether or not they collide with this group based on their ...


5

Your first check is likely to be a LoadLibrary call (or equivalent for your platform) for the Vulkan DLL: HMODULE vulkanDll = LoadLibrary("vulkan-1.dll"); Then you'll want to acquire the pointer to vkCreateInstance. PFN_vkCreateInstance vkCreateInstance; // ... vkCreateInstance = GetProcAddress(vulkanDll, "vkCreateInstance"); Then you'll want to fill ...


0

They way I've gone about calculating the delta time has been via SDL_GetTicks(): struct Clock { uint32_t last_tick_time = 0; uint32_t delta = 0; void tick() { uint32_t tick_time = SDL_GetTicks(); delta = tick_time - last_tick_time; last_tick_time = tick_time; } }; Then I simply tick a Clock instance in the main ...


0

Turns out that I was using sfml 2.3.2 which I guess isn't fully compatible with qt creator so I tried sfml 2.0 and it suddenly worked. Here is a link to a video describing how to link SFML to Qt Creator: https://www.youtube.com/watch?v=VWvD4mUpyfU


0

Simplest possible way is obviously the following: create mesh with enough vertices that describes water surface configure your shader to move the vertices in a circle


0

Seems like your UVs are not correct. Can you maybe post us the contains of the vertex vec ? Sry that I made this as an answer but I cant comment yet.


0

I think glVertex3f takes NDC coords, so you have to normalize your variables.


0

Depends on which level of detail you wanna achieve. Height Maps could be a solution, try to avoid as much work on the CPU as possible in every case. You can combine also some techniques as tesselation. There are plenty sites on the web for inspiration, you know where to search :)


-1

So turns out it was a problem with my UV coordinates.


0

There are two really good tutorials on the internet about how to improve performance, both by a guy called ThinMatrix. The first is mostly what you are looking for, but if you want to make it SUPER efficient you can also take a look at second one: First: https://youtu.be/X6KjDwA7mZg Second: https://youtu.be/Rm-By2NJsrc


1

but it isn't moving at all, so the timer event isn't working, why is that? What makes you so sure it isn't moving because the timer isn't working? Try inserting a print statement in the if (ev.type == ALLEGRO_EVENT_TIMER) block -- I think you'll see that your timer event is firing. It isn't moving because you increment firstStuffXPos/firstStuffYPos, which ...


5

Your communication model seems fine, and option one would work okay if only you could store those pointers safely. You can solve that problem by picking a different data structure for component storage. A std::vector<T> was a reasonable first choice. However, the container's iterator invalidation behavior is a problem. What you want is a data ...


5

Being 'cache friendly' is a preoccupation big games have. This seems to be premature optimization to me. One way to solve this without being 'cache friendly' would be to create your object on the heap instead of on the stack: use new and (smart)pointers for your objects. This way, you'll be able to reference your objects and their reference will not be ...


1

This is probably not the approach you want to take. Normally this kind of "render my engine into a HWND" technique accomplishes input handling by having the other HWND's process (the C# application in this case) send the relevant events back to your engine process via some kind of backchannel, such as a socket connection. It's generally an easier-to-deal-...


0

First of all, please put a simple version of your code here so I can fix it for you. But for now, there is lots of reason you can't render correctly in your cube map: Early use of texture (use flush and finish to make sure your using a completed frame buffer) Maybe your texture and frame buffer format are mismatched. There is lots of other problematic ...


1

Unfortunately, I don't have enough reputation to add a comment to your original post. Here is my go at a partial answer! Here is where you populate the top row with 30 white boxes. for (int i = 30 - 1; i != -1; i--) { hitbox[i][0] = 1; } It looks like your boxes are 20x20 because tmp[0].position = Vector2f(y * 20 - 10, x * 20 - 10); My honest ...


0

Switch statements are supposed to be surrounded by curly braces. switch(level.hitbox[y][x]) { case 1: tmp[0].position = Vector2f(y * 20 - 10, x * 20 - 10); tmp[1].position = Vector2f(y * 20 - 10, x * 20 + 10); tmp[2].position = Vector2f(y * 20 + 10, x * 20 + 10); tmp[3].position = Vector2f(y * 20 + 10, x * 20 - 10); ...


1

The problem is with how you're using your Bricks class. You're using the same Bricks instance to draw multiple bricks (FYI- a more common convention would be for this class to have a singular name: Brick), so when one of those instances is hit, all of the locations that brick is drawn at disappears. Furthermore, the different instances of Bricks are actually ...


0

You could try doing all relevant calculations on numbers multiplied by e.g. 1000 and then divide/round by 1000 before display. So if your source and destination are (16;44) and (85;140) you could make the walk logic move say between (16000;44000) and (85000;140000), then on display - convert back tox1 scale. Of course if you are limited to WORDs - multiply ...


1

You are generating a random number incorrectly. int change = ((rand()%1) * 5 - 1) * displacement; Change will always be (-1 * displacement), because anything modulus 1 is always zero. Try this for a range of [-5, 5]: //rand() % 11 returns range [0, 10], subtract 5 makes range [-5, 5] int change = ((rand() % 11) - 5) * displacement; I also recommend ...


0

You can, however, you must use proper Devkit, which is hard but not impossible. Just, apply for ID@XBOX and go learn it yourself. And seriously, target steam first and show some traction. Or, pay a lot of bucks. Or, port to C# and go for it.


2

Thats because glBegin, glVertex2f and glColor3f are legacy functions which are deprecated. You may still use them if you request a backwards-compatible context, however I'd recommend you stick to your core-context (which is not backwards compatible) and learn the more powerful modern OpenGL. There is a pretty good modern OpenGL tutorial series on opengl-...


0

If you have multiple object, then of course you must check each. However, you can first get the closest object to the cursor, and then check if it's inside. Object closestObj = null; // no object selected float closestDist = 50; // all objects are smaller than that, Object currentObj; float currentDist; for each currentObj in sccne { currentDist = ...


0

Now, if the object is a circle, you must use another formula. Suppose that the circle is centered on (centerX, centerY) and its radius is radius. The mouse cursor is inside the circle if... (cursorX - centerX)^2 + (cursorY - centerY)^2 < radius^2 If it's an ellipse where the horizontal radius is radiusX and the vertical radius is radiusY, then the ...


0

"I need to know how to use it to check if the mouse is currently over any of my rendered objects." Suppose that your object is a rectangle with the following attributes: posX: horizontal distance from left of the screen to the first pixel of the object. posY: vertical distance from top of the screen to the first pixel of the object. sizeX: horizontal size....


0

I finally found the solution to my problem: I have to set the viewport to begin at origin when I render to framebuffer. I didn't mentioned that I was rendering my scene to the framebuffer, because I thought it was irrelevant and apparently that casued the problem. In my case viewport transfromations accumulated: first when rendering to texture using ...


1

You don't have to change your projection matrix accordingly to the viewport. Have you considered to render the scene to a fbo and then render the fbo fullscreen (from -1, -1 to 1, 1) with glViewport(width / 2, height / 2, width / 2, height / 2)? This will took a quarter of the screen (top right). In my current project, i can freely set the offset of ...


1

A good source for voxel based questions is PolyVox. For this particular case, just check out this: link. There is also a lot of documentation included there.


1

Here nothing gets sent to any queue at all. To have a command buffer executed you would do ThrowIfFailed(queue->ExecuteCommandLists(1, &m_command_list)); setting the command list back in the recording state is simple, just Reset it.


1

My answer is merely a small addition to the excellent answer by Alexandre. Your problem really is modifying a vector while iterating over it. The solutions mentioned by Alexander are great, but I just wanted to share a trick I've been using for removing elements from vectors while iterating over them. Basically, you would keep a separate container (this can ...



Top 50 recent answers are included