/[escript]/trunk/cusplibrary/cusp/opengl/spy/spy.h
ViewVC logotype

Annotation of /trunk/cusplibrary/cusp/opengl/spy/spy.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5148 - (hide annotations)
Mon Sep 15 01:25:23 2014 UTC (6 years, 2 months ago) by caltinay
File MIME type: text/plain
File size: 2389 byte(s)
Merging ripley diagonal storage + CUDA support into trunk.
Options file version has been incremented due to new options
'cuda' and 'nvccflags'.

1 caltinay 4955 /*
2     * Copyright 2008-2013 Steven Dalton
3     *
4     * Licensed under the Apache License, Version 2.0 (the "License");
5     * you may not use this file except in compliance with the License.
6     * You may obtain a copy of the License at
7     *
8     * http://www.apache.org/licenses/LICENSE-2.0
9     *
10     * Unless required by applicable law or agreed to in writing, software
11     * distributed under the License is distributed on an "AS IS" BASIS,
12     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13     * See the License for the specific language governing permissions and
14     * limitations under the License.
15     */
16    
17     #pragma once
18    
19     #ifdef _WIN32
20     #define WIN32_LEAN_AND_MEAN
21     # include <windows.h>
22     #endif
23    
24     #if _MSC_VER >= 1400
25     // disable the warning for "non-safe" functions
26     #pragma warning ( push )
27     #pragma warning ( disable : 4996 )
28     #endif // _MSC_VER >= 1400
29    
30     #define GL_GLEXT_PROTOTYPES
31    
32     #if defined(__APPLE__)
33     #include <GLUT/glut.h>
34     #include <OpenGL/gl.h>
35     #include <OpenGL/glu.h>
36     #else
37     #include <GL/glut.h>
38     #include <GL/gl.h>
39     #include <GL/glu.h>
40     #endif
41    
42     #include <cusp/opengl/spy/glext.h>
43    
44     #undef max
45     #undef min
46    
47     #if _MSC_VER >= 1400
48     // enable the warning for "non-safe" functions
49     #pragma warning ( pop )
50     #endif // _MSC_VER >= 1400
51    
52     #include <cusp/opengl/spy/gl_util.h>
53     #include <cusp/opengl/spy/glut_window.h>
54     #include <cusp/opengl/spy/matrix_data_panel.h>
55     #include <cusp/opengl/spy/matrix_canvas.h>
56     #include <cusp/opengl/spy/matrix_data_panel.h>
57    
58     namespace cusp
59     {
60     namespace opengl
61     {
62     namespace spy
63     {
64    
65     template< typename MatrixType >
66     int view_matrix(const MatrixType& A)
67     {
68     typedef typename MatrixType::index_type IndexType;
69     typedef typename MatrixType::value_type ValueType;
70     typedef typename MatrixType::memory_space MemorySpace;
71    
72     int argc = 0;
73     glutInit(&argc, NULL);
74     glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH | GLUT_ALPHA);
75    
76     // create the window
77     matrix_canvas<IndexType,ValueType,MemorySpace> wind(800,600);
78    
79     // begin the data loading process
80     wind.load_matrix(A);
81    
82     // this is a work around for a bug with visual c++ where the GLUT
83     // calls will crash if we compile in release mode with optimizations
84     // enabled
85     wind.post_constructor();
86    
87     // hacky fix around a GLUI bug
88     //glui_reshape_func(600,400);
89     glutReshapeWindow(600,400);
90    
91     glutMainLoop();
92    
93     return 0;
94     }
95    
96     } // end spy
97     } // end opengl
98     } // end cusp

  ViewVC Help
Powered by ViewVC 1.1.26