Pascal

Moderators: None (Apply to moderate this forum)
Number of threads: 4095
Number of posts: 14004

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
goin to graphics... Posted by red3warlord on 20 Jan 2007 at 8:17 PM
hanks for your help... i had been acceleraed my subject in pascal because you had insructed me how to make it il he end...
now, i am entering the world of graphics...

how would i start?
Report
Re: goin to graphics... Posted by zibadian on 20 Jan 2007 at 10:33 PM
: hanks for your help... i had been acceleraed my subject in pascal because you had insructed me how to make it il he end...
: now, i am entering the world of graphics...
:
: how would i start?
:
Take a look at the graphics demo, and the procedures in the Graphs unit. The basic layout of the graphics is this:
  InitGraph() // initialize the graphics mode with supplied parameters
  // Use the graphics routines, such as Bar(), Arc(), Line(), LineTo(),
     OutTextXY()
  GloseGraph() // close the graphics mode and go back to text mode

The help files on the graphics unit holds the explanation and a list of all the procedures/functions.
Start by at least reading the entry for InitGraph() and CloseGraph(). Then you can selectively read the entries for various routines to see what they do. Start by drawing simple shapes, such as a square or a circle on the screen. Then try to change its color. Once you are confident in doing that, you can continue by mixing various shapes to produce simple drawings. A nice drawing would be a stick figure or a snowman. Once there all that's left for 2D graphics is some more practice.
For 3D-graphics you need to have a soldi understanding of vector arithmatics and projections from 3D to 2D. The Pascal code of 3D graphics is not much more difficult than 2D graphics, only the maths behind it are more difficult.
Report
Re: goin to graphics... Posted by red3warlord on 21 Jan 2007 at 10:16 PM
: : hanks for your help... i had been acceleraed my subject in pascal because you had insructed me how to make it il he end...
: : now, i am entering the world of graphics...
: :
: : how would i start?
: :
: Take a look at the graphics demo, and the procedures in the Graphs unit. The basic layout of the graphics is this:
:
:   InitGraph() // initialize the graphics mode with supplied parameters
:   // Use the graphics routines, such as Bar(), Arc(), Line(), LineTo(),
:      OutTextXY()
:   GloseGraph() // close the graphics mode and go back to text mode
: 

: The help files on the graphics unit holds the explanation and a list of all the procedures/functions.
: Start by at least reading the entry for InitGraph() and CloseGraph(). Then you can selectively read the entries for various routines to see what they do. Start by drawing simple shapes, such as a square or a circle on the screen. Then try to change its color. Once you are confident in doing that, you can continue by mixing various shapes to produce simple drawings. A nice drawing would be a stick figure or a snowman. Once there all that's left for 2D graphics is some more practice.
: For 3D-graphics you need to have a soldi understanding of vector arithmatics and projections from 3D to 2D. The Pascal code of 3D graphics is not much more difficult than 2D graphics, only the maths behind it are more difficult.
:
i can't understand how the program goes....
can u simplify it?

f u don't mind, may i have the structure of a simple graphical sourcecode? (just the structure, not the code itself)

Report
Re: goin to graphics... Posted by zibadian on 21 Jan 2007 at 11:10 PM
: : : hanks for your help... i had been acceleraed my subject in pascal because you had insructed me how to make it il he end...
: : : now, i am entering the world of graphics...
: : :
: : : how would i start?
: : :
: : Take a look at the graphics demo, and the procedures in the Graphs unit. The basic layout of the graphics is this:
: :
: :   InitGraph() // initialize the graphics mode with supplied parameters
: :   // Use the graphics routines, such as Bar(), Arc(), Line(), LineTo(),
: :      OutTextXY()
: :   GloseGraph() // close the graphics mode and go back to text mode
: : 

