#include <stdio.h>
#include <stdlib.h>
#include <GL/glut.h>
#include <AR/config.h>
#include <AR/param.h>
#include <AR/ar.h>
#include <AR/gsub.h>
Go to the source code of this file.
Defines | |
#define | GL_ABGR GL_ABGR_EXT |
#define | GL_BGR GL_BGR_EXT |
#define | GL_BGRA GL_BGRA_EXT |
#define | GL_RGB GL_RGB_EXT |
#define | GL_RGBA GL_RGBA_EXT |
#define | GMINI 2 |
#define | LEFTEYE 1 |
#define | MINIWIN_MAX 8 |
#define | REVERSE_LR 1 |
#define | RIGHTEYE 2 |
Functions | |
void | argCleanup (void) |
Close the gsub library. | |
void | argConvGLcpara (ARParam *param, double gnear, double gfar, double m[16]) |
transform ARToolKit intrinsic camera parameters matrix format to an openGL matrix format. | |
static void | argConvGLcpara2 (double cparam[3][4], int width, int height, double gnear, double gfar, double m[16]) |
void | argConvGlpara (double para[3][4], double gl_para[16]) |
transform ARToolKit matrix format to an openGL matrix format. | |
void | argDispHalfImage (ARUint8 *image, int xwin, int ywin) |
display half of the video image. | |
static void | argDispHalfImageDrawPixels (ARUint8 *image, int xwin, int ywin) |
static void | argDispHalfImageTex (ARUint8 *image, int xwin, int ywin, int mode) |
void | argDispImage (ARUint8 *image, int xwin, int ywin) |
display the video image. | |
static void | argDispImageDrawPixels (ARUint8 *image, int xwin, int ywin) |
static void | argDispImageTex3 (ARUint8 *image, int xwin, int ywin, int mode) |
static void | argDispImageTex4 (ARUint8 *image, int xwin, int ywin, int mode) |
void | argDraw2dLeft (void) |
switch the rendering view to left eye (in 2D space) | |
void | argDraw2dRight (void) |
switch the rendering view to right eye (in 2D space) | |
void | argDraw3dCamera (int xwin, int ywin) |
switch the rendering view for 3D rendering mode. | |
void | argDraw3dLeft (void) |
switch the rendering view to left eye (in 3D space) | |
void | argDraw3dRight (void) |
switch the rendering view to right eye (in 3D space) | |
void | argDrawMode2D (void) |
switch the rendering context for 2D rendering mode. | |
void | argDrawMode3D (void) |
switch the rendering context for 3D rendering mode. | |
void | argDrawSquare (double vertex[4][2], int xwin, int ywin) |
draw a 2D square. | |
void | argInit (ARParam *cparam, double zoom, int fullFlag, int xwin, int ywin, int hmd_flag) |
Initialise the gsub library. | |
static void | argInit2 (int fullFlag) |
static void | argInitLoop (void) |
static void | argInitStencil (void) |
void | argInqSetting (int *hmdMode, int *gMiniXnum2, int *gMiniYnum2, void(**mouseFunc)(int button, int state, int x, int y), void(**keyFunc)(unsigned char key, int x, int y), void(**mainFunc)(void)) |
Get current configuration of gsub library. | |
void | argLineSeg (double x1, double y1, double x2, double y2, int xwin, int ywin) |
Draw a line. | |
void | argLineSegHMD (double x1, double y1, double x2, double y2) |
Draw a line with HMD mode. | |
void | argLoadHMDparam (ARParam *lparam, ARParam *rparam) |
initialize camera for HMD. | |
void | argMainLoop (void(*mouseFunc)(int button, int state, int x, int y), void(*keyFunc)(unsigned char key, int x, int y), void(*mainFunc)(void)) |
start the program main loop with specified callback functions. | |
static void | argSetStencil (int flag) |
void | argSwapBuffers (void) |
swap the rendering buffer. | |
Variables | |
int | argDrawMode = DEFAULT_DRAW_MODE |
define the draw configuration mode. | |
int | argTexmapMode = DEFAULT_DRAW_TEXTURE_IMAGE |
define the texture map configuration mode. | |
static ARParam | gCparam |
static int | gImXsize |
static int | gImYsize |
static void(* | gKeyFunc )(unsigned char key, int x, int y) |
static double | gl_cpara [16] |
static int | gl_hmd_flag = 0 |
static int | gl_hmd_para_flag = 0 |
static double | gl_lpara [16] |
static double | gl_rpara [16] |
static int | gl_stereo_flag = 0 |
static GLuint | glid [4] |
static void(* | gMainFunc )(void) |
static int | gMiniXnum |
static int | gMiniXsize |
static int | gMiniYnum |
static int | gMiniYsize |
static void(* | gMouseFunc )(int button, int state, int x, int y) |
static ARSParam | gsCparam |
static int | gWinXsize |
static int | gWinYsize |
static int | gXsize |
static int | gYsize |
static double | gZoom |
static GLint | maxRectangleTextureSize = 0 |
static int | tex1Xsize1 = 1 |
static int | tex1Xsize2 = 1 |
static int | tex1Ysize = 1 |
static int | tex2Xsize = 1 |
static int | tex2Ysize = 1 |
static int | useTextureRectangle = 0 |
static int | win |
#define GL_ABGR GL_ABGR_EXT |
Definition at line 22 of file lib/SRC/Gl/gsub.c.
#define GL_BGR GL_BGR_EXT |
Definition at line 28 of file lib/SRC/Gl/gsub.c.
#define GL_BGRA GL_BGRA_EXT |
Definition at line 25 of file lib/SRC/Gl/gsub.c.
#define GL_RGB GL_RGB_EXT |
Definition at line 34 of file lib/SRC/Gl/gsub.c.
#define GL_RGBA GL_RGBA_EXT |
Definition at line 31 of file lib/SRC/Gl/gsub.c.
#define GMINI 2 |
Definition at line 51 of file lib/SRC/Gl/gsub.c.
#define LEFTEYE 1 |
Definition at line 49 of file lib/SRC/Gl/gsub.c.
#define MINIWIN_MAX 8 |
Definition at line 47 of file lib/SRC/Gl/gsub.c.
#define REVERSE_LR 1 |
Definition at line 48 of file lib/SRC/Gl/gsub.c.
#define RIGHTEYE 2 |
Definition at line 50 of file lib/SRC/Gl/gsub.c.
void argCleanup | ( | void | ) |
Close the gsub library.
This function clean the rendering context (GLUT and openGL). Call in the exit of your program.
Definition at line 230 of file lib/SRC/Gl/gsub.c.
void argConvGLcpara | ( | ARParam * | param, |
double | gnear, | ||
double | gfar, | ||
double | m[16] | ||
) |
transform ARToolKit intrinsic camera parameters matrix format to an openGL matrix format.
XXXBK: not be sure of this function: this function must just convert 3x4 matrix to classical perspective openGL matrix. But in the code, you used arParamDecompMat that seem decomposed K and R,t, aren't it ? why do this decomposition since we want just intrinsic parameters ? and if not what is arDecomp ?
Returned value is generally use with a Projection Matrix.
param | |
gnear | near clipping plane value |
gfar | far clipping plane value |
m | the resulted openGL matrix |
Definition at line 1661 of file lib/SRC/Gl/gsub.c.
static void argConvGLcpara2 | ( | double | cparam[3][4], |
int | width, | ||
int | height, | ||
double | gnear, | ||
double | gfar, | ||
double | m[16] | ||
) | [static] |
Definition at line 1666 of file lib/SRC/Gl/gsub.c.
void argConvGlpara | ( | double | para[3][4], |
double | gl_para[16] | ||
) |
transform ARToolKit matrix format to an openGL matrix format.
simple conversion for the openGL matrix (16 values and homogeneous matrix). Returned value is generally use with a Model View Matrix.
para | the ARToolKit matrix |
gl_para | the resulted openGL matrix |
Definition at line 349 of file lib/SRC/Gl/gsub.c.
void argDispHalfImage | ( | ARUint8 * | image, |
int | xwin, | ||
int | ywin | ||
) |
display half of the video image.
Idem of argDispImage except than a quarter of the image is display (first left top quadrant, so size/2 in x and y).
image | image to display |
xwin | XXXBK |
ywin | XXXBK |
Definition at line 1235 of file lib/SRC/Gl/gsub.c.
static void argDispHalfImageDrawPixels | ( | ARUint8 * | image, |
int | xwin, | ||
int | ywin | ||
) | [static] |
Definition at line 1256 of file lib/SRC/Gl/gsub.c.
static void argDispHalfImageTex | ( | ARUint8 * | image, |
int | xwin, | ||
int | ywin, | ||
int | mode | ||
) | [static] |
Definition at line 1315 of file lib/SRC/Gl/gsub.c.
void argDispImage | ( | ARUint8 * | image, |
int | xwin, | ||
int | ywin | ||
) |
display the video image.
Display in the back-buffer the video image in argument. For doing AR video background, this function must be called before any rendering of 3D object.
image | image to display |
xwin | XXXBK |
ywin | XXXBK |
Definition at line 363 of file lib/SRC/Gl/gsub.c.
static void argDispImageDrawPixels | ( | ARUint8 * | image, |
int | xwin, | ||
int | ywin | ||
) | [static] |
Definition at line 397 of file lib/SRC/Gl/gsub.c.
static void argDispImageTex3 | ( | ARUint8 * | image, |
int | xwin, | ||
int | ywin, | ||
int | mode | ||
) | [static] |
Definition at line 854 of file lib/SRC/Gl/gsub.c.
static void argDispImageTex4 | ( | ARUint8 * | image, |
int | xwin, | ||
int | ywin, | ||
int | mode | ||
) | [static] |
Definition at line 637 of file lib/SRC/Gl/gsub.c.
void argDraw2dLeft | ( | void | ) |
switch the rendering view to left eye (in 2D space)
Combine with argDrawMode2D for rendering the left view.
Definition at line 290 of file lib/SRC/Gl/gsub.c.
void argDraw2dRight | ( | void | ) |
switch the rendering view to right eye (in 2D space)
Combine with argDrawMode2D for rendering the right view.
Definition at line 297 of file lib/SRC/Gl/gsub.c.
void argDraw3dCamera | ( | int | xwin, |
int | ywin | ||
) |
switch the rendering view for 3D rendering mode.
Update curent internal camera parameters for rendering in 3D space. this function complements argDrawMode3D.
xwin | length of rendering view (less than window length) |
ywin | width of rendering view (less than window width) |
Definition at line 331 of file lib/SRC/Gl/gsub.c.
void argDraw3dLeft | ( | void | ) |
switch the rendering view to left eye (in 3D space)
Update curent internal camera parameters for rendering in 3D space for left eye. this function complements argDrawMode3D.
Definition at line 310 of file lib/SRC/Gl/gsub.c.
void argDraw3dRight | ( | void | ) |
switch the rendering view to right eye (in 3D space)
Update curent internal camera parameters for rendering in 3D space for left eye. this function complements argDrawMode3D.
Definition at line 320 of file lib/SRC/Gl/gsub.c.
void argDrawMode2D | ( | void | ) |
switch the rendering context for 2D rendering mode.
Update curent camera parameters (internal and external) for rendering 2D or 3D objects in the view plane (like text or 2D shape). This function define an orthographic projection in the image plane. It not define opengl state for rendering in image space (like for a bitmap copy).
Definition at line 278 of file lib/SRC/Gl/gsub.c.
void argDrawMode3D | ( | void | ) |
switch the rendering context for 3D rendering mode.
Update curent camera parameters for rendering in 3D space. Generally call to reinializing model view matrix.
Definition at line 304 of file lib/SRC/Gl/gsub.c.
void argDrawSquare | ( | double | vertex[4][2], |
int | xwin, | ||
int | ywin | ||
) |
draw a 2D square.
Draw a square. The position of the square is affected by openGL model view matrix and call to argDrawMode2D argDrawMode3D. Generally call in a 2D mode (so after a argDrawMode2D).
vertex | corner of square. |
xwin | XXXBK |
ywin | XXXBK |
Definition at line 1521 of file lib/SRC/Gl/gsub.c.
Initialise the gsub library.
This function performs required initialisation of the gsub library. It must be called before any other argl*() functions are called.
cparam | the intrinsics parameters of the camera (used to defined openGL perspective matrix) |
zoom | defined a zoom parameter for the final result. |
fullFlag | full screen mode (1 enable, 0 disable). |
xwin | XXXBK. 0 if indifferent. |
ywin | XXXBK. 0 if indifferent. |
hmd_flag | enable stereo display mode (only interleaved configuration) |
Definition at line 120 of file lib/SRC/Gl/gsub.c.
static void argInit2 | ( | int | fullFlag | ) | [static] |
Definition at line 158 of file lib/SRC/Gl/gsub.c.
static void argInitLoop | ( | void | ) | [static] |
Definition at line 254 of file lib/SRC/Gl/gsub.c.
static void argInitStencil | ( | void | ) | [static] |
Definition at line 1583 of file lib/SRC/Gl/gsub.c.
void argInqSetting | ( | int * | hmdMode, |
int * | gMiniXnum2, | ||
int * | gMiniYnum2, | ||
void(**)(int button, int state, int x, int y) | mouseFunc, | ||
void(**)(unsigned char key, int x, int y) | keyFunc, | ||
void(**)(void) | mainFunc | ||
) |
Get current configuration of gsub library.
Retrieve current state of gsub library like the current callback functions.
hmdMode | the current hmdMode |
gMiniXnum2 | XXXBK |
gMiniYnum2 | XXXBK |
mouseFunc | the current mouse function callback |
keyFunc | the current key function callback |
mainFunc | the current main function callback |
Definition at line 106 of file lib/SRC/Gl/gsub.c.
void argLineSeg | ( | double | x1, |
double | y1, | ||
double | x2, | ||
double | y2, | ||
int | xwin, | ||
int | ywin | ||
) |
Draw a line.
Draw a segment.T The position of the line is affected by openGL model view matrix and call to argDrawMode2D argDrawMode3D. Generally call in a 2D mode (so after a argDrawMode2D).
x1 | x position of the first point. |
y1 | y position of the first point. |
x2 | x position of the second point. |
y2 | y position of the second point. |
xwin | XXXBK |
ywin | XXXBK |
Definition at line 1533 of file lib/SRC/Gl/gsub.c.
void argLineSegHMD | ( | double | x1, |
double | y1, | ||
double | x2, | ||
double | y2 | ||
) |
Draw a line with HMD mode.
Draw a segment in HMD mode.
x1 | x position of the first point. |
y1 | y position of the first point. |
x2 | x position of the second point. |
y2 | y position of the second point. |
Definition at line 1570 of file lib/SRC/Gl/gsub.c.
void argLoadHMDparam | ( | ARParam * | lparam, |
ARParam * | rparam | ||
) |
initialize camera for HMD.
Load in the display module the intrinsic parameters of the two view, i.e camera (identify to the eyes).
lparam | parameter of left camera |
rparam | parameter of right camera |
Definition at line 1638 of file lib/SRC/Gl/gsub.c.
void argMainLoop | ( | void(*)(int button, int state, int x, int y) | mouseFunc, |
void(*)(unsigned char key, int x, int y) | keyFunc, | ||
void(*)(void) | mainFunc | ||
) |
start the program main loop with specified callback functions.
This function is called in the entry block of a program. User specify the main callback of his program. Users should not put routines calls after this function, generally never accessible.
mouseFunc | the user mouse function can be NULL. |
keyFunc | the user keyboard function can be NULL. |
mainFunc | the user main update function can be NULL. |
Definition at line 242 of file lib/SRC/Gl/gsub.c.
static void argSetStencil | ( | int | flag | ) | [static] |
Definition at line 1647 of file lib/SRC/Gl/gsub.c.
void argSwapBuffers | ( | void | ) |
swap the rendering buffer.
Swap the back-buffer to the front-buffer. the pre-condition is that all the rendering functions have been called.
Definition at line 237 of file lib/SRC/Gl/gsub.c.
int argDrawMode = DEFAULT_DRAW_MODE |
define the draw configuration mode.
Define the draw mode for display of the video background. The possible values are :
Definition at line 53 of file lib/SRC/Gl/gsub.c.
int argTexmapMode = DEFAULT_DRAW_TEXTURE_IMAGE |
define the texture map configuration mode.
If the draw mode is AR_DRAW_BY_TEXTURE_MAPPING, you can configure the copy mode of the texture mapping. The possible values are :
Definition at line 54 of file lib/SRC/Gl/gsub.c.
Definition at line 57 of file lib/SRC/Gl/gsub.c.
int gImXsize [static] |
Definition at line 74 of file lib/SRC/Gl/gsub.c.
int gImYsize [static] |
Definition at line 74 of file lib/SRC/Gl/gsub.c.
void(* gKeyFunc)(unsigned char key, int x, int y) [static] |
Definition at line 79 of file lib/SRC/Gl/gsub.c.
double gl_cpara[16] [static] |
Definition at line 59 of file lib/SRC/Gl/gsub.c.
int gl_hmd_flag = 0 [static] |
Definition at line 64 of file lib/SRC/Gl/gsub.c.
int gl_hmd_para_flag = 0 [static] |
Definition at line 65 of file lib/SRC/Gl/gsub.c.
double gl_lpara[16] [static] |
Definition at line 62 of file lib/SRC/Gl/gsub.c.
double gl_rpara[16] [static] |
Definition at line 63 of file lib/SRC/Gl/gsub.c.
int gl_stereo_flag = 0 [static] |
Definition at line 66 of file lib/SRC/Gl/gsub.c.
GLuint glid[4] [static] |
Definition at line 76 of file lib/SRC/Gl/gsub.c.
void(* gMainFunc)(void) [static] |
Definition at line 80 of file lib/SRC/Gl/gsub.c.
int gMiniXnum [static] |
Definition at line 71 of file lib/SRC/Gl/gsub.c.
int gMiniXsize [static] |
Definition at line 72 of file lib/SRC/Gl/gsub.c.
int gMiniYnum [static] |
Definition at line 71 of file lib/SRC/Gl/gsub.c.
int gMiniYsize [static] |
Definition at line 72 of file lib/SRC/Gl/gsub.c.
void(* gMouseFunc)(int button, int state, int x, int y) [static] |
Definition at line 78 of file lib/SRC/Gl/gsub.c.
Definition at line 58 of file lib/SRC/Gl/gsub.c.
int gWinXsize [static] |
Definition at line 73 of file lib/SRC/Gl/gsub.c.
int gWinYsize [static] |
Definition at line 73 of file lib/SRC/Gl/gsub.c.
int gXsize [static] |
Definition at line 70 of file lib/SRC/Gl/gsub.c.
int gYsize [static] |
Definition at line 70 of file lib/SRC/Gl/gsub.c.
double gZoom [static] |
Definition at line 69 of file lib/SRC/Gl/gsub.c.
GLint maxRectangleTextureSize = 0 [static] |
Definition at line 91 of file lib/SRC/Gl/gsub.c.
int tex1Xsize1 = 1 [static] |
Definition at line 92 of file lib/SRC/Gl/gsub.c.
int tex1Xsize2 = 1 [static] |
Definition at line 93 of file lib/SRC/Gl/gsub.c.
int tex1Ysize = 1 [static] |
Definition at line 94 of file lib/SRC/Gl/gsub.c.
int tex2Xsize = 1 [static] |
Definition at line 95 of file lib/SRC/Gl/gsub.c.
int tex2Ysize = 1 [static] |
Definition at line 96 of file lib/SRC/Gl/gsub.c.
int useTextureRectangle = 0 [static] |
Definition at line 90 of file lib/SRC/Gl/gsub.c.
int win [static] |
Definition at line 75 of file lib/SRC/Gl/gsub.c.