Permalink
Browse files

wikimedia conversion done

  • Loading branch information...
erleben committed Feb 17, 2018
1 parent 912bf1e commit ba4b10c78184f03f6f469e00a03609bcada57bc7
Showing with 348 additions and 310 deletions.
  1. +84 −67 documentation/using_opengl.md
  2. +16 −15 documentation/using_opentissue.md
  3. +56 −51 documentation/using_shaders.md
  4. +53 −52 documentation/utility.md
  5. +139 −125 documentation/volviz.md
@@ -157,13 +157,25 @@ file
#include<OpenTissue/utility/GL/gl_screen2object.h>
The utility is used as follows
<pre>
int sx = 5,
int sy = 15;
int ox,oy,oz;
glScreen2Object()(sx,sy, ox, oy, oz);
std::cout << "pixel at (" << sx << "," << sy << ")corresponds to point (" << ox << "," << oy << ","<< oz << ")" << std::endl;
std::cout << "pixel at ("
<< sx
<< ","
<< sy
<< ")corresponds to point ("
<< ox
<< ","
<< oy
<< ","
<< oz
<< ")"
<< std::endl;
</pre>
Finally there is a picking tool available in the header file
@@ -234,56 +246,56 @@ void Application::display()
Of course we want to be able to move the camera around, a perfect place for
changing the camera is in the mouse event handlers. For instance one could write
<pre>
void Application::mouse_down(real_type cur_x,real_type cur_y,bool shift,bool left,bool middle,bool /*right*/)
{
if (middle )
m_zoom_mode = true;
if ( shift &amp;&amp; left )
m_pan_mode = true;
if(!shift &amp;&amp; left)
{
m_camera.mouse_down( cur_x, cur_y );
m_trackball_mode = true;
}
m_begin_x = cur_x;
m_begin_y = cur_y;
}
void Application::mouse_down(real_type cur_x,real_type cur_y,bool shift,bool left,bool middle,bool /*right*/)
{
if (middle )
m_zoom_mode = true;
if ( shift &amp;&amp; left )
m_pan_mode = true;
if(!shift &amp;&amp; left)
{
m_camera.mouse_down( cur_x, cur_y );
m_trackball_mode = true;
}
m_begin_x = cur_x;
m_begin_y = cur_y;
}
void Application::mouse_up(real_type cur_x,real_type cur_y,bool /*shift*/,bool /*left*/,bool /*middle*/,bool /*right*/)
{
if ( m_zoom_mode )
{
m_camera.move( 0.25*(cur_y - m_begin_y) );
m_zoom_mode = false;
}
if ( m_pan_mode )
{
m_camera.pan( 0.25*(m_begin_x - cur_x) , 0.25*(cur_y - m_begin_y) );
m_pan_mode = false;
}
if ( m_trackball_mode )
{
m_camera.mouse_up( cur_x, cur_y );
m_trackball_mode = false;
}
m_begin_x = cur_x;
m_begin_y = cur_y;
}
void Application::mouse_move(real_type cur_x,real_type cur_y)
{
if ( m_zoom_mode )
m_camera.move( 0.25*(cur_y - m_begin_y) );
if ( m_pan_mode )
m_camera.pan( 0.25*(m_begin_x - cur_x) , 0.25*(cur_y - m_begin_y) );
if ( m_trackball_mode )
m_camera.mouse_move( cur_x, cur_y);
m_begin_x = cur_x;
m_begin_y = cur_y;
}
void Application::mouse_up(real_type cur_x,real_type cur_y,bool /*shift*/,bool /*left*/,bool /*middle*/,bool /*right*/)
{
if ( m_zoom_mode )
{
m_camera.move( 0.25*(cur_y - m_begin_y) );
m_zoom_mode = false;
}
if ( m_pan_mode )
{
m_camera.pan( 0.25*(m_begin_x - cur_x) , 0.25*(cur_y - m_begin_y) );
m_pan_mode = false;
}
if ( m_trackball_mode )
{
m_camera.mouse_up( cur_x, cur_y );
m_trackball_mode = false;
}
m_begin_x = cur_x;
m_begin_y = cur_y;
}
void Application::mouse_move(real_type cur_x,real_type cur_y)
{
if ( m_zoom_mode )
m_camera.move( 0.25*(cur_y - m_begin_y) );
if ( m_pan_mode )
m_camera.pan( 0.25*(m_begin_x - cur_x) , 0.25*(cur_y - m_begin_y) );
if ( m_trackball_mode )
m_camera.mouse_move( cur_x, cur_y);
m_begin_x = cur_x;
m_begin_y = cur_y;
}
</pre>
This will support zooming, panning, and orbiting. For more details we refer
the reader to the header file
@@ -296,6 +308,7 @@ this is provided in the header file
It works simply by updating an instance of the frustum class before testing,
for instance one could add the following code to the display handler
<pre>
...
glFrustum<types> frustum;
@@ -365,24 +378,28 @@ is what you typically want during some initialization.
After having initialized the Framebuffer Object you can use it in your display
handler as follows
<pre>
void Application::display()
{
...
static const GLenum buffer[] = { GL_COLOR_ATTACHMENT0_EXT, GL_COLOR_ATTACHMENT1_EXT };
int write = 0;
int read = 1;
m_fbo.bind();
for(unsigned int i=0;i<ping_pongs;++i)
{
glDrawBuffer (buffer[write]);
draw_some_thing( ..., m_texture[read]);
std::swap(m_write,m_read);
}
glFramebufferObject::disable();
}
</pre>
void Application::display()
{
static const GLenum buffer[] = {
GL_COLOR_ATTACHMENT0_EXT
, GL_COLOR_ATTACHMENT1_EXT
};
int write = 0;
int read = 1;
m_fbo.bind();
for(unsigned int i=0;i<ping_pongs;++i)
{
glDrawBuffer (buffer[write]);
draw_some_thing( ..., m_texture[read]);
std::swap(m_write,m_read);
}
glFramebufferObject::disable();
}
Notice that before rendering the function glDrawBuffer is used to tell which
buffer should receive the rendering. If you desire to read back from a
buffer (from GPU to CPU) you should use the function glReadBuffer to tell which
@@ -1,19 +1,20 @@
# Using OpenTissue in your Application
OpenTissue is a meta-library. This means that OpenTissue is a collection of many smaller libraries. In your application you might want to use one of these libraries or several in combination with each other. Very much in the same way as you would use libraries like STL or Boost in an application.
Most of the libraries are what we would like to call self-contained. By this we mean that the libraries are ``header-only'' without any third-party dependencies. Thus to use OpenTissue in your application would in many cases simply imply that you need to tell your compiler the location at where it can find the OpenTissue include headers. If you are using any sub-libraries that have some dependency then your application will have the same dependency. As an example a substantial subset of the libraries are using Boost, so in these cases you would need this third-party dependency in your own application as well.
Most of the libraries are what we would like to call self-contained. By this we mean that the libraries are header-only without any third-party dependencies. Thus to use OpenTissue in your application would in many cases simply imply that you need to tell your compiler the location at where it can find the OpenTissue include headers. If you are using any sub-libraries that have some dependency then your application will have the same dependency. As an example a substantial subset of the libraries are using Boost, so in these cases you would need this third-party dependency in your own application as well.
To be on the safe side you could add every dependency used in OpenTissue as a dependency to your own application. However, this may be overkill. If for instance you do not use any of the Cg or OpenGL utilities then there is no need to ``link'' with these libraries. The dependency table on the [[Installing_OpenTissue|OpenTissue installation page]]. Provides an overview of all the dependencies in OpenTissue and may assist one in tracking down what dependencies are needed.
To be on the safe side you could add every dependency used in OpenTissue as a dependency to your own application. However, this may be overkill. If for instance you do not use any of the Cg or OpenGL utilities then there is no need to link with these libraries. The dependency table on the [[Installing_OpenTissue|OpenTissue installation page]]. Provides an overview of all the dependencies in OpenTissue and may assist one in tracking down what dependencies are needed.
= Using OpenTissue as Third-Party Software =
## Using OpenTissue as Third-Party Software
OpenTissue is using CMake for generating makefiles to build OpenTissue with. This has major benefits for OpenTissue users that use CMake for developing their own applications.
There are three simple steps
# Download OpenTissue
# Run CMake on OpenTissue (See [[Using_CMake|here]] for details)
# Write you own CMakeLists.txt file
* Download OpenTissue
* Run CMake on OpenTissue (See [[Using_CMake|here]] for details)
* Write you own CMakeLists.txt file
In the following we will focus on the third step, since the first two steps described elsewhere on this Wiki. The second step above will create a file
@@ -33,7 +34,7 @@ MyProject
</pre>
In this case you would want to put a CMakeLists.txt file into your ``MyProject'' folder. The file would look something like this
In this case you would want to put a CMakeLists.txt file into your MyProject folder. The file would look something like this
<pre>
@@ -43,9 +44,9 @@ PROJECT(MyProject)
FIND_PACKAGE(OpenTissue)
IF(OPENTISSUE_FOUND)
INCLUDE_DIRECTORIES( ${OPENTISSUE_INCLUDE_DIRS} )
LINK_DIRECTORIES( ${OPENTISSUE_LIBRARY_DIRS} )
ADD_DEFINITIONS( ${OPENTISSUE_FLAGS} )
INCLUDE_DIRECTORIES( ${OPENTISSUE_INCLUDE_DIRS} )
LINK_DIRECTORIES( ${OPENTISSUE_LIBRARY_DIRS} )
ADD_DEFINITIONS( ${OPENTISSUE_FLAGS} )
ENDIF(OPENTISSUE_FOUND)
... Add your own CMake specific stuff here ...
@@ -118,8 +119,8 @@ ADD_EXECUTABLE(my_target some.cpp ... another.cpp)
TARGET_LINK_LIBRARIES(my_target ${OPENTISSUE_LIBS})
INSTALL(
TARGETS my_target
RUNTIME DESTINATION bin
TARGETS my_target
RUNTIME DESTINATION bin
)
</pre>
@@ -128,15 +129,15 @@ Most of the commands above are pretty much standard CMake things to do. The impo
That's it, now you have created and application that uses OpenTissue as a third-party piece of software.
== Other Settings ==
## Other Settings
If one use CMake to generate MSVC solution files then we can recommend adding something like this
<pre>
IF (MSVC80)
ADD_DEFINITIONS(-D_SCL_SECURE_NO_DEPRECATE)
ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE)
ADD_DEFINITIONS(-D_SCL_SECURE_NO_DEPRECATE)
ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE)
ENDIF(MSVC80)
</pre>
Oops, something went wrong.

0 comments on commit ba4b10c

Please sign in to comment.