: : The help files on the graphics unit holds the explanation and a list of all the procedures/functions.
: : Start by at least reading the entry for InitGraph() and CloseGraph(). Then you can selectively read the entries for various routines to see what they do. Start by drawing simple shapes, such as a square or a circle on the screen. Then try to change its color. Once you are confident in doing that, you can continue by mixing various shapes to produce simple drawings. A nice drawing would be a stick figure or a snowman. Once there all that's left for 2D graphics is some more practice.
: : For 3D-graphics you need to have a soldi understanding of vector arithmatics and projections from 3D to 2D. The Pascal code of 3D graphics is not much more difficult than 2D graphics, only the maths behind it are more difficult.
: :
: i can't understand how the program goes....
: can u simplify it?
:
: f u don't mind, may i have the structure of a simple graphical sourcecode? (just the structure, not the code itself)
:
:
The precise structure depends on wether or not the program is completely graphical or also has text-based parts. The very least, which is necessary, is to initialize the graphics mode and to finalize it again. This is done using the InitGraph() and CloseGraph() procedures. Everything else is dependent on what the program is intended to do.
2 examples:
a game would require a loop, which handles the user input and update the location of various game objects.
// Main program body
begin
  InitGraph();
  repeat
    GetUserInput;
    HandleUserInput;
    HandleOtherGameElements;
  until EndGame;
  DoneGraph();
end.

A simple scientific program to calculate a calibration line and show it would only switch to graphics mode, when showing a graph, and otherwise it would be text mode.
procedure ShowGraph;
begin
  InitGraph();
  DrawGraphAxis;
  DrawDataPoints;
  DrawCalibrationLine;
  WaitForKeypress;
  DoneGraph();
end;

// Main program body
begin
  AskUserForFilename;
  ReadFile;
  CalculateCalibrationLine;
  ShowGraph;
end.

As you see there is no 1 structure. The only similarity that these two example have is the graphics mode:
  InitGraph();
  DoSomethingGraphical;
  CloseGraph();


Report
Re: goin to graphics... Posted by red3warlord on 22 Jan 2007 at 6:56 PM
: : : : hanks for your help... i had been acceleraed my subject in pascal because you had insructed me how to make it il he end...
: : : : now, i am entering the world of graphics...
: : : :
: : : : how would i start?
: : : :
: : : Take a look at the graphics demo, and the procedures in the Graphs unit. The basic layout of the graphics is this:
: : :
: : :   InitGraph() // initialize the graphics mode with supplied parameters
: : :   // Use the graphics routines, such as Bar(), Arc(), Line(), LineTo(),
: : :      OutTextXY()
: : :   GloseGraph() // close the graphics mode and go back to text mode
: : : 

: : : The help files on the graphics unit holds the explanation and a list of all the procedures/functions.
: : : Start by at least reading the entry for InitGraph() and CloseGraph(). Then you can selectively read the entries for various routines to see what they do. Start by drawing simple shapes, such as a square or a circle on the screen. Then try to change its color. Once you are confident in doing that, you can continue by mixing various shapes to produce simple drawings. A nice drawing would be a stick figure or a snowman. Once there all that's left for 2D graphics is some more practice.
: : : For 3D-graphics you need to have a soldi understanding of vector arithmatics and projections from 3D to 2D. The Pascal code of 3D graphics is not much more difficult than 2D graphics, only the maths behind it are more difficult.
: : :
: : i can't understand how the program goes....
: : can u simplify it?
: :
: : f u don't mind, may i have the structure of a simple graphical sourcecode? (just the structure, not the code itself)
: :
: :
: The precise structure depends on wether or not the program is completely graphical or also has text-based parts. The very least, which is necessary, is to initialize the graphics mode and to finalize it again. This is done using the InitGraph() and CloseGraph() procedures. Everything else is dependent on what the program is intended to do.
: 2 examples:
: a game would require a loop, which handles the user input and update the location of various game objects.
:
: // Main program body
: begin
:   InitGraph();
:   repeat
:     GetUserInput;
:     HandleUserInput;
:     HandleOtherGameElements;
:   until EndGame;
:   DoneGraph();
: end.
: 

: A simple scientific program to calculate a calibration line and show it would only switch to graphics mode, when showing a graph, and otherwise it would be text mode.
:
: procedure ShowGraph;
: begin
:   InitGraph();
:   DrawGraphAxis;
:   DrawDataPoints;
:   DrawCalibrationLine;
:   WaitForKeypress;
:   DoneGraph();
: end;
: 
: // Main program body
: begin
:   AskUserForFilename;
:   ReadFile;
:   CalculateCalibrationLine;
:   ShowGraph;
: end.
: 

