Drawing "point" forms in OpenGL, indifferent to scaling

I work with the Qt and QWt3D Plotting tools and extend them to provide some of the 3-D and 2-D build functionality I need, so I learn OpenGL in this process.

Currently, I can build points using OpenGL, but only as circles (or "squares", turning off anti-aliasing). These points act as I like - i.e. They do not change size as they increase, although their x / y / z locations move accordingly when I zoom in, pan, etc.

What I would like to do is point the graph using a lot of shapes (^, <,>, *,., Etc.). From what I understand in OpenGL (it’s not so much), it’s not so simple, because OpenGL considers everything as a “real” three-dimensional object, therefore scaling in any form openGL, but the “point” changes the object, the projected size.

After some reading, I think there are (at least) 2 possible solutions to this problem:

  • Use OpenGL textures. It doesn't seem complicated, but I believe that texture images will increase and decrease as they scale up - is that right?

  • Use OpenGL polygons, lines, etc. and draw *, triangles or whatever. But here I am again faced with the same problem - how can I prevent OpenGL from redefining points as it grows?

Is the solution just to bite the bullet and re-draw the entire dataset every time the user zooms in or out to make sure the points remain the same? Is there a way to just tell openGL so as not to recount the size of the object?

Sorry if this is somewhere in the OpenGL document - I could not find it.

+3
source share
3 answers

What you want is called a point sprite. OpenGL1.4 supports them through the extension ARB_point_sprite.

Try this tutorial

http://www.ploksoftware.org/ExNihilo/pages/Tutorialpointsprite.htm

and look what you are looking for.

+8
source

, , , .

, . , , , , , . , . , - , , , , .

, , - . /p >

project 3D-, 2D-. . . , gluProject , , , , .

!

+2

There is no easy way to do what you want to do. You will have to dynamically resize the primitives you draw, depending on the current camera zoom. You can use a technique known as billboarding to make sure your objects are always facing the camera.

0
source

Source: https://habr.com/ru/post/1708132/


All Articles