C - 显示不断更新图像
C++ - Display continuously updating image
我已经在C 中写了一个病理,现在我想实时显示渲染过程,所以我想知道最简单/最佳的方法是什么。p>基本上,渲染的图像更新在每次迭代后都需要检索,在单独的窗口中显示并进行更新。
我正在考虑使用DirectX,看来我也可以使用OpenCV来做,但是我只是在寻找一种简单的方法,而不需要添加很多新代码。
我在Windows上使用C 。
如果我正确理解您的路径示踪剂可能会输出每个发射射线的颜色?如果是这种情况,您正在考虑在单独的窗口中显示渲染图像,我建议使用SDL2。使用C 和SDL的实时图形有很多教程。
摘录摘自SDL_SURFACE的官方SDL文档(不需要Cruft以初始化Windows的初始化),您可能会使用:
/* This is meant to show how to edit a surface's pixels on the CPU, but
normally you should use SDL_FillRect() to wipe a surface's contents. */
void WipeSurface(SDL_Surface *surface)
{
/* This is fast for surfaces that don't require locking. */
/* Once locked, surface->pixels is safe to access. */
SDL_LockSurface(surface);
/* This assumes that color value zero is black. Use
SDL_MapRGBA() for more robust surface color mapping! */
/* height times pitch is the size of the surface's whole buffer. */
SDL_memset(surface->pixels, 0, surface->h * surface->pitch);
SDL_UnlockSurface(surface);
}
相关文章:
- 从C++本机插件更新Vector3数组
- C++,OpenCV,尝试显示图像时"OpenCV(4.3.0) Error: Assertion failed (size.width>0 && size.height>0)"此错误
- QGraphicsPolygonItem在拖动时未更新QPolygonF坐标
- 如何使用OpenCV将RBG图像转换为HSV,并将H、S和V值保存为C++中的3个独立图像
- OpenCV EqualizeHist()从彩色图像创建黑白图像
- 将"打开的CV图像"中的"颜色"转换为整数格式
- 平均图像时图像损坏
- 在C++中使用GDAL可以将图像的像素坐标转换为lat,long吗
- 如何使用按钮更新GTK3图像以使用C++从相机捕获图片
- DXGI API:AcquireTextFrame()从不抓取更新的图像,始终为空
- QT QML 中的 OpenGL,无法更新屏幕上的图像
- 使用更新功能扩展QML图像类型
- 将图像字段作为斑点类型更新为QT C 中的数据库
- C - 显示不断更新图像
- 在Qt/QML中的每一帧更新图像时运行时崩溃
- GtkImage 没有更新,opencv 也不会释放图像
- 如何同步每20毫秒更新一次的接收图像
- QML图像在源更改后未更新
- 更新itk图像在Qt用户界面
- 我如何更新这个神经网络来使用图像像素数据