OpenGL-在屏幕上绘制像素? [英] OpenGL - draw pixels to screen?

查看:62
本文介绍了OpenGL-在屏幕上绘制像素?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用OpenGL在屏幕上尽可能快地绘制2D像素数据数组(RGB/灰度值).像素数据经常变化.

I want to draw a 2D array of pixel data (RGB / grayscale values) on the screen as fast as possible, using OpenGL. The pixel data changes frequently.

我曾经希望我能找到一个简单的函数,让我将一个指针推入代表像素数据的数组,因为这可能是最快的方法.不幸的是,我没有找到这样的功能.

I had hoped that I would find a simple function that would let me push in a pointer to an array representing the pixel data, since this is probably the fastest approach. Unfortunately, I have found no such function.

完成此任务的最佳方法是什么?

What is the best way to accomplish this task?

推荐答案

也许 glDrawPixels 是您要寻找的功能吗?尽管如果数据是静态的,最好使用它创建一个纹理,然后在每个帧上绘制该纹理.

Maybe glDrawPixels is the function you are looking for? Though if the data is static it would be better to create a texture with it, and then draw that each frame.

这篇关于OpenGL-在屏幕上绘制像素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