| ARX 1.0 The next-generation open source augmented reality toolkit.

Loading...
Searching...
No Matches
arg.h
Go to the documentation of this file.
1/*
2 * arg.h
3 * artoolkitX
4 *
5 * Graphics Subroutines for artoolkitX.
6 *
7 * This file is part of artoolkitX.
8 *
9 * artoolkitX is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU Lesser General Public License as published by
11 * the Free Software Foundation, either version 3 of the License, or
12 * (at your option) any later version.
13 *
14 * artoolkitX is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public License
20 * along with artoolkitX. If not, see <http://www.gnu.org/licenses/>.
21 *
22 * As a special exception, the copyright holders of this library give you
23 * permission to link this library with independent modules to produce an
24 * executable, regardless of the license terms of these independent modules, and to
25 * copy and distribute the resulting executable under terms of your choice,
26 * provided that you also meet, for each linked independent module, the terms and
27 * conditions of the license of that module. An independent module is a module
28 * which is neither derived from nor based on this library. If you modify this
29 * library, you may extend this exception to your version of the library, but you
30 * are not obligated to do so. If you do not wish to do so, delete this exception
31 * statement from your version.
32 *
33 * Copyright 2018 Realmax, Inc.
34 * Copyright 2015 Daqri, LLC.
35 * Copyright 2011-2015 ARToolworks, Inc.
36 *
37 * Author(s): Philip Lamb
38 *
39 */
40
61#ifndef __arg_h__
62#define __arg_h__
63
64// ============================================================================
65// Public includes.
66// ============================================================================
67
68#include <ARX/AR/ar.h> // ARUint8, AR_PIXEL_FORMAT, ARParam, arParamObserv2Ideal()
69
70#ifdef __cplusplus
71 extern "C" {
72#endif
73
74// ============================================================================
75// Public types and definitions.
76// ============================================================================
77
78#ifdef _WIN32
79# ifdef ARG_STATIC
80# define ARG_EXTERN
81# else
82# ifdef ARX_EXPORTS
83# define ARG_EXTERN __declspec(dllexport)
84# else
85# define ARG_EXTERN __declspec(dllimport)
86# endif
87# endif
88#else
89# define ARG_EXTERN
90#endif
91
115 typedef struct _ARGL_CONTEXT_SETTINGS *ARGL_CONTEXT_SETTINGS_REF;
116
120 typedef enum {
121 ARG_API_None,
122 ARG_API_GL,
123 ARG_API_GL3,
124 ARG_API_GLES2
125} ARG_API;
126
127// ============================================================================
128// Public functions.
129// ============================================================================
130
163 ARG_EXTERN ARGL_CONTEXT_SETTINGS_REF arglSetupForCurrentContext(const ARParam *cparam, AR_PIXEL_FORMAT pixelFormat);
164
178 ARG_EXTERN int arglSetupDebugMode(ARGL_CONTEXT_SETTINGS_REF contextSettings, ARHandle *arHandle);
179
180
194 ARG_EXTERN void arglCleanup(ARGL_CONTEXT_SETTINGS_REF contextSettings);
195
228 ARG_EXTERN void arglDispImage(ARGL_CONTEXT_SETTINGS_REF contextSettings, int32_t viewport[4]);
229
248 ARG_EXTERN int arglDistortionCompensationSet(ARGL_CONTEXT_SETTINGS_REF contextSettings, int enable);
249
263 ARG_EXTERN int arglDistortionCompensationGet(ARGL_CONTEXT_SETTINGS_REF contextSettings, int *enable);
264
271 ARG_EXTERN int arglSetPixelZoom(ARGL_CONTEXT_SETTINGS_REF contextSettings, float zoom);
272
279 ARG_EXTERN int arglGetPixelZoom(ARGL_CONTEXT_SETTINGS_REF contextSettings, float *zoom);
280
299 ARG_EXTERN int arglPixelFormatSet(ARGL_CONTEXT_SETTINGS_REF contextSettings, AR_PIXEL_FORMAT format);
300
314 ARG_EXTERN int arglPixelFormatGet(ARGL_CONTEXT_SETTINGS_REF contextSettings, AR_PIXEL_FORMAT *format, int *size);
315
329 ARG_EXTERN int arglGetRotate90(ARGL_CONTEXT_SETTINGS_REF contextSettings);
330
347 ARG_EXTERN void arglSetRotate90(ARGL_CONTEXT_SETTINGS_REF contextSettings, int rotate90);
348
349 ARG_EXTERN int arglGetFlipH(ARGL_CONTEXT_SETTINGS_REF contextSettings);
350 ARG_EXTERN void arglSetFlipH(ARGL_CONTEXT_SETTINGS_REF contextSettings, int flipH);
351 ARG_EXTERN int arglGetFlipV(ARGL_CONTEXT_SETTINGS_REF contextSettings);
352 ARG_EXTERN void arglSetFlipV(ARGL_CONTEXT_SETTINGS_REF contextSettings, int flipV);
353
376 ARG_EXTERN int arglPixelBufferSizeSet(ARGL_CONTEXT_SETTINGS_REF contextSettings, int bufWidth, int bufHeight);
377
388 ARG_EXTERN int arglPixelBufferSizeGet(ARGL_CONTEXT_SETTINGS_REF contextSettings, int *bufWidth, int *bufHeight);
389
432 ARG_EXTERN int arglPixelBufferDataUploadBiPlanar(ARGL_CONTEXT_SETTINGS_REF contextSettings, ARUint8 *bufDataPtr0, ARUint8 *bufDataPtr1);
433#define arglPixelBufferDataUpload(contextSettings,bufDataPtr) arglPixelBufferDataUploadBiPlanar(contextSettings,bufDataPtr,NULL)
434
456 ARG_EXTERN int arglGLCapabilityCheck(ARGL_CONTEXT_SETTINGS_REF contextSettings, const uint16_t minVersion, const unsigned char *extension);
457
458#ifdef __cplusplus
459}
460#endif
461
462#endif // !__arg_h__
ar.h
artoolkitX core routines.
ARUint8
unsigned char ARUint8
Definition: ar.h:92
arglSetupForCurrentContext
ARG_EXTERN ARGL_CONTEXT_SETTINGS_REF arglSetupForCurrentContext(const ARParam *cparam, AR_PIXEL_FORMAT pixelFormat)
Initialise the arg library for the current OpenGL context.
Definition: arg.c:146
arglPixelBufferSizeGet
ARG_EXTERN int arglPixelBufferSizeGet(ARGL_CONTEXT_SETTINGS_REF contextSettings, int *bufWidth, int *bufHeight)
Query the size of pixel data buffers expected by arglPixelBufferDataUpload().
Definition: arg.c:429
arglSetPixelZoom
ARG_EXTERN int arglSetPixelZoom(ARGL_CONTEXT_SETTINGS_REF contextSettings, float zoom)
Set the current video image drawing scalefactor.
Definition: arg.c:263
arglGetFlipV
ARG_EXTERN int arglGetFlipV(ARGL_CONTEXT_SETTINGS_REF contextSettings)
Definition: arg.c:407
ARG_API
ARG_API
Underlying rendering API being used in implementation.
Definition: arg.h:120
ARG_API_GL
@ ARG_API_GL
OpenGL 1.5 or later.
Definition: arg.h:122
ARG_API_None
@ ARG_API_None
No API currently selected.
Definition: arg.h:121
ARG_API_GLES2
@ ARG_API_GLES2
OpenGL ES 2.0 or later.
Definition: arg.h:124
ARG_API_GL3
@ ARG_API_GL3
OpenGL 3.1 or later.
Definition: arg.h:123
arglPixelFormatSet
ARG_EXTERN int arglPixelFormatSet(ARGL_CONTEXT_SETTINGS_REF contextSettings, AR_PIXEL_FORMAT format)
Set the format of pixel data which will be passed to arglDispImage*()
Definition: arg.c:288
arglSetFlipV
ARG_EXTERN void arglSetFlipV(ARGL_CONTEXT_SETTINGS_REF contextSettings, int flipV)
Definition: arg.c:382
arglCleanup
ARG_EXTERN void arglCleanup(ARGL_CONTEXT_SETTINGS_REF contextSettings)
Free memory used by arg associated with the specified context.
Definition: arg.c:207
arglGLCapabilityCheck
ARG_EXTERN int arglGLCapabilityCheck(ARGL_CONTEXT_SETTINGS_REF contextSettings, const uint16_t minVersion, const unsigned char *extension)
Checks for the presence of an OpenGL capability by version or extension.
Definition: arg.c:461
ARGL_CONTEXT_SETTINGS_REF
struct _ARGL_CONTEXT_SETTINGS * ARGL_CONTEXT_SETTINGS_REF
Opaque type to hold ARGL settings for a given OpenGL context.
Definition: arg.h:115
arglSetupDebugMode
ARG_EXTERN int arglSetupDebugMode(ARGL_CONTEXT_SETTINGS_REF contextSettings, ARHandle *arHandle)
Provide an ARHandle structure from which to extract information about debug mode.
Definition: arg.c:201
arglSetRotate90
ARG_EXTERN void arglSetRotate90(ARGL_CONTEXT_SETTINGS_REF contextSettings, int rotate90)
Set or unset a 90 degree rotation in all OpenGL drawing performed by ARGL.
Definition: arg.c:320
arglGetFlipH
ARG_EXTERN int arglGetFlipH(ARGL_CONTEXT_SETTINGS_REF contextSettings)
Definition: arg.c:376
ARG_EXTERN
#define ARG_EXTERN
Definition: arg.h:89
arglPixelFormatGet
ARG_EXTERN int arglPixelFormatGet(ARGL_CONTEXT_SETTINGS_REF contextSettings, AR_PIXEL_FORMAT *format, int *size)
Get the format of pixel data in which arglDispImage*() is expecting data to be passed.
Definition: arg.c:304
arglDistortionCompensationGet
ARG_EXTERN int arglDistortionCompensationGet(ARGL_CONTEXT_SETTINGS_REF contextSettings, int *enable)
Enquire as to the enable state of camera lens distortion compensation in arglDispImage.
Definition: arg.c:256
arglGetRotate90
ARG_EXTERN int arglGetRotate90(ARGL_CONTEXT_SETTINGS_REF contextSettings)
Find out whether ARGL is rotating all OpenGL drawing by 90 degrees.
Definition: arg.c:345
arglSetFlipH
ARG_EXTERN void arglSetFlipH(ARGL_CONTEXT_SETTINGS_REF contextSettings, int flipH)
Definition: arg.c:351
arglPixelBufferDataUploadBiPlanar
ARG_EXTERN int arglPixelBufferDataUploadBiPlanar(ARGL_CONTEXT_SETTINGS_REF contextSettings, ARUint8 *bufDataPtr0, ARUint8 *bufDataPtr1)
Upload a buffer of pixel data to an OpenGL texture for later use by arglDispImage().
Definition: arg.c:445
arglDistortionCompensationSet
ARG_EXTERN int arglDistortionCompensationSet(ARGL_CONTEXT_SETTINGS_REF contextSettings, int enable)
Set compensation for camera lens distortion in arglDispImage to off or on.
Definition: arg.c:239
arglGetPixelZoom
ARG_EXTERN int arglGetPixelZoom(ARGL_CONTEXT_SETTINGS_REF contextSettings, float *zoom)
Retrieve the current video image drawing scalefactor.
Definition: arg.c:281
arglPixelBufferSizeSet
ARG_EXTERN int arglPixelBufferSizeSet(ARGL_CONTEXT_SETTINGS_REF contextSettings, int bufWidth, int bufHeight)
Specify a desired pixel buffer size larger than the camera image size.
Definition: arg.c:413
arglDispImage
ARG_EXTERN void arglDispImage(ARGL_CONTEXT_SETTINGS_REF contextSettings, int32_t viewport[4])
Display an ARVideo image, by drawing it using OpenGL.
Definition: arg.c:224
_ARGL_CONTEXT_SETTINGS
Definition: arg_private.h:48
_ARGL_CONTEXT_SETTINGS::flipH
int flipH
Definition: arg_private.h:56
_ARGL_CONTEXT_SETTINGS::flipV
int flipV
Definition: arg_private.h:57
_ARGL_CONTEXT_SETTINGS::zoom
float zoom
Definition: arg_private.h:53
_ARGL_CONTEXT_SETTINGS::rotate90
int rotate90
Definition: arg_private.h:55
ARHandle
Structure holding state of an instance of the square marker tracker.
Definition: ar.h:342
ARParam
Structure holding camera parameters, including image size, projection matrix and lens distortion para...
Definition: param.h:99