Drawing a physics body's path? [closed] - opengl

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
I've been working on a first-person shooter game with Bullet and OpenGL, and now have it to the point of being able to fire bullets through the scene. I'm now looking to draw the path these bullets take, from starting position to their ending position, with the entire path staying drawn until the next bullet is fired (so that the screen isn't cluttered).
I'm basically just looking for something like a red line that extends to the bullet's new position each frame, or something like that. So, by the time the bullet has gone from the gun to its final stopping place, the red line will show the exact path it took, what it bounced off of, etc.
I've tried looking for examples but I can't find anything useful. I've seen mention of leaving a trail behind an object using an accumulation buffer, but that's not really what I want.
How can this be done? Does everyone know of any examples or tutorials for this?

just make vbo of points
and then
...
glVertexAttribPointer(.., 1, GL_FLOAT, GL_FALSE, 0, (void*)0);
glDrawArrays(GL_POINTS,0,.. );
Use math you have to assign each.
But it's not so easy. I think it can be done with deploy of second pair of shaders /vao. OpenGL multiple draw calls with unique shaders gives blank screen

Related

How to render text in OpenGL menu-system smartly? [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 want to make a simple windowing system in an OpenGL app. Rendering menus with text-boxes, buttons, check-boxes, etc. How do I render this smartly?
So far I have 2 ideas:
In each frame I render every character of the menu to the screen.
I keep the menu/window in a texture, and render only this texture each frame. (and only update the parts of the texture that have changed.)
What are the downsides of each?
Start with the first bullet, then maybe implement the second bullet later as an optimization. The second bullet is sometimes known as "framebuffer caching". Note that Dear ImGui (a very popular GUI library that can use OpenGL for rendering) does not bother with framebuffer caching.
If you decide to implement framebuffer caching, the work you did in the beginning will not be wasted, since you will use it to update the cache.

Resources for a 3D animation program [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
Improve this question
I'm trying to develop my own mini animation program like maya, blender, cinema 4d where I can create objects, move them around, render them, etc. Does anyone know any good resources for that? I've found a few but usually when I google for something similar to this all that comes up are game engines. I'm not trying to create a game. And please, don't tell me things like "you need a team", "just use what is already out there", "you're probably not experienced enough"..
Here are some resources I've already found:
https://www.reddit.com/r/cpp/comments/3g1pvf/i_want_to_create_a_3d_engine_from_scratch_where/
https://gamedevelopment.tutsplus.com/tutorials/lets-build-a-3d-graphics-engine-points-vectors-and-basic-concepts--gamedev-8143
https://www.codeproject.com/Articles/1168552/Build-My-Own-D-graphics-engine-step-by-step
Target: Windows
Math
You should know enough linear algebra to know how the various linear transformations in 3D graphics work - translation, scaling, change of coordinate basis, view transformation etc.
You should also know how to render curves and surfaces using splines, Bezier curves, Bezier patches, subdivision methods (e.g., Catmull-Clark) etc.
Mathematics for 3D Game Programming and Computer Graphics is a good place to start if you are unfamiliar with the math.
GUI
After that, you need to pick the libraries for building the application. For building the GUI, if you want to make it easy to port it across platforms, go with Qt. If you only want to target Windows, then go with the native .NET library.
3D Engine
For representing, manipulating, and rendering 3D objects, you could go with the Unity engine. There are a lot of tutorials and books around to teach you how it works.
If you want to go deeper and build your own engine, you can either work with DirectX or OpenGL/Khronos.

Store static environment in chunks [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 5 years ago.
Improve this question
I have terrain separated by chunks and I would like to put environment (For example, rocks, trees, etc..) in each chunk randomly.
My question is related to how to implement such system in OpenGL.
What I have tried:
Solution: Draw the environment with instancing once for all the terrain (not a specific chunk)
Problem: I except the chunk to sometimes take a bit to load and because I am using threads the environment will appear as floating.
Solution: Draw the environment with instancing for each chunk.
Problem: To draw each chunk, I will need to bind the VBO for the chunk, draw the chunk, bind the VBO for the environment (and the VAO probably) and draw it.
I don't want to put so many glBindBuffer functions because I heard it is slow (Please correct me if I am wrong)
(Not tried) Solution: Somehow merge the vertices of the terrain with its environment and draw them together.
Problem: My terrain is drawn with GL_TRIANGLE_STRIP so this is a first problem, the second problem(?) is that I don't know how well it will function (talking speed).
I tried looking up solutions on the internet but didn't seem to find any that relate to chunks.
Anyone know how other games that uses chunks do that? Is there a way to do it without causing a lot of speed decrease?

Is there any tool to draw 3D map/floor map using open GL [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
Improve this question
Is there any tool available which can be use to draw 3D floor plan /Map which gives the code o/p in open GL??
What I want to do is to draw a 3D map of my floor.
It shouldn't be to hard to draw your floor plan in a basic 3D modelling package like Wings3D, export to a basic format like .obj that could be easily parsed.
If you need a 3D package with more options(for texturing,baking lights, etc.) give Blender a try. There are plenty of export options, including .raw (Raw faces) which
an even more basic way to store vertices/faces than .obj. Also it's fairly easy to write
a custom exporter using Blender's Python API which gives you the OpenGL code the way you need it for your setup.

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.