32 |
#include <vob/Types.hxx> |
#include <vob/Types.hxx> |
33 |
|
|
34 |
#include <vob/Vec23.hxx> |
#include <vob/Vec23.hxx> |
35 |
|
#include <vob/glerr.hxx> |
36 |
|
|
37 |
|
|
38 |
#ifndef VOB_DEFINED |
#ifndef VOB_DEFINED |
46 |
struct DrawPixels { |
struct DrawPixels { |
47 |
enum { NTrans = 1 }; |
enum { NTrans = 1 }; |
48 |
|
|
49 |
|
int w, h; |
50 |
|
Token format; |
51 |
|
Token type; |
52 |
|
GLubyte *bytes; |
53 |
|
|
54 |
template<class F> void params(F &f) { |
template<class F> void params(F &f) { |
55 |
|
f(w, h, format, type, bytes); |
56 |
|
} |
57 |
|
|
58 |
|
template<class T> void render(const T &t) const { |
59 |
|
glPushAttrib(GL_PIXEL_MODE_BIT); |
60 |
|
glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT); |
61 |
|
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); |
62 |
|
glPixelStorei(GL_UNPACK_ALIGNMENT, 1); |
63 |
|
ZPt p = t.transform(ZPt(0,0,0)); |
64 |
|
glRasterPos3f(p.x, p.y, p.z); |
65 |
|
glDrawPixels(w, h, format, type, bytes); |
66 |
|
GLERR |
67 |
|
glPopClientAttrib(); |
68 |
|
glPopAttrib(); |
69 |
} |
} |
70 |
}; |
}; |
71 |
|
VOB_DEFINED(DrawPixels); |
72 |
|
|
73 |
} |
} |
74 |
} |
} |