Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

glwin.c File Reference

#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)
spaceballhandlespaceball_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)
oglhandleglwin_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


Define Documentation

#define GL_GLEXT_PROTOTYPES   1
 

Definition at line 37 of file glwin.c.

#define GLX_GLXEXT_PROTOTYPES   1
 

Definition at line 38 of file glwin.c.

#define HMD_DIVCNT   10
 

Definition at line 2290 of file glwin.c.

#define SBALL_COMMAND_APP_SENSITIVITY   27696
 

Definition at line 521 of file glwin.c.

#define SBALL_COMMAND_APP_WINDOW   27695
 

Definition at line 520 of file glwin.c.

Referenced by spaceball_attach.

#define SBALL_COMMAND_NONE   0
 

Definition at line 519 of file glwin.c.

#define SPHEREMAXRES   64
 

Definition at line 3013 of file glwin.c.

Referenced by glwin_draw_sphere_tex.

#define USEOPENGL
 

Definition at line 28 of file glwin.c.


Typedef Documentation

typedef void(APIENTRY * glwin_fctnptr)(void)
 

Definition at line 347 of file glwin.c.


Function Documentation

oglhandle* glwin_alloc_init void    [static]
 

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.

int glwin_compile_hmd_shaders void *    voidhandle,
glsl_shader   sh
 

Definition at line 2838 of file glwin.c.

References glwin_compile_shaders, hmd_frag, and hmd_vert.

int glwin_compile_shaders void *    voidhandle,
glsl_shader   sh,
const GLubyte *    vertexShader,
const GLubyte *    fragmentShader,
int    verbose
[static]
 

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.

void* glwin_create const char *    wintitle,
int    width,
int    height
 

Definition at line 684 of file glwin.c.

References oglhandle::ctx, oglhandle::dpy, glwin_alloc_init, GLWIN_EV_POLL_BLOCK, glwin_handle_events, glwin_init_exts, glwin_swap_buffers, oglhandle::havestencil, oglhandle::height, oglhandle::instereo, mask, NULL, oglhandle::root, oglhandle::sball, oglhandle::sballevent, oglhandle::scrnum, spaceball_attach, spaceball_clear_event, spaceball_init_event, oglhandle::width, oglhandle::win, and oglhandle::wmDeleteWindow.

void glwin_destroy void *    voidhandle
 

Definition at line 1026 of file glwin.c.

References oglhandle::dpy, oglhandle::ext, NULL, oglhandle::sball, spaceball_close, and oglhandle::win.

int glwin_destroy_shaders void *    voidhandle,
glsl_shader   sh
 

Definition at line 2762 of file glwin.c.

References oglhandle::ext, GLDELETEOBJECTARB, GLWIN_ERROR, GLWIN_SUCCESS, glsl_shader::isvalid, and glsl_shader::ProgramObject.

void glwin_draw_image void *    voidhandle,
int    ixs,
int    iys,
unsigned char *    img
 

Definition at line 2847 of file glwin.c.

References glwin_swap_buffers.

void glwin_draw_image_rgb3u void *    voidhandle,
int    stereomode,
int    ixs,
int    iys,
const unsigned char *    rgb3u
 

Definition at line 2854 of file glwin.c.

References glwin_get_winsize, GLWIN_STEREO_OVERUNDER, and glwin_swap_buffers.

void glwin_draw_image_tex_rgb3u void *    voidhandle,
int    stereomode,
int    ixs,
int    iys,
const unsigned char *    rgb3u
 

Definition at line 2900 of file glwin.c.

References glwin_get_winsize, GLWIN_STEREO_OVERUNDER, and glwin_swap_buffers.

void glwin_draw_sphere_tex float    rad,
int    res,
float    txlatstart,
float    txlatend
 

Definition at line 3014 of file glwin.c.

References SPHEREMAXRES.

int glwin_fbo_target_bind void *    voidhandle,
void *    voidtarget
 

Definition at line 2088 of file glwin.c.

References oglhandle::ext, glwin_fbo_target::fbo, GLWIN_ERROR, GLWIN_SUCCESS, and NULL.

void* glwin_fbo_target_create void *    voidhandle,
int    wsx,
int    wsy
 

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.

int glwin_fbo_target_destroy void *    voidhandle,
void *    voidtarget
 

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.

int glwin_fbo_target_draw_fbo void *    voidhandle,
void *    voidtarget,
int    wsx,
int    wsy
 

Definition at line 2258 of file glwin.c.

References GLWIN_ERROR, glwin_fbo_target_unbind, GLWIN_SUCCESS, NULL, and glwin_fbo_target::tex.

int glwin_fbo_target_draw_normal void *    voidhandle,
void *    voidtarget
 

Definition at line 2245 of file glwin.c.

References oglhandle::ext, GLWIN_ERROR, GLWIN_SUCCESS, and NULL.

int glwin_fbo_target_resize void *    voidhandle,
void *    voidtarget,
int    wsx,
int    wsy
 

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.

int glwin_fbo_target_unbind void *    voidhandle,
void *    voidtarget
 

