PDA

View Full Version : how to draw a line with C++ without using OPENGL?



bahador.saket
June 29th, 2010, 07:16 PM
Dear all

I am going to write the text editor.
I want to make it more interested by using some graphical shapes.
how can I draw a line or some shapes without using OpenGL?

Cheers,
Bahador

(I am beginner)

Tahakki
June 29th, 2010, 07:18 PM
SDL, possibly?

Yes
June 29th, 2010, 08:08 PM
If you just need simple shapes like lines or circles, drawing them directly with X will probably work.

phrostbyte
June 30th, 2010, 01:55 AM
In Xlib the function is XDrawLine (http://tronche.com/gui/x/xlib/graphics/drawing/XDrawLine.html).

You can also use Qt or Cario for portability.

Tahakki
June 30th, 2010, 09:40 AM
Cairo is very nice, and easy to extend into Clutter if you want animations and things.

bahador.saket
June 30th, 2010, 10:21 AM
Tnx for your helps.



In Xlib the function is XDrawLine (http://tronche.com/gui/x/xlib/graphics/drawing/XDrawLine.html).

You can also use Qt or Cario for portability.



Can you please bring the example of how to use XDrawLine()?

Cheers,
Bahador

bahador.saket
June 30th, 2010, 10:34 AM
I am trying to use cario, I have run a program in following link.

http://library.gnome.org/devel/gtkmm-tutorial/stable/sec-cairo-drawing-lines.html.en

but my editor (codeblock) can not recognize #include <gtkmm/drawingarea.h>
what should i do?

Yes
June 30th, 2010, 04:11 PM
Here's a good tutorial for using Xlib: http://users.actcom.co.il/~choo/lupg/tutorials/xlib-programming/xlib-programming.html#preface. Search for XDrawLine to get to the bit about that.

You have gtkmm installed, right?

bahador.saket
July 3rd, 2010, 04:21 AM
tnx guys, I could solve my problem with some things like setconsole........() functions.

bstree
September 5th, 2010, 07:38 AM
hi,

i created window with menu and drawing area in a v-box.

i am trying to draw a line on with cairo but the line have the offset of the menu.

how do i fix this