 |
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
stfark1
Joined: 02 Sep 2008 Posts: 242
|
Posted: Tue Jun 19, 2018 6:34 pm Post subject: Simple OpenGL Program |
|
|
Totally Frustrated, using Win 10 and Fortran to Opengl calls, output "crazy":
PROGRAM BASIC
INCLUDE <clearwin.ins>,nolist
INCLUDE <opengl.ins>,nolist
DIMENSION X(N),Y(N),Z(N)
INTEGER ctrl
X=0.
Y=0.
Z=0.
i=winio@('%es%ca[Simple Opengl Sample]&')
i=winio@('%sp%ww[no border]%og[static]%1w',
* 0, 0, 1000, 1000, ctrl)
CALL glBegin(GL_LINES)
CALL glRotatef(22.0,1.0,0.0,0.0)
CALL glRotatef(22.0,0.0,1.0,0.0)
CALL glRotatef(22.0,0.0,0.0,1.0)
INDX=0
DO 10 I=1,7
INDX=INDX+1
IF (INDX .EQ. N) GOTO 20
CALL glVertex3f(X(INDX),Y(INDX),Z(INDX))
CALL glVertex3f(X(INDX+1),Y(INDX+1),Z(INDX+1))
10 CONTINUE
20 CALL glEnd
END
Note: N in above was 8, tried to submit and it entered a emoticon?
No matter what I change the glRotate commands to, get the same thing, a vertical and a horizontal line on the output, no Z axis and had addition curve date yet did not plot the curve. Have this identical program in C++ works great???
How Simple can one get??? Anyone have ideas? Sid Kraft |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8210 Location: Salford, UK
|
Posted: Tue Jun 19, 2018 8:32 pm Post subject: |
|
|
I have not tested your program but a quick glance shows %1w instead of %lw. |
|
Back to top |
|
 |
stfark1
Joined: 02 Sep 2008 Posts: 242
|
Posted: Wed Jun 20, 2018 12:27 am Post subject: Simple OpenGL Program |
|
|
John Silver: I left out 3 statements by mistake where I set the input values to 1.:
after the below which set the values all to zero for the complete arrays:
x=0.
y=0.
z=0.
should have been additional codes:
x(2)=1.
y(4)=1.
z(6)=1.
this should have drawn the x,y,z axes but after changing the 1 to l, still did not work! Sid |
|
Back to top |
|
 |
stfark1
Joined: 02 Sep 2008 Posts: 242
|
Posted: Thu Jun 21, 2018 1:29 pm Post subject: Simple OpenGL Program |
|
|
So Frustrated with this system, cannot post a screen shot so have to type in every line of code and other statements whenever I want to ask question ! BOO bad system!
I finally got the above program to work but there appears to be a memory management problem with the Fortran to OpenGL callable system, the minute that I add more code to above, I get "crazy" output data from OpenGL, zig zag lines all over the place. I would suggest exploring this problem as is not good for the system to act this way, Sid kraft |
|
Back to top |
|
 |
dgurok
Joined: 26 May 2011 Posts: 66
|
Posted: Thu Jun 21, 2018 2:09 pm Post subject: |
|
|
stfark1, did you look at the opengl examples in ftn95 documentation? (use ftn95 /help)
Code: | PROGRAM Simple
INCLUDE <clearwin.ins>,nolist
INCLUDE <opengl.ins>,nolist
REAL t1,t2
INTEGER i, ctrl
i=winio@('%es%ca[Simple OpengGL Sample]&')
i=winio@('%sp%ww[no_border]%og[static]%lw',
* 0, 0, 500, 500, 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 glLoadIdentity()
CALL glOrtho(-1d0, 1d0, -1d0, 1d0, -1d0, 1d0)
CALL glBegin(GL_POLYGON)
C
CALL glColor3f(1.0,0.0,0.0)
CALL glVertex2f(-0.5, -0.5)
C
CALL glColor3f(0.0,1.0,0.0)
CALL glVertex2f(-0.5, 0.5)
C
CALL glColor3f(0.0,0.0,1.0)
CALL glVertex2f( 0.5, 0.5)
C
CALL glColor3f(1.0,0.0,0.0)
CALL glVertex2f( 0.5, -0.5)
CALL glEnd()
CALL glFlush()
END
|
There is also another opengl example which shows you some rotations.
In general, I prefer to use SCC, because in the internet more useful examples are written in C++.
First you should read some simple opengl manuals and understand how opengl works in the basic structure.
Your main code has some basic fortran errors... Dimension N unknown, X,Y,Z initialized incorrectly... and some basic opengl calls are missing... |
|
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
|