-2

I load an image (biological image scans) and want to a) display it and b) draw markers on it. How would I program the shaders? I guess the vertex shaders are simple enough, since it is an 2D image. On idea I had was to overwrite the image data in the buffer, the pixels with the markers set to a specific values. My markers are boxes (so lines), is this the right way to go? I read that there are different primitives, lines too, so is there a way to draw my lines on my image without manipulating the data in the buffer, simply an overlay, so to speak? My framework is vispy, but pseudocode would also help.

4

1 回答 1

1

用您的图像绘制一个矩形/正方形作为纹理。然后,绘制标记(可能是单调四边形/矩形)。

如果您希望线条在图像上方,但在标记下方,只需将渲染代码放在两者之间。

如果较旧的 OpenGL 适合您,则不需要着色器(因为 OpenGL 3.3 大多数旧的东西已移至兼容性配置文件,而现代功能是核心配置文件;后者需要自行编写的着色器,但它们对于您的情况应该很简单) .

总而言之,您需要了解的内容是图元(线、三角形)和基本纹理。

于 2015-06-10T18:56:54.800 回答