4 #ifndef KJB_CPP_OPENGL_H
5 #define KJB_CPP_OPENGL_H
40 template <
size_t M,
size_t N,
bool Transposed>
99 #ifdef KJB_HAVE_OPENGL
162 void glcolormask(
bool b1,
bool b2,
bool b3,
bool b4);
339 const std::string& s,
399 virtual void gl_call()
const = 0;
406 #ifdef KJB_HAVE_OPENGL
417 GLenum error = glGetError(); \
420 KJB_THROW_2(::kjb::opengl::Opengl_error, error); \
432 GLenum error = glGetError(); \
435 std:: cout << "Opengl error: " << gluErrorString(error) << std::endl; \
446 Opengl_error(
unsigned int error_code,
const char* file,
int line);
448 Opengl_error(
unsigned int error_code,
const std::string& msg,
const char* file,
int line);
453 Opengl_error(
const std::string& msg,
const char* file,
int line);
455 unsigned int get_code() {
return code_; }
Definition: gr_opengl.h:41
Vector_d< 4 > Vector4
Definition: gr_opengl.h:38
void set_framebuffer(const Image &img)
Puts the contents of an image into the framebuffer.
Definition: gr_opengl.cpp:750
Matrix_d< 4, 4, false > Matrix4
Definition: gr_opengl.h:41
size_t get_viewport_height()
Get current GL viewport height.
Definition: gr_opengl.cpp:587
Matrix get_projection_matrix()
Returns a copy of the current projection matrix.
Definition: gr_opengl.cpp:621
Vector_d< 3 > Vector3
Definition: g_quaternion.h:37
void glRotate(const kjb::Quaternion &q)
glRotate for a kjb::Quaternion.
Definition: gr_opengl.cpp:96
This class implements matrices, in the linear-algebra sense, restricted to integer-valued elements...
Definition: l_int_matrix.h:71
void glClearDepthBuffer()
Definition: gr_opengl.cpp:501
Definition: gr_opengl.h:396
height
Definition: APPgetLargeConnectedEdges.m:33
void gluBuild2DMipmaps(const Image &img)
NEEDS COMMENTING!!!.
Definition: gr_opengl.cpp:305
Vector unproject(const Vector &vertex)
Unproject a point from screen coordinates to world coordinates.
Definition: gr_opengl.cpp:680
This class implements vectors, in the linear-algebra sense, with real-valued elements.
Definition: m_vector.h:87
void default_init_opengl(unsigned int width, unsigned int height)
Initializes OpenGL in a standard way.
Definition: gr_opengl.cpp:560
void glMultMatrix(const Matrix &m)
glMultMatrix for a kjb::Matrix.
Definition: gr_opengl.cpp:290
Vector gluUnProject(const Vector &vertex, double *modelview, double *projection, int *viewport)
Wraps gluUnproject using kjb::Vertex.
Definition: gr_opengl.cpp:384
size_t get_viewport_width()
Get current GL viewport width.
Definition: gr_opengl.cpp:575
void glVertex(const Vector &p)
glVertex for a kjb::Vector.
Definition: gr_opengl.cpp:136
void render_xy_plane_grid(double xmin, double xmax, double ymin, double ymax, double csz)
Draw a grid representing the ground plane.
Definition: gr_opengl.cpp:1267
REAL xmin
Definition: triangle.c:649
void move_in_plane(kjb::Vector3 &plane_pt, const kjb::Vector2 &new_pt)
Translate a point so it projects to a screen point.
Definition: gr_opengl.cpp:1108
Definition: g_quaternion.h:40
void render_xz_plane_grid(double xmin, double xmax, double zmin, double zmax, double csz)
Draw a grid representing the ground plane.
Definition: gr_opengl.cpp:1233
x
Definition: APPgetLargeConnectedEdges.m:100
virtual void gl_call() const =0
void glEnableLineSmooth()
Definition: gr_opengl.cpp:542
void draw_full_screen_quad(float z)
Definition: gr_opengl.cpp:699
void glcolormask(bool b1, bool b2, bool b3, bool b4)
Definition: gr_opengl.cpp:510
Wrapped version of the C struct Pixel, with Alpha (opacity).
Definition: i_pixel.h:57
REAL ymax
Definition: triangle.c:649
void get_framebuffer_as_matrix(size_t x, size_t y, size_t width, size_t height, Matrix &result)
Definition: gr_opengl.cpp:973
void glTranslate(const kjb::Vector &p)
glTranslate for a kjb::Vector.
Definition: gr_opengl.cpp:108
void glTexImage2D(const Image &img)
Copy kjb::Image into an opengl texture.
Definition: gr_opengl.cpp:339
void glDisableLineSmooth()
Definition: gr_opengl.cpp:551
void glColor(const Vector &color)
glColor for a kjb::Vector.
Definition: gr_opengl.cpp:196
void glLoadMatrix(const Matrix &m)
glLoadMatrix for a kjb::Matrix.
Definition: gr_opengl.cpp:236
void glOrtho(Matrix &state, double left, double right, double bottom, double top, double znear, double zfar)
Definition: gr_opengl.cpp:475
REAL ymin
Definition: triangle.c:649
Int_matrix get_framebuffer_as_int_matrix()
Read pixels from opengl's whole back-buffer into a int matrix.
Definition: gr_opengl.cpp:1031
Definition: g_quaternion.h:37
Vector project(const Vector &x)
Computes the window coordinates of the given point using current GL state.
Definition: gr_opengl.cpp:632
This class implements matrices, in the linear-algebra sense, with real-valued elements.
Definition: m_matrix.h:94
Matrix get_modelview_matrix()
Returns a copy of the current modelview matrix.
Definition: gr_opengl.cpp:610
for m
Definition: APPgetLargeConnectedEdges.m:64
void bitmap_string(const std::string &s, double x, double y, void *font)
Draws a bitmap string at the specified location.
Definition: gr_opengl.cpp:1081
Support for error handling exception classes in libKJB.
Wrapped version of the C struct KJB_image.
Definition: i_image.h:76
Image get_framebuffer_as_image()
Read pixels from opengl's whole back-buffer into an image.
Definition: gr_opengl.cpp:598
Vector_d< 2 > Vector2
Definition: gr_opengl.h:35
REAL xmax
Definition: triangle.c:649
void gluLookAt(Matrix &M, const Vector &eye, const Vector &target, const Vector &up)
Computes a gluLookAt matrix and multiplies it by the given matrix.
Definition: gr_opengl.cpp:400
Object thrown when computation fails somehow during execution.
Definition: l_exception.h:321
void get_depth_buffer_as_matrix(size_t x, size_t y, size_t width, size_t height, Matrix &result)
Definition: gr_opengl.cpp:988
void get_backprojection_line(const Vector2 &pt, Vector3 &line_pt, Vector3 &line_dir)
Get backprojection line using current opengl state.
Definition: gr_opengl.cpp:1199
bool has_stencil_buffer()
Returns true if OpenGL version supports stencil buffer (right?).
Definition: gr_opengl.cpp:726