简体   繁体   English

OpenGL-在曲面上映射点

[英]OpenGL - Map points on a surface

I am looking for a technique in OpenGL that I can use in order to map color points on a surface. 我正在寻找在OpenGL的技术,我可以使用以便在表面上绘制色点。 Each point is defining a display color and three coordinates (X, Y, Z). 每个点定义一个显示颜色和三个坐标(X,Y,Z)。 The surface on which to map those data is built from all the points' coordinates in the main usage (complex shape) but can be built normally from standard shape such as a cone or a sphere. 在主要用途(复杂形状)中,根据所有点的坐标构建用于映射这些数据的表面,但通常可以从圆锥或球体等标准形状构建。 Since there are voids between the points (for example one millimeter step between two points along the X axis), it would be also needed to interpolate the points data on the surface. 由于这些点之间存在空隙(例如,沿X轴的两个点之间有1毫米的台阶),因此还需要在表面上插入点数据。 I am thinking about building bitmaps from the points and then applying those bitmaps on my surfaces but I am wondering if OpenGL does have a feature that allow to do that in a "smart way". 我正在考虑从这些点构建位图,然后在我的表面上应用这些位图,但是我想知道OpenGL是否具有允许以“智能方式”执行此操作的功能。

It sounds to me like what you are asking for is basic OpenGl behaviour. 在我看来,您所要求的是基本的OpenGl行为。

If you draw a triangle: 如果绘制三角形:

glBegin(GL_TRIANGLES);     
    glColor3f(1.0f,0.0f,0.0f);     // Red
    glVertex3f( 0.0f, 1.0f, 0.0f); // Top vertex
    glColor3f(0.0f,1.0f,0.0f);     // Green
    glVertex3f(-1.0f,-1.0f, 0.0f); // Bottom left vertex
    glColor3f(0.0f,0.0f,1.0f);     // Blue
    glVertex3f( 1.0f,-1.0f, 0.0f); // Bottom right vertex
glEnd();  

The result is a smoothly ( if garishly) coloured solid triangle. 结果是一个平滑的(如果是扎眼的)彩色实心三角形。

So your problem is to construct a series of polygons (possibly just triangles) which cover your surface and have the point set as vertices. 因此,您的问题是构造一系列覆盖您的表面并将点设置为顶点的多边形(可能只是三角形)。

For a great intro to OpenGl, see NeHe's tutorials , including the above example. 有关OpenGl的详细介绍,请参见NeHe的教程 ,包括上面的示例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM