【发布时间】:2010-09-20 13:37:27
【问题描述】:
如何用 OpenGL glDrawPixels() 绘制以下动态 3D 数组? 你可以在这里找到文档:http://opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/drawpixels.html
float ***array3d;
void InitScreenArray()
{
int i, j;
int screenX = scene.camera.vres;
int screenY = scene.camera.hres;
array3d = (float ***)malloc(sizeof(float **) * screenX);
for (i = 0 ; i < screenX; i++) {
array3d[i] = (float **)malloc(sizeof(float *) * screenY);
for (j = 0; j < screenY; j++)
array3d[i][j] = (float *)malloc(sizeof(float) * /*Z_SIZE*/ 3);
}
}
我只能使用以下头文件:
#include <math.h>
#include <stdlib.h>
#include <windows.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glut.h>
【问题讨论】:
-
是的,但这只是我无法解决的商场部分。整个作业将是一个光线追踪器,这个结构存储屏幕像素。
标签: c++ arrays opengl graphics