Model slowing down the game - opengl [closed] - c++

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 1 year ago.
Improve this question
I have a problem while running my game. The model that I import in the game is quite big, making the fps drop down. That's okay but when I get the camera off from the model, it still stays slow. As other games do, when looking at a high resolution model, the game slows down but when not looking at it, it gets faster. However my game stays slow all the time. Can anyone help me?

You need to implement clipping, so that you don't render the object (i.e. pass it through the graphics pipeline) when it's not visible.
There are many techniques and algorithms/data structures for this, ranging from manual view frustum-testing, to more advanced spatial-querying data structures (BSPs, quadtrees, octrees and so on).

Related

Creating a GUI in OpenGL, is it possible? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
I'm trying to create a custom GUI in OpenGL from scratch in C++, but I was wondering is possible or not?
I'm getting started on some code right now, but I'm gonna stop until I get an answer.
YES.
If you play a video game, in general, every UIs should be implemented by APIs like OpenGL, DXD, Metal or Vulkan. Since a rendering surface has higher frame rate than OS UI APIs, using them together slows down the game.
Starting with making a view class as a base class, implement actual UI classes like button, table and so on inherited from the base class.
Making UIs using a GFX API is similar to making a game in terms of using same graphics techniques such as Texture Compression, Mipmap, MSAA and some special effects and so on. However, handling a font is a sort of huge part, for this reason, many game developers use a game engine/UI libraries.
https://www.twitch.tv/heroseh
Works on a Pure C + OpenGL User Interface Library daily at about 9AM(EST).
Here is their github repo for the project:
https://github.com/heroseh/vui
I myself am in the middle of stubbing in a half-assed user interface that
is just a list of clickable buttons. ( www.twitch.com/kanjicoder )
The basic idea I ran with is that both the GPU and CPU need to know about your
data. So I store all the required variables for my UI in a texture and then
sync that texture with the GPU every time it changes.
On the CPU side its a uint8 array of bytes.
On the GPU side it's unsigned 32 bit texture.
I have getters and setters both on the GPU (GLSL code) and CPU (C99) code that
manage the packing and unpacking of variables in and out of the pixels of the texture.
It's a bit crazy. But I wanted the "lowest-common-denominator" method of creating
a UI so I can easily port this to any graphics library of my choice in the future.
For example... Eventually I might want to switch from OpenGL to Vulkan. So if I keep
most of my logic as just manipulations of a big 512x512 array of pixels, I shoudn't
have too much refactoring work ahead of me.

Inconsistant OpenGL rendering bug with 3D objects [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 years ago.
Improve this question
So I've been hammering away at my code for a while, trying to resolve this bug, with absolutely no progress being made.
Mostly due to how utterly random and unpredictable this bug is.
So this is how the scene works when everything is working fine
And when the bug kicks in
As you can see, the bug only prevents my cubemap skybox, model, and light source mesh from rendering, but the ortho projected 2d elements are just fine.
I've ruled out shaders, as even the simplest of shader programs still experience this problem. I use ASSIMP to load in mesh files and SOIL to load textures, but up until about a day ago they have worked flawlessly.
There is absolutely no pattern to when this happens, the only way to resolve it is to just keep restarting the program until the desired output appears. That is obviously not a good solution. I'm at a complete loss and need help, as opengl doesn't push out an error or anything. I don't know where to even begin looking for a solution. Could EBO's or frame buffers cause this? As I have started implementing those recently.
I have searched far and wide for anything that could be related to this, but I have come up with nothing so far.
TL;DR: 3D objects will not render only on some runs and work fine on others, possible issues with recently implemented framebuffers and EBOs.
UPDATE:
It turns out that my mouse look code in my Camera class was causing some odd issues where calculating the change in camera angles caused it to be set to an extraordinarily high negative value. Turning mouse look off permanently resolved the issue.

How to detect teeth using opencv [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I am working on one project and in that i want to make teeth white. So for that need to find teeth part.I have tried equalizeHist, adaptiveThreshold, threshold,dilate, erode etc.But not getting exact teeth part.
So can anyone tell me how can i do it.I am using OpenCV c++ library.
In input i have this image
I have found this type of mask
So if i use this mask the image looks unnatural like this,
I see two problems. You find the correct region, but the boundary is imprecise. That's solvable by looking at the gradient of the hue, which will form a clear contour. If you use the HSL color model, the Lightness component will likely have a sharp contrast too.
Secondly, the bigger effect IMO is that you far overdo the whitening. This loses a lot of contrast between teeth. You probably want to just drop the yellow saturation, but don't touch the luminosity.
If you want to be really fancy, determine where the teeth edges are, and you can smooth out the luminosity elsewhere. This removes small stains on teeth.

Recognising Image Patches - Advice Needed [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I am looking for advice on algorithms that would allow me to recognise an image patch of a hand. So given an image, I would like to extract patches that would belong to a hand (those will be positive patches). Everything else would be negative patches.
My target application is to distinguish a hand (of any hand shape) from other objects without using colour, by being able to identify if a patch belongs to a hand..
The figure below depicts what I have in mind,
The only problem with hands is that it can take any shape form. Are there any suggestions or algorithms to do the above?
Thank you in advance.
This is a very broad research topic, so you are unlikely to find any good example software available, but you are likely to find many research papers in this area, and if you are lucky then you might find some where the authors publish their code.
You've given a picture of a cat, so taking that as inspiration I did a quick search and found this paper from the Andrew Zisserman group at Oxford University. Another group to look into is that of Jitendra Malik at University of California at Berkeley who have an interest in this area using a combination of image segmentation and feature detection.
Depending on your motives search terms could include: deformable shape models, skin segmentation (although you say you don't want to use colour - why not?), object detection. The possibilities are numerous, and they are all current research topics throughout a number of computer vision communities.

Best way to learn about Direct X [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I want to begin looking at Direct X, but don't just want to try and throw myself into it. What are some good resources to get ones feet wet?
I highly recommend Toymaker's tutorials. Helped me greatly when I was first starting out with DX and was just as good as a reference later on.
The other thing to do would to set up some small projects that use DX that increase in difficulty as you go. If you'd like a starter list (from easy to hard):
Compiling using DX libraries (I always remeber having trouble linking the libraries correctly in Visual Studio).
Change background colour.
See a model on-screen.
Moving the model with input.
A camera.
Apply a texture to your model.
Add multiple models to your scene.
Add lighting.
Create your a simple rectangle model and display a texture on it.
Get comfortable with all that and then have a look at shaders, advanced lighting and animation.
There are quite a few books on directX, but there is so much freely available information on the web these days, I would just jump right in there.
A good place to start is just to do a youtube search for DirectX Tutorials. In my opinion, this is a fun and interesting way to get started learning a new dev skill.