Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

goin to graphics...

red3warlordred3warlord Posts: 77Member
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?

Comments

  • zibadianzibadian Posts: 6,349Member
    : 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:
    [code]
    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
    [/code]
    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.
  • red3warlordred3warlord Posts: 77Member
    : : 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:
    : [code]
    : 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
    : [/code]
    : 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)

  • zibadianzibadian Posts: 6,349Member
    : : : 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:
    : : [code]
    : : 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
    : : [/code]
    : : 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.
    [code]
    // Main program body
    begin
    InitGraph();
    repeat
    GetUserInput;
    HandleUserInput;
    HandleOtherGameElements;
    until EndGame;
    DoneGraph();
    end.
    [/code]
    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.
    [code]
    procedure ShowGraph;
    begin
    InitGraph();
    DrawGraphAxis;
    DrawDataPoints;
    DrawCalibrationLine;
    WaitForKeypress;
    DoneGraph();
    end;

    // Main program body
    begin
    AskUserForFilename;
    ReadFile;
    CalculateCalibrationLine;
    ShowGraph;
    end.
    [/code]
    As you see there is no 1 structure. The only similarity that these two example have is the graphics mode:
    [code]
    InitGraph();
    DoSomethingGraphical;
    CloseGraph();
    [/code]

  • red3warlordred3warlord Posts: 77Member
    : : : : 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:
    : : : [code]
    : : : 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
    : : : [/code]
    : : : 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.
    : [code]
    : // Main program body
    : begin
    : InitGraph();
    : repeat
    : GetUserInput;
    : HandleUserInput;
    : HandleOtherGameElements;
    : until EndGame;
    : DoneGraph();
    : end.
    : [/code]
    : 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.
    : [code]
    : procedure ShowGraph;
    : begin
    : InitGraph();
    : DrawGraphAxis;
    : DrawDataPoints;
    : DrawCalibrationLine;
    : WaitForKeypress;
    : DoneGraph();
    : end;
    :
    : // Main program body
    : begin
    : AskUserForFilename;
    : ReadFile;
    : CalculateCalibrationLine;
    : ShowGraph;
    : end.
    : [/code]
    : As you see there is no 1 structure. The only similarity that these two example have is the graphics mode:
    : [code]
    : InitGraph();
    : DoSomethingGraphical;
    : CloseGraph();
    : [/code]
    :
    :
    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.....

  • zibadianzibadian Posts: 6,349Member
    : : : : : 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:
    : : : : [code]
    : : : : 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
    : : : : [/code]
    : : : : 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.
    : : [code]
    : : // Main program body
    : : begin
    : : InitGraph();
    : : repeat
    : : GetUserInput;
    : : HandleUserInput;
    : : HandleOtherGameElements;
    : : until EndGame;
    : : DoneGraph();
    : : end.
    : : [/code]
    : : 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.
    : : [code]
    : : procedure ShowGraph;
    : : begin
    : : InitGraph();
    : : DrawGraphAxis;
    : : DrawDataPoints;
    : : DrawCalibrationLine;
    : : WaitForKeypress;
    : : DoneGraph();
    : : end;
    : :
    : : // Main program body
    : : begin
    : : AskUserForFilename;
    : : ReadFile;
    : : CalculateCalibrationLine;
    : : ShowGraph;
    : : end.
    : : [/code]
    : : As you see there is no 1 structure. The only similarity that these two example have is the graphics mode:
    : : [code]
    : : InitGraph();
    : : DoSomethingGraphical;
    : : CloseGraph();
    : : [/code]
    : :
    : :
    : 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.....
    :
    :
    Here is a simple example code based on the example in the help files:
    [code]
    uses
    Graph, Crt;

    var
    grMode: integer;
    begin
    InitGraph(Detect, grMode, '');
    if GraphResult = grOK then
    begin
    Line(20, 20, 50, 50);
    ReadKey;
    CloseGraph;
    end;
    end.
    [/code]
Sign In or Register to comment.