Some tips for parsing [closed] - c++

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 1 year ago.
Improve this question
I have been trying a couple libraries to load/parse my .obj model into my opengl program.
Here's some of them:
nate robins, GLM
obj2opengl(farthest one) by heiko
also a few other loaders that didn't work.
My main problem with these were undefined errors. And since I tried GLM from many different people (editors of the original code) then maybe it's something I'm doing wrong.
So my questions are:
What obj loader should I use for opengl (PC type)?
If I were to parse the obj file myself, then how should I save the vertices?(the fastest/most efficient) also choices with pros/cons are even better
I'm using Code Blocks/MinGW on windows 32 bit (7 and vista).

You might be interested in the (unfortunately named) Assimp library. While it is not a (fast) parser in and of itself, you can use it to produce an easy to parse format that contains only the data you are using, and it can load a lot of formats.
If you wish to parse the file yourself, it helps that the OBJ file format is very simple. I reccomend taking an equally simple approach - just bring in all the vertices into a vertex buffer and create an index buffer to use. Then render using Vertex Buffer Objects / Index Buffer Objects and just draw indexed triangles.

Related

C++ library to obtain regular meshes from a 3D file format such as STL [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 5 years ago.
Improve this question
It seems there are some libraries including CGAL to generate meshes from a 2D or 3D model.
Question: In C++ environment, what is the best way to obtain a set of regular nodes to represent an object that is given by a 3d file format such as the STL?
To explain the question, let me provide an example. In a 2D case, a square can be represented by the set of '1's and the empty space can be by the set of '0's.
Is there any C++ library that can deal with this task?
00000000000000
00000111000000
00000111000000
00000111000000
00000000000000
Thank you in advance.
CGAL it self is already a very good option, if you can match the licenses (many modules are GPL or must pay a fee for proprietary use). This answer shows an example of use.
Another complete library is the Point Clouds Library (PCL) (license compatible with commercial). If your input data is ordered (like the one shown in the question) you can use the pcl::OrganizedFastMesh class.
If your data is un-ordered,
then a pcl::GreedyProjectionTriangulation may be better.
Finally, if using PCL, you can save your triangle mesh to STL using [pcl::io::savePolygonFileSTL](http://docs.pointclouds.org/1.7.0/group__io.html#ga3223bdca3003262efbd8c475d4ab7cc6].
As a final note, better than trying to find a library that exactly matches your input format, find a library that can generate the result you want and then accommodate your input and output to it through convertors. Of course, if your input doesn't provide the required data, such as normals, then you must either compute it previously or search for another method ;).

C++ utility for writing large image files [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 7 years ago.
Improve this question
I'm working on some finite element analysis code, and one of our commonly used troubleshooting tools is a graphical output of the large matrices that define the physical problem. However, as the problem sizes become large, the tools I've used in the past (libpng, libharu pdf) begin to take extremely long times to write the images to file.
My question: can anyone recommend a high-performance C++ image library, capable of outputting large images in some standard format (e.g. png, tiff, etc) efficiently? Furthermore, the matrices to be plotted are VERY sparse, meaning that most of the image canvas is actually empty; so although an image's resolution may be almost a gigapixel, there would be only about 20-30 pixels per row maximum.
I'd try http://www.openexr.com/
OpenEXR comes with an SDK for reading and writing. I/O never requires having the entire bitmap in memory.
libvips is a venerable image-processing library that specializes in exactly this problem.

Is there a raycasting library in C++ that is simple and open source? [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 looking for a library that will let me cast a ray into a scene model (it happens to be a terrain model in our case) and return the point of intersection in the scene. It does not have to be super-efficient (although I'd rather it not be super-inefficient). Ideally it would not have dependencies on other libraries (like OpenGL). I'm really looking for something that has just the functionality I need and no more.
Does anyone have any suggestions?
Unless there are other requirements you haven't revealed, use CGAL's AABB tree's support for ray intersections (example).
(Please, don't even think about using this if you're actually trying to do terrain rendering though... there are far more efficient algorithms for ray-casting height fields for the purpose of producing images e.g so-called voxel algorithms).

3D Graph plotting for C++ [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 6 years ago.
Improve this question
I need to plot my simulation (which I do in a C++ application) for use in a Latex document (so I would prefer some vector output like EPS). My function is of 2 arguments, so I am after a 3D plot, ideally with colouring indicating the function value (similar to what Mathematica does). Could anyone recommend any library?
Why not use gnuplot? I use it for this sort of thing. If you really need a library, then I'd look at gnuplot++
MathGL have large set of 1D (curves), 2D (surfaces) and 3D (volume) plot types. It also have export to EPS and parse some of TeX formulas.
Take a look at QwtPlot3d (http://qwtplot3d.sourceforge.net/), if you can use Qt in your project.
(Basically it is OpenGL rendering library, but AFAIK it has ability to produce EPS output)
PS.I had never used it, but have experience in QwtPlot (related 2d ploting library), and it is pretty well designed and flexible library.
Edit:
From features list of this library:
"..."
"- Vector output (PostScript, EPS and PDF) via gl2ps"
"..."

Plotting Library for OpenGL [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 7 years ago.
Improve this question
I need to draw a scientific graph (for example, a line or bar graph) and then render it in my application, which uses OpenGL for all display-related purposes.
What is the best way to do this?
Does anyone know of a plotting library for OpenGL?
I haven't been able to find one, and the best thing I've come up with so far is to use LibGD or PlPlot to render my image, save to PNG, and then load that same PNG as a texture for an OpenGL quad. Does anyone have any suggestions for a better way to to this, or know a library which could help with my task?
MathGL is cross-platform GPL plotting library which can use OpenGL for drawing (class mglGraphGL).
However it can produce a bitmap (or vector EPS/SVG) too. It is rather fast and don't require windows (can be run in console).
Rendering to PNG and using this as a texture is actually a reasonable way to solve your problem. If you need a "better" way, all depends on what you consider "better". If it's about scalable graphics, use the SVG output of PLPlot and render the vector shapes directly in OpenGL. If it's about avoiding intermediate files, you could extend PLPlot (LGPL licensed) to pass the data as a chunk in memory.