: As you see there is no 1 structure. The only similarity that these two example have is the graphics mode:
:
:   InitGraph();
:   DoSomethingGraphical;
:   CloseGraph();
: 

:
:
i still don't get it
what are you meaning to say?
sorry if i had a hard time to understand what you had explain to me but, i can't manage to memorize everything what you had given....
i just want to have a very simple program so that i could catch it up with ease....

can u share the most simpliest code you have? if it's ok to you.... thanks for your concern

i would gladly appreciate if you would.....
<from red3warlord with gratitude>
Report
Re: goin to graphics... Posted by zibadian on 22 Jan 2007 at 10:20 PM
: : : : : hanks for your help... i had been acceleraed my subject in pascal because you had insructed me how to make it il he end...
: : : : : now, i am entering the world of graphics...
: : : : :
: : : : : how would i start?
: : : : :
: : : : Take a look at the graphics demo, and the procedures in the Graphs unit. The basic layout of the graphics is this:
: : : :
: : : :   InitGraph() // initialize the graphics mode with supplied parameters
: : : :   // Use the graphics routines, such as Bar(), Arc(), Line(), LineTo(),
: : : :      OutTextXY()
: : : :   GloseGraph() // close the graphics mode and go back to text mode
: : : : 

: : : : The help files on the graphics unit holds the explanation and a list of all the procedures/functions.
: : : : Start by at least reading the entry for InitGraph() and CloseGraph(). Then you can selectively read the entries for various routines to see what they do. Start by drawing simple shapes, such as a square or a circle on the screen. Then try to change its color. Once you are confident in doing that, you can continue by mixing various shapes to produce simple drawings. A nice drawing would be a stick figure or a snowman. Once there all that's left for 2D graphics is some more practice.
: : : : For 3D-graphics you need to have a soldi understanding of vector arithmatics and projections from 3D to 2D. The Pascal code of 3D graphics is not much more difficult than 2D graphics, only the maths behind it are more difficult.
: : : :
: : : i can't understand how the program goes....
: : : can u simplify it?
: : :
: : : f u don't mind, may i have the structure of a simple graphical sourcecode? (just the structure, not the code itself)
: : :
: : :
: : The precise structure depends on wether or not the program is completely graphical or also has text-based parts. The very least, which is necessary, is to initialize the graphics mode and to finalize it again. This is done using the InitGraph() and CloseGraph() procedures. Everything else is dependent on what the program is intended to do.
: : 2 examples:
: : a game would require a loop, which handles the user input and update the location of various game objects.
: :
: : // Main program body
: : begin
: :   InitGraph();
: :   repeat
: :     GetUserInput;
: :     HandleUserInput;
: :     HandleOtherGameElements;
: :   until EndGame;
: :   DoneGraph();
: : end.
: : 

: : A simple scientific program to calculate a calibration line and show it would only switch to graphics mode, when showing a graph, and otherwise it would be text mode.
: :
: : procedure ShowGraph;
: : begin
: :   InitGraph();
: :   DrawGraphAxis;
: :   DrawDataPoints;
: :   DrawCalibrationLine;
: :   WaitForKeypress;
: :   DoneGraph();
: : end;
: : 
: : // Main program body
: : begin
: :   AskUserForFilename;
: :   ReadFile;
: :   CalculateCalibrationLine;
: :   ShowGraph;
: : end.
: : 

: : As you see there is no 1 structure. The only similarity that these two example have is the graphics mode:
: :
: :   InitGraph();
: :   DoSomethingGraphical;
: :   CloseGraph();
: : 

: :
: :
: i still don't get it
: what are you meaning to say?
: sorry if i had a hard time to understand what you had explain to me but, i can't manage to memorize everything what you had given....
: i just want to have a very simple program so that i could catch it up with ease....
:
: can u share the most simpliest code you have? if it's ok to you.... thanks for your concern
:
: i would gladly appreciate if you would.....
: <from red3warlord with gratitude>
:
Here is a simple example code based on the example in the help files:
uses
  Graph, Crt;

var
  grMode: integer;
begin
  InitGraph(Detect, grMode, '');
  if GraphResult = grOK then
  begin
    Line(20, 20, 50, 50);
    ReadKey;
    CloseGraph;
  end;
end.




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.