 |
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
jjgermis
Joined: 21 Jun 2006 Posts: 404 Location: N�rnberg, Germany
|
Posted: Thu May 31, 2012 9:15 am Post subject: |
|
|
Hi Dan,
good idea - I will do that.
One thing I try to figure is the mapping form the "real world" to the OpenGL window. The basic idea is to plot data to fit the available screen area. In the example below you can see that only a part of the mesh is shown. Can OpenGL manage this automatically or do I have to take care of that -> OpenGL uses a left-handed-system and right-handed-system - the internet is sometimes confusing:(
In a previous thread a few tipps when using only ClearWin was discussed.
 |
|
Back to top |
|
 |
DanRRight
Joined: 10 Mar 2008 Posts: 2939 Location: South Pole, Antarctica
|
Posted: Thu May 31, 2012 10:31 pm Post subject: |
|
|
It is easy to imagine that system can manage that automatically in 2D if you set the rules. In 3D this was realized in physics packages of modern games - they precisely find all limits, view angles and depth of view, boundaries, they ray trace light, do hydrodynamics simulations etc, it's almost real virtual world. We need some higher level language similar to what game developed created for their game models but this one will be for scientific functions and methods. Ones such "world" will be created users will come adding their contributions and expanding it. |
|
Back to top |
|
 |
jjgermis
Joined: 21 Jun 2006 Posts: 404 Location: N�rnberg, Germany
|
Posted: Fri Jun 01, 2012 10:02 am Post subject: |
|
|
I can get the (book) examples to work. However, when I try my own one it does not work properly - somehow I miss something. Below is an example code to read the coordinates of Lake Superior. The data file is online available: test vector.
Code: |
winapp
program lsup
implicit none
INCLUDE <clearwin.ins>,nolist
INCLUDE <opengl.ins>,nolist
! Constants
integer, parameter :: inunit = 11, maxnc = 30, maxnv = 400, maxvc = 500
integer, parameter :: dp=kind(0.0d0)
! Character
character ( len = 256 ) filename, rgname
real ( kind = dp ) :: tolin, angspc, angtol
real ( kind = dp ) :: kappa, dmin, vcl(2,maxvc)
real ( kind = dp ) :: xmin,xmax,ymin,ymax
integer :: case, i, nvc, nmin, ntrid, msglvl, ncur, nv
integer :: icur(maxnc), ivrt(maxnv), nvbc(maxnc), ctrl
! The data file is available online at:
! http://people.sc.fsu.edu/~jburkardt/f_src/geompack2/lsup.in
filename = '..\test\geo-03\lsup'
open ( unit = inunit, file = TRIM(filename)//'.in')
read ( inunit, * ) rgname
read ( inunit, * ) tolin, angspc, angtol, kappa, dmin, nmin, ntrid
read ( inunit, * ) case, nvc, ncur, msglvl
read ( inunit, * ) nvbc(1:ncur)
if ( abs(case) == 2 ) then
read ( inunit, * ) icur(1:ncur)
end if
read ( inunit, * ) ( vcl(1,i), vcl(2,i), i = 1, nvc )
if ( abs(case) == 2 ) then
nv = sum ( nvbc(1:ncur) )
read ( inunit, * ) ivrt(1:nv)
end if
close ( unit = inunit )
xmin = 1d6
xmax = -1d6
ymin = 1d6
ymax = -1d6
do i=1,nvbc(1)
xmin = min(xmin,vcl(1,i))
xmax = max(xmax,vcl(1,i))
ymin = min(ymin,vcl(2,i))
ymax = max(ymax,vcl(2,i))
enddo
i=winio@('%es%ca[Triagular meshes with OpenGL]&')
i=winio@('%sp%ww[no_border]%og[static]%lw',0, 0, 800, 600, ctrl)
CALL glClearColor(0.0, 0.0, 0.0, 0.0)
CALL glClear(GL_COLOR_BUFFER_BIT)
CALL glColor3f(1.0, 1.0, 1.0)
CALL glMatrixMode(GL_PROJECTION)
call glPolygonMode( GL_FRONT_AND_BACK, GL_LINE )
CALL glOrtho(xmin, xmax, ymin, ymax, -10.0, 10.0)
CALL glBegin(GL_POLYGON)
CALL glColor3f(0.0,1.0,0.0)
do i=1,nvbc(1)
CALL glVertex2f(vcl(1,i),vcl(2,i))
enddo
CALL glEnd()
CALL glFlush()
end |
|
|
Back to top |
|
 |
jjgermis
Joined: 21 Jun 2006 Posts: 404 Location: N�rnberg, Germany
|
Posted: Sun Jun 03, 2012 4:31 pm Post subject: |
|
|
From what I figure out one must shift (and scale) the data to fit it to the current window. The following code helped - a screen shot is shown below (on a Linux machine). Anyway, plotting a mesh is such a trivial problem that is not to mention. Many OpenGL examples are looking at 3D examples that are way to complicated for my application (at the moment).
Code: |
xmin = 5d6
xmax = -5d6
ymin = 5d6
ymax = -5d6
do i=1,fpl%nnodes
xmin = min(xmin,fpl%x(i))
xmax = max(xmax,fpl%x(i))
ymin = min(ymin,fpl%y(i))
ymax = max(ymax,fpl%y(i))
enddo
w = xmax-xmin
h = ymax-ymin
x_0 = xmin+w/2.0d0
y_0 = ymin+h/2.0d0 |
 |
|
Back to top |
|
 |
jjgermis
Joined: 21 Jun 2006 Posts: 404 Location: N�rnberg, Germany
|
Posted: Sun Jun 10, 2012 9:34 am Post subject: |
|
|
Hi Dan
I (re)discovered the viewer of the Triangle mesher, i.e. ShowMe - below is a screenshot. However, it only works under Linux (at home).
Anyway, what I can suggest for the viewer you sent me is the "control pannel" at the lower left. With OpenGL and such a menu one should be able to write a viewer that can be compiled with FTN95 and whatever compiler one prefer.
Regarding the eps-format: the viewer has a EPS "button". This exports the figure in eps-format which I can include this in my documents. Very useful!
At present I use the GEOMPACK mesher. The output I write to the Triangle file format and use the ShowMe viewer.
 |
|
Back to top |
|
 |
DanRRight
Joined: 10 Mar 2008 Posts: 2939 Location: South Pole, Antarctica
|
Posted: Mon Jun 11, 2012 1:15 pm Post subject: |
|
|
That is exactly why i'd like as many FTN95 users as possible used OpenGL and shared their knowledge - i simply do not know a lot of things in OpenGL ! Making such menu is probably very easy task but i need an example to learn from.
BTW, did you implement saving FTN95 OpenGL screen as John suggested? I found my own code for that. |
|
Back to top |
|
 |
jjgermis
Joined: 21 Jun 2006 Posts: 404 Location: N�rnberg, Germany
|
Posted: Tue Jun 19, 2012 8:57 am Post subject: |
|
|
I recently ask how to plot an eps plot.
Following the link you will find some example code. Look for the subroutine triangulation_polt_eps. The subroutine is in the geompack2.f90 file. |
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|