Definition at line 2101 of file glwin.c.

References oglhandle::ext, GLWIN_ERROR, GLWIN_SUCCESS, and NULL.

int glwin_fullscreen void *    voidhandle,
int    fson,
int    xinescreen
 

Definition at line 1283 of file glwin.c.

References oglhandle::dpy, oglhandle::root, and oglhandle::win.

int glwin_get_lastevent void *    voidhandle,
int *    evdev,
int *    evval,
char *    evkey
 

Definition at line 3256 of file glwin.c.

References oglhandle::evdev, oglhandle::evkey, oglhandle::evval, and NULL.

int glwin_get_mousepointer void *    voidhandle,
int *    x,
int *    y
 

Definition at line 3241 of file glwin.c.

References oglhandle::mousex, oglhandle::mousey, and NULL.

void* glwin_get_procaddress const char *    procname
 

Definition at line 350 of file glwin.c.

References NULL.

Referenced by glwin_init_exts.

int glwin_get_spaceball void *    voidhandle,
int *    rx,
int *    ry,
int *    rz,
int *    tx,
int *    ty,
int *    tz,
int *    buttons
 

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.

int glwin_get_wininfo void *    voidhandle,
int *    instereo,
int *    havestencil
 

Definition at line 3186 of file glwin.c.

References oglhandle::havestencil, oglhandle::instereo, and NULL.

int glwin_get_winpos void *    voidhandle,
int *    xpos,
int *    ypos
 

Definition at line 3226 of file glwin.c.

References NULL, oglhandle::xpos, and oglhandle::ypos.

int glwin_get_winsize void *    voidhandle,
int *    xsize,
int *    ysize
 

Definition at line 3201 of file glwin.c.

References oglhandle::dpy, oglhandle::height, NULL, oglhandle::width, and oglhandle::win.

int glwin_handle_events void *    voidhandle,
int    evblockmode
 

Definition at line 1075 of file glwin.c.

References oglhandle::dpy, oglhandle::evdev, oglhandle::evkey, oglhandle::evval, GLWIN_EV_KBD, GLWIN_EV_KBD_DELETE, GLWIN_EV_KBD_DOWN, GLWIN_EV_KBD_END, GLWIN_EV_KBD_F1, GLWIN_EV_KBD_F10, GLWIN_EV_KBD_F11, GLWIN_EV_KBD_F12, GLWIN_EV_KBD_F2, GLWIN_EV_KBD_F3, GLWIN_EV_KBD_F4, GLWIN_EV_KBD_F5, GLWIN_EV_KBD_F6, GLWIN_EV_KBD_F7, GLWIN_EV_KBD_F8, GLWIN_EV_KBD_F9, GLWIN_EV_KBD_HOME, GLWIN_EV_KBD_INSERT, GLWIN_EV_KBD_LEFT, GLWIN_EV_KBD_PAGE_UP, GLWIN_EV_KBD_RIGHT, GLWIN_EV_KBD_UP, GLWIN_EV_MOUSE_LEFT, GLWIN_EV_MOUSE_MIDDLE, GLWIN_EV_MOUSE_MOVE, GLWIN_EV_MOUSE_RIGHT, GLWIN_EV_MOUSE_WHEELDOWN, GLWIN_EV_MOUSE_WHEELUP, GLWIN_EV_NONE, GLWIN_EV_POLL_NONBLOCK, GLWIN_EV_WINDOW_CLOSE, oglhandle::havefocus, oglhandle::height, oglhandle::mousex, oglhandle::mousey, NULL, oglhandle::sball, oglhandle::sballevent, spaceball_clear_event, spaceball_decode_event, oglhandle::width, oglhandle::win, oglhandle::wmDeleteWindow, oglhandle::xpos, and oglhandle::ypos.

void glwin_init_exts void *    voidhandle
 

Definition at line 397 of file glwin.c.

References oglhandle::dpy, oglhandle::ext, framebuffer, glwin_get_procaddress, glwin_query_extension, glx_query_extension, glwin_ext_fctns::hasgetvideosyncsgi, glwin_ext_fctns::hasglfborendertarget, glwin_ext_fctns::hasglfragmentshaderarb, glwin_ext_fctns::hasglgeometryshader4arb, glwin_ext_fctns::hasglsampleshadingarb, glwin_ext_fctns::hasglshaderobjectsarb, glwin_ext_fctns::hasglshadinglangarb, glwin_ext_fctns::hasglvertexshaderarb, n, NULL, and void.

Referenced by glwin_create.

void glwin_print_glsl_infolog void *    voidhandle,
GLhandleARB    obj,
const char *    msg
[static]
 

Definition at line 2658 of file glwin.c.

References oglhandle::ext, GLGETINFOLOGARB, GLGETOBJECTPARAMETERIVARB, and NULL.

Referenced by glwin_compile_shaders.

int glwin_query_extension const char *    extname
 

Definition at line 2014 of file glwin.c.

References n, and NULL.

int glwin_query_vsync void *    voidhandle,
int *    onoff
 

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.

