#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include "glwin.h"
#include <X11/Xlib.h>
#include <X11/keysym.h>
#include <X11/Xatom.h>
#include <GL/glx.h>
#include <GL/gl.h>
Go to the source code of this file.
Compounds | |
struct | glsl_shader |
struct | glwin_ext_fctns |
struct | glwin_fbo_target |
struct | glwin_warp_hmd |
struct | oglhandle |
struct | spaceballevent |
struct | spaceballhandle |
Defines | |
#define | USEOPENGL |
#define | GL_GLEXT_PROTOTYPES 1 |
#define | GLX_GLXEXT_PROTOTYPES 1 |
#define | SBALL_COMMAND_NONE 0 |
#define | SBALL_COMMAND_APP_WINDOW 27695 |
#define | SBALL_COMMAND_APP_SENSITIVITY 27696 |
#define | HMD_DIVCNT 10 |
#define | SPHEREMAXRES 64 |
Typedefs | |
typedef void(APIENTRY * | glwin_fctnptr )(void) |
Functions | |
int | glx_query_extension (Display *dpy, const char *extname) |
void | quat_rot_matrix (float *m, const float *q) |
void * | glwin_get_procaddress (const char *procname) |
void | glwin_init_exts (void *voidhandle) |
spaceballhandle * | spaceball_attach (Display *dpy, Window win) |
void | spaceball_close (spaceballhandle *handle) |
int | spaceball_decode_event (spaceballhandle *handle, const XEvent *xev, spaceballevent *sballevent) |
void | spaceball_init_event (spaceballevent *sballevent) |
void | spaceball_clear_event (spaceballevent *sballevent) |
oglhandle * | glwin_alloc_init (void) |
void * | glwin_create (const char *wintitle, int width, int height) |
void | glwin_destroy (void *voidhandle) |
void | glwin_swap_buffers (void *voidhandle) |
int | glwin_handle_events (void *voidhandle, int evblockmode) |
int | glwin_resize (void *voidhandle, int width, int height) |
int | glwin_reposition (void *voidhandle, int xpos, int ypos) |
int | glwin_fullscreen (void *voidhandle, int fson, int xinescreen) |
int | glwin_query_extension (const char *extname) |
int | glwin_query_vsync (void *voidhandle, int *onoff) |
int | glwin_fbo_target_bind (void *voidhandle, void *voidtarget) |
int | glwin_fbo_target_unbind (void *voidhandle, void *voidtarget) |
int | glwin_fbo_target_destroy (void *voidhandle, void *voidtarget) |
int | glwin_fbo_target_resize (void *voidhandle, void *voidtarget, int wsx, int wsy) |
void * | glwin_fbo_target_create (void *voidhandle, int wsx, int wsy) |
int | glwin_fbo_target_draw_normal (void *voidhandle, void *voidtarget) |
int | glwin_fbo_target_draw_fbo (void *voidhandle, void *voidtarget, int wsx, int wsy) |
void | hmd_compute_warped_coords (int divcnt, int wsx, int wsy, float rscale, float wscale, float *xcrds, float *ycrds, const float *user_distort_coeff5) |
void | hmd_draw_eye_lines (int divcnt, int xoff, int width, int height, float *xcrds, float *ycrds) |
void | hmd_draw_eye_texquads (int divcnt, int xoff, int width, int height, float *xcrds, float *ycrds) |
void | glwin_spheremap_update_hmd_warp (void *vwin, void *voidwarp, int wsx, int wsy, int warpdivs, int ixs, int iys, const float *barrel_coeff, int force) |
void | glwin_spheremap_destroy_hmd_warp (void *vwin, void *voidwarp) |
void * | glwin_spheremap_create_hmd_warp (void *vwin, int wsx, int wsy, int wrot, int warpdivs, int ixs, int iys, const float *user_coeff) |
int | glwin_spheremap_draw_hmd_warp (void *vwin, void *voidwarp, int drawimage, int drawlines, int chromcorr, int wsx, int wsy, int ixs, int iys, const float *hmdquat, float fov, float rad, int hmd_spres) |
void | glwin_print_glsl_infolog (void *voidhandle, GLhandleARB obj, const char *msg) |
int | glwin_compile_shaders (void *voidhandle, glsl_shader *sh, const GLubyte *vertexShader, const GLubyte *fragmentShader, int verbose) |
int | glwin_destroy_shaders (void *voidhandle, glsl_shader *sh) |
int | glwin_compile_hmd_shaders (void *voidhandle, glsl_shader *sh) |
void | glwin_draw_image (void *voidhandle, int ixs, int iys, unsigned char *img) |
void | glwin_draw_image_rgb3u (void *voidhandle, int stereomode, int ixs, int iys, const unsigned char *rgb3u) |
void | glwin_draw_image_tex_rgb3u (void *voidhandle, int stereomode, int ixs, int iys, const unsigned char *rgb3u) |
void | glwin_draw_sphere_tex (float rad, int res, float txlatstart, float txlatend) |
void | glwin_spheremap_draw_prepare (void *voidhandle) |
void | glwin_spheremap_upload_tex_rgb3u (void *voidhandle, int ixs, int iys, const unsigned char *rgb3u) |
void | glwin_spheremap_draw_tex (void *voidhandle, int stereomode, int ixs, int iys, const float *hmdquat, float fov, float rad, int res) |
int | glwin_get_wininfo (void *voidhandle, int *instereo, int *havestencil) |
int | glwin_get_winsize (void *voidhandle, int *xsize, int *ysize) |
int | glwin_get_winpos (void *voidhandle, int *xpos, int *ypos) |
int | glwin_get_mousepointer (void *voidhandle, int *x, int *y) |
int | glwin_get_lastevent (void *voidhandle, int *evdev, int *evval, char *evkey) |
int | glwin_spaceball_available (void *voidhandle) |
int | glwin_get_spaceball (void *voidhandle, int *rx, int *ry, int *rz, int *tx, int *ty, int *tz, int *buttons) |
Variables | |
const char * | hmd_vert |
const char * | hmd_frag |
|
|
|
|
|
|
|
|
|
Definition at line 520 of file glwin.c. Referenced by spaceball_attach. |
|
|
|
Definition at line 3013 of file glwin.c. Referenced by glwin_draw_sphere_tex. |
|
|
|
|
|
Definition at line 647 of file glwin.c. References oglhandle::dpy, oglhandle::evdev, oglhandle::ext, GLWIN_EV_NONE, oglhandle::havefocus, oglhandle::havestencil, oglhandle::instereo, NULL, oglhandle::root, and oglhandle::scrnum. Referenced by glwin_create. |
|
Definition at line 2838 of file glwin.c. References glwin_compile_shaders, hmd_frag, and hmd_vert. |
|
Definition at line 2684 of file glwin.c. References oglhandle::ext, glsl_shader::FragmentShaderObject, GLATTACHOBJECTARB, GLCOMPILESHADERARB, GLDELETEOBJECTARB, GLGETOBJECTPARAMETERIVARB, GLLINKPROGRAMARB, GLSHADERSOURCEARB, GLWIN_ERROR, glwin_print_glsl_infolog, GLWIN_SUCCESS, glsl_shader::isvalid, length, NULL, glsl_shader::ProgramObject, and glsl_shader::VertexShaderObject. Referenced by glwin_compile_hmd_shaders. |
|
|
Definition at line 1026 of file glwin.c. References oglhandle::dpy, oglhandle::ext, NULL, oglhandle::sball, spaceball_close, and oglhandle::win. |
|
Definition at line 2762 of file glwin.c. References oglhandle::ext, GLDELETEOBJECTARB, GLWIN_ERROR, GLWIN_SUCCESS, glsl_shader::isvalid, and glsl_shader::ProgramObject. |
|
Definition at line 2847 of file glwin.c. References glwin_swap_buffers. |
|
Definition at line 2854 of file glwin.c. References glwin_get_winsize, GLWIN_STEREO_OVERUNDER, and glwin_swap_buffers. |
|
Definition at line 2900 of file glwin.c. References glwin_get_winsize, GLWIN_STEREO_OVERUNDER, and glwin_swap_buffers. |
|
Definition at line 3014 of file glwin.c. References SPHEREMAXRES. |
|
Definition at line 2088 of file glwin.c. References oglhandle::ext, glwin_fbo_target::fbo, GLWIN_ERROR, GLWIN_SUCCESS, and NULL. |
|
Definition at line 2163 of file glwin.c. References glwin_fbo_target::depth, glwin_fbo_target::drawbufs, oglhandle::ext, glwin_fbo_target::fbo, GLWIN_ERROR, glwin_fbo_target_destroy, glwin_fbo_target_resize, glwin_ext_fctns::hasglfborendertarget, NULL, and glwin_fbo_target::tex. |
|
Definition at line 2114 of file glwin.c. References glwin_fbo_target::depth, oglhandle::ext, glwin_fbo_target::fbo, GLWIN_ERROR, GLWIN_SUCCESS, NULL, and glwin_fbo_target::tex. |
|
Definition at line 2258 of file glwin.c. References GLWIN_ERROR, glwin_fbo_target_unbind, GLWIN_SUCCESS, NULL, and glwin_fbo_target::tex. |
|
Definition at line 2245 of file glwin.c. References oglhandle::ext, GLWIN_ERROR, GLWIN_SUCCESS, and NULL. |
|
Definition at line 2130 of file glwin.c. References glwin_fbo_target::depth, glwin_fbo_target::drawbufs, oglhandle::ext, glwin_fbo_target::fbo, GLWIN_ERROR, GLWIN_SUCCESS, NULL, and glwin_fbo_target::tex. |
|
Definition at line 2101 of file glwin.c. References oglhandle::ext, GLWIN_ERROR, GLWIN_SUCCESS, and NULL. |
|
Definition at line 1283 of file glwin.c. References oglhandle::dpy, oglhandle::root, and oglhandle::win. |
|
Definition at line 3256 of file glwin.c. References oglhandle::evdev, oglhandle::evkey, oglhandle::evval, and NULL. |
|
Definition at line 3241 of file glwin.c. References oglhandle::mousex, oglhandle::mousey, and NULL. |
|
Definition at line 350 of file glwin.c. References NULL. Referenced by glwin_init_exts. |
|
Definition at line 3285 of file glwin.c. References spaceballevent::buttons, spaceballevent::event, NULL, spaceballevent::rx, spaceballevent::ry, spaceballevent::rz, oglhandle::sball, oglhandle::sballevent, spaceballevent::tx, spaceballevent::ty, and spaceballevent::tz. |
|
Definition at line 3186 of file glwin.c. References oglhandle::havestencil, oglhandle::instereo, and NULL. |
|
Definition at line 3226 of file glwin.c. References NULL, oglhandle::xpos, and oglhandle::ypos. |
|
Definition at line 3201 of file glwin.c. References oglhandle::dpy, oglhandle::height, NULL, oglhandle::width, and oglhandle::win. |
|
|
|
Definition at line 2658 of file glwin.c. References oglhandle::ext, GLGETINFOLOGARB, GLGETOBJECTPARAMETERIVARB, and NULL. Referenced by glwin_compile_shaders. |
|
|
|
Definition at line 2038 of file glwin.c. References oglhandle::dpy, oglhandle::ext, GLWIN_ERROR, GLWIN_NOT_IMPLEMENTED, GLWIN_SUCCESS, glx_query_extension, glwin_ext_fctns::hasgetvideosyncsgi, and NULL. |
|
Definition at line 1260 of file glwin.c. References oglhandle::dpy, NULL, and oglhandle::win. |
|
Definition at line 1245 of file glwin.c. References oglhandle::dpy, NULL, and oglhandle::win. |
|
Definition at line 3274 of file glwin.c. References NULL, and oglhandle::sball. |
|
Definition at line 2553 of file glwin.c. References glwin_fbo_target_create, glwin_spheremap_update_hmd_warp, glwin_warp_hmd::hmd_fbo, and glwin_warp_hmd::wrot. |
|
Definition at line 2528 of file glwin.c. References glwin_warp_hmd::Bxcrds, glwin_warp_hmd::Bycrds, glwin_fbo_target_destroy, glwin_warp_hmd::Gxcrds, glwin_warp_hmd::Gycrds, glwin_warp_hmd::hmd_fbo, NULL, glwin_warp_hmd::Rxcrds, glwin_warp_hmd::Rycrds, glwin_warp_hmd::xcrds, and glwin_warp_hmd::ycrds. |
|
|
|
|
Definition at line 3132 of file glwin.c. References glwin_draw_sphere_tex, glwin_get_winsize, GLWIN_STEREO_OVERUNDER, n, NULL, and quat_rot_matrix. |
|
|
|
|
Definition at line 1061 of file glwin.c. References oglhandle::dpy, NULL, and oglhandle::win. |
|
Definition at line 297 of file glwin.c. Referenced by glwin_init_exts, and glwin_query_vsync. |
|
Definition at line 2292 of file glwin.c. Referenced by glwin_spheremap_update_hmd_warp. |
|
Definition at line 2348 of file glwin.c. Referenced by glwin_spheremap_draw_hmd_warp. |
|
Definition at line 2386 of file glwin.c. Referenced by glwin_spheremap_draw_hmd_warp. |
|
Definition at line 323 of file glwin.c. Referenced by glwin_spheremap_draw_tex, HMDMgr::rot_basis_quat, and HMDMgr::rot_point_quat. |
|
Definition at line 524 of file glwin.c. References spaceballhandle::drv_win, spaceballhandle::ev_button_press, spaceballhandle::ev_button_release, spaceballhandle::ev_command, spaceballhandle::ev_motion, NULL, and SBALL_COMMAND_APP_WINDOW. Referenced by glwin_create. |
|
Definition at line 635 of file glwin.c. References spaceballevent::event, spaceballevent::period, spaceballevent::rx, spaceballevent::ry, spaceballevent::rz, spaceballevent::tx, spaceballevent::ty, and spaceballevent::tz. |
|
|
|
Definition at line 594 of file glwin.c. References spaceballevent::buttons, spaceballhandle::ev_button_press, spaceballhandle::ev_button_release, spaceballhandle::ev_motion, spaceballevent::event, NULL, spaceballevent::period, spaceballevent::rx, spaceballevent::ry, spaceballevent::rz, spaceballevent::tx, spaceballevent::ty, and spaceballevent::tz. |
|
|
|
Initial value: " \n" " \n" " \n" " \n" "void main(void) { \n" " \n" " // Flip the surface normal if it is facing away from the viewer, \n" " // determined by polygon winding order provided by OpenGL. \n" " vec3 N = normalize(oglnormal); \n" " if (!gl_FrontFacing) { \n" " N = -N; \n" " } \n" " \n" " \n" " \n" " \n" " \n" " \n" "} \n" " \n" Definition at line 2813 of file glwin.c. Referenced by glwin_compile_hmd_shaders. |
|
Initial value: "// requires GLSL version 1.10 \n" "#version 110 \n" " \n" " \n" " \n" "void main(void) { \n" " // transform vertex to Eye space for user clipping plane calculations \n" " vec4 ecpos = gl_ModelViewMatrix * gl_Vertex; \n" " gl_ClipVertex = ecpos; \n" " \n" " // transform, normalize, and output normal. \n" " oglnormal = normalize(gl_NormalMatrix * gl_Normal); \n" " \n" " // pass along vertex color for use fragment shading, \n" " // fragment shader will get an interpolated color. \n" " oglcolor = vec3(gl_Color); \n" " \n" " \n" " gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; \n" " \n" " \n" " \n" " \n" "} \n" " \n" Definition at line 2781 of file glwin.c. Referenced by glwin_compile_hmd_shaders. |