#include <nviz3d.h>
Public Methods | |
Nviz3DCanvas (wxWindow *parent, const wxWindowID id=-1, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0, const wxString &name="TestGLCanvas") | |
~Nviz3DCanvas (void) | |
void | OnPaint (wxPaintEvent &event) |
void | OnSize (wxSizeEvent &event) |
void | OnEraseBackground (wxEraseEvent &event) |
void | OnEnterWindow (wxMouseEvent &event) |
void | OnMouse (wxMouseEvent &event) |
void | DrawNeuron (GLfloat x, GLfloat y, GLfloat z,) |
void | Render (void) |
void | InitGL (void) |
Private Attributes | |
bool | m_init |
Friends | |
class | NVizFrame |
|
Definition at line 55 of file nviz3d.cpp. References m_init.
00057 : 00058 wxGLCanvas(parent, (wxGLCanvas*) NULL, id, pos, size, style, name ) 00059 { 00060 m_init = FALSE; 00061 } |
|
Definition at line 64 of file nviz3d.cpp.
00065 { 00066 // Nothing Here 00067 } |
|
Definition at line 180 of file nviz3d.cpp.
00181 { 00182 } |
|
Definition at line 191 of file nviz3d.cpp. Referenced by Render.
00192 { 00193 SetCurrent(); 00194 00195 // set viewing projection 00196 glMatrixMode(GL_PROJECTION); 00197 glFrustum(-1.0F, 1.0F, -1.0F, 1.0F, 1.0F, 100.0F); 00198 00199 // position viewer 00200 glMatrixMode(GL_MODELVIEW); 00201 glLoadIdentity(); 00202 glTranslated(0.0, 0.0, -4.0); 00203 00204 glEnable(GL_DEPTH_TEST); 00205 glEnable(GL_LIGHTING); 00206 glEnable(GL_LIGHT0); 00207 } |
|
Definition at line 108 of file nviz3d.cpp.
00109 { 00110 SetFocus(); 00111 } |
|
Definition at line 185 of file nviz3d.cpp.
00186 { 00187 // Do nothing, to avoid flashing. 00188 } |
|
Definition at line 138 of file nviz3d.cpp. References last_x, last_y, xrot, yrot, and zoom.
00139 { 00140 // I think all this dragging stuff is a way to waste a cycle to get a last_x or 00141 // y before drawing. Still not working but good enough for now. 00142 static int dragging = 0; 00143 00144 if (event.LeftIsDown()) 00145 { 00146 if (!dragging) 00147 { 00148 dragging = 1; 00149 } 00150 else 00151 { 00152 yrot += (event.GetX() - last_x)*1.0; 00153 xrot += (event.GetY() - last_y)*1.0; 00154 Refresh(FALSE); 00155 } 00156 last_x = event.GetX(); 00157 last_y = event.GetY(); 00158 } 00159 00160 00161 if (event.RightIsDown()) 00162 { 00163 if (!dragging) 00164 { 00165 dragging = 0; 00166 } 00167 else 00168 { 00169 xrot = 0.0; // If this is not done it will rotate when zooming 00170 yrot = 0.0; 00171 zoom += (event.GetY() - last_y)*0.25; 00172 Refresh(FALSE); 00173 } 00174 last_y = event.GetY(); 00175 } 00176 // else 00177 // dragging = 0; 00178 } |
|
Definition at line 114 of file nviz3d.cpp. References Render.
00115 { 00116 Render(); 00117 } |
|
Definition at line 120 of file nviz3d.cpp.
00121 { 00122 // this is also necessary to update the context on some platforms 00123 wxGLCanvas::OnSize(event); 00124 00125 // set GL viewport (not called by wxGLCanvas::OnSize on all platforms...) 00126 int w, h; 00127 GetClientSize(&w, &h); 00128 #ifndef __WXMOTIF__ 00129 if (GetContext()) 00130 #endif 00131 { 00132 SetCurrent(); 00133 glViewport(0, 0, (GLint) w, (GLint) h); 00134 } 00135 } |
|
Definition at line 70 of file nviz3d.cpp. References InitGL, m_init, xrot, yrot, and zoom. Referenced by OnPaint.
00071 { 00072 // This is apperantly a dummy to avoid an endless succession of paint 00073 // messages. OnPaint handlers must always create a wxPaintDC. 00074 wxPaintDC dc(this); 00075 00076 #ifndef __WXMOTIF__ 00077 if (!GetContext()) return; 00078 #endif 00079 00080 SetCurrent(); 00081 // init OpenGL once, but after SetCurrent 00082 if (!m_init) 00083 { 00084 InitGL(); 00085 m_init = TRUE; 00086 } 00087 00088 // clear color and depth buffers 00089 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 00090 00091 glPushMatrix(); 00092 glMatrixMode(GL_MODELVIEW); 00093 glRotatef(yrot, 0.0, 1.0, 0.0); 00094 glRotatef(xrot, 1.0, 0.0, 0.0); 00095 glMatrixMode(GL_PROJECTION); 00096 glTranslatef(0.0, 0.0, zoom); 00097 00098 GLUquadricObj *gl_neuron = gluNewQuadric(); 00099 gluSphere(gl_neuron, 1.0, 10, 10); 00100 00101 glPopMatrix(); 00102 00103 glFlush(); 00104 SwapBuffers(); 00105 } |
|
|
|
Definition at line 69 of file nviz3d.h. Referenced by Nviz3DCanvas, and Render. |