int glwin_reposition void *    voidhandle,
int    xpos,
int    ypos
 

Definition at line 1260 of file glwin.c.

References oglhandle::dpy, NULL, and oglhandle::win.

int glwin_resize void *    voidhandle,
int    width,
int    height
 

Definition at line 1245 of file glwin.c.

References oglhandle::dpy, NULL, and oglhandle::win.

int glwin_spaceball_available void *    voidhandle
 

Definition at line 3274 of file glwin.c.

References NULL, and oglhandle::sball.

void* glwin_spheremap_create_hmd_warp void *    vwin,
int    wsx,
int    wsy,
int    wrot,
int    warpdivs,
int    ixs,
int    iys,
const float *    user_coeff
 

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.

void glwin_spheremap_destroy_hmd_warp void *    vwin,
void *    voidwarp
 

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.

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
 

Definition at line 2565 of file glwin.c.

References glwin_warp_hmd::Bxcrds, glwin_warp_hmd::Bycrds, glwin_warp_hmd::divcnt, GLWIN_ERROR, glwin_fbo_target_bind, glwin_fbo_target_unbind, glwin_spheremap_draw_tex, GLWIN_STEREO_OVERUNDER, GLWIN_SUCCESS, glwin_warp_hmd::Gxcrds, glwin_warp_hmd::Gycrds, hmd_draw_eye_lines, hmd_draw_eye_texquads, glwin_warp_hmd::hmd_fbo, NULL, glwin_warp_hmd::Rxcrds, glwin_warp_hmd::Rycrds, glwin_fbo_target::tex, glwin_warp_hmd::xcrds, and glwin_warp_hmd::ycrds.

void glwin_spheremap_draw_prepare void *    voidhandle
 

Definition at line 3092 of file glwin.c.

void glwin_spheremap_draw_tex void *    voidhandle,
int    stereomode,
int    ixs,
int    iys,
const float *    hmdquat,
float    fov,
float    rad,
int    res
 

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.

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
 

Definition at line 2450 of file glwin.c.

References glwin_warp_hmd::Bxcrds, glwin_warp_hmd::Bycrds, glwin_warp_hmd::divcnt, force, GLWIN_ERROR, glwin_fbo_target_resize, glwin_warp_hmd::Gxcrds, glwin_warp_hmd::Gycrds, hmd_compute_warped_coords, glwin_warp_hmd::hmd_fbo, NULL, glwin_warp_hmd::Rxcrds, glwin_warp_hmd::Rycrds, glwin_warp_hmd::wsx, glwin_warp_hmd::wsy, glwin_warp_hmd::xcrds, and glwin_warp_hmd::ycrds.

void glwin_spheremap_upload_tex_rgb3u void *    voidhandle,
int    ixs,
int    iys,
const unsigned char *    rgb3u
 

Definition at line 3121 of file glwin.c.

void glwin_swap_buffers void *    voidhandle
 

Definition at line 1061 of file glwin.c.

References oglhandle::dpy, NULL, and oglhandle::win.

int glx_query_extension Display *    dpy,
const char *    extname
[static]
 

Definition at line 297 of file glwin.c.

References n, and NULL.

Referenced by glwin_init_exts, and glwin_query_vsync.

void hmd_compute_warped_coords int    divcnt,
int    wsx,
int    wsy,
float    rscale,
float    wscale,
float *    xcrds,
float *    ycrds,
const float *    user_distort_coeff5
[static]
 

Definition at line 2292 of file glwin.c.

Referenced by glwin_spheremap_update_hmd_warp.

void hmd_draw_eye_lines int    divcnt,
int    xoff,
int    width,
int    height,
float *    xcrds,
float *    ycrds
[static]
 

Definition at line 2348 of file glwin.c.

Referenced by glwin_spheremap_draw_hmd_warp.

void hmd_draw_eye_texquads int    divcnt,
int    xoff,
int    width,
int    height,
float *    xcrds,
float *    ycrds
[static]
 

Definition at line 2386 of file glwin.c.

Referenced by glwin_spheremap_draw_hmd_warp.

void quat_rot_matrix float *    m,
const float *    q
[static]
 

Definition at line 323 of file glwin.c.

Referenced by glwin_spheremap_draw_tex, HMDMgr::rot_basis_quat, and HMDMgr::rot_point_quat.

spaceballhandle* spaceball_attach Display *    dpy,
Window    win
[static]
 

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.

void spaceball_clear_event spaceballevent   sballevent [static]
 

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.

void spaceball_close spaceballhandle   handle [static]
 

Definition at line 589 of file glwin.c.

int spaceball_decode_event spaceballhandle   handle,
const XEvent *    xev,
spaceballevent   sballevent
[static]
 

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.

void spaceball_init_event spaceballevent   sballevent [static]
 

Definition at line 630 of file glwin.c.


Variable Documentation

const char* hmd_frag
 

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.

const char* hmd_vert
 

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.


Generated on Wed Nov 13 02:45:14 2024 for VMD (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002