Allegro.cc - Online Community

Allegro.cc Forums » Installation, Setup & Configuration » When using 'line()' , the allegro app is bugging.

This thread is locked; no one can reply to it. rss feed Print
When using 'line()' , the allegro app is bugging.
evert edel
Member #8,217
January 2007

Hello all ,

I'm evert , and new to allegro. But i'm using allegro for my school project that needs to be finished in a few weeks. I've followed some allegro tutorials and I feld ready to start on my game.

So i started with selection stuff : drawing a selection box to select the units. But here comes the problem ; I'm drawing that box with 4 lines().

My code is allright and i'm having the same problems on code that some people from the irc channel have written for me.

The 'game' is just lagging like hell when i draw my selection box , also there is a big latency on the time my mouse moves , and the selection box is drawn on the screen. When i try it on a ubuntu live cd , it all works great.

So my code is just all-right :).

I'm using gentoo linux , but I really don't know a solution or fix for this. Is there a list of required packages ? So i can check i'm not missing a stupid package ?

Already thanks , evert

GullRaDriel
Member #3,861
September 2003
avatar

Install your grafic card driver.

You have an Nvidia, Ati ?

"Code is like shit - it only smells if it is not yours"
Allegro Wiki, full of examples and articles !!

gnolam
Member #2,030
March 2002
avatar

Quote:

I'm drawing that box with 4 lines()

Why not a rect()? :)

--
Move to the Democratic People's Republic of Vivendi Universal (formerly known as Sweden) - officially democracy- and privacy-free since 2008-06-18!

GullRaDriel
Member #3,861
September 2003
avatar

And do not draw directly to screen.

Draw to a buffer and blit the buffer onto the screen !

"Code is like shit - it only smells if it is not yours"
Allegro Wiki, full of examples and articles !!

evert edel
Member #8,217
January 2007

Wow , a lot of answers in a short period of time :). Thanks already.

I'm having installed nvidia drivers , and it's working on the live cd wich even doesn't has got nvidia drivers.

Quote:

evert@localhost ~/C++/GIP $ glxinfo |grep direct
direct rendering: Yes

So that's ok.

I'm ofcourse using a buffer , so not directly drawing to the screen. And without a buffer it also wouldn't have worked on that live cd.

Why not using a rect() ? The same problem is going on with a rect (only a bit less lagging) , and i'm going to implement in the future still some elements why i need that line in place of rect().

Evert
Member #794
November 2000
avatar

Quote:

I'm evert

Prove it! :P

Anyway, do you have some example code that shows the problem (the smallest code sample you can write that compiles)? It's hard to say what's wrong without actually seeing the code in question.

Aside, what version of Allegro are you using?

GullRaDriel
Member #3,861
September 2003
avatar

Evert+1 !

Yeah. Now we do need some code to see what is going wrong.

_

"Code is like shit - it only smells if it is not yours"
Allegro Wiki, full of examples and articles !!

evert edel
Member #8,217
January 2007

Ok , here some code what normally needs to work. Like i said , the problem isn't the code ... Because it is working on other systems / live cd's.

http://www.pastebin.be/5164/

edit : Hmm i see i'm not using 'line()' in this code (it isn't even my code , i got it from mimix on irc for testing) but this code has got the same lagging problem.

Evert
Member #794
November 2000
avatar

Can't reproduce the problem on my system (KDE/gentoo with an oldish kernel).
I'm inclined to say it's a problem with the way your system is set up rather than a problem with your code. Are there any other processes using up CPU time in the background?

evert edel
Member #8,217
January 2007

I know it's a problem with my gentoo install, because with a live cd and by other people it is working....

There is no other proces using my cpu power , direct rendering is enabled , ... So i really can't see what's the problem ???

James Stanley
Member #7,275
May 2006
avatar

It worked fine for me, so I don't know what your problem is, but try:

1.) Compile with -O3
2.) Update your whole system
3.) Allegro uses software rendering, not OpenGL, so your graphics drivers are irrelevant (AFAIK...)
4.) Show us the compile command you are using

Marco Radaelli
Member #3,028
December 2002
avatar

I hope you haven't re-emerged your GUI library like I told you on IRC, because I understood you were talking about selection boxes in GTK / Qt.

In case, I'm sorry for my misunderstanding :-/

evert edel
Member #8,217
January 2007

I'm compiling it with the following command :
g++ main.cpp unit.cpp 2dmath.cpp input.cpp gui.cpp game.cpp `allegro-config --cflags --static` -o risk

Hehe no problem about the miscomprehension , i've got recompiled my whole KDE , but that was not only and just for allegro. I needed it to do for some new use-flags etc.

James Stanley
Member #7,275
May 2006
avatar

Why are you static linking?

I'm not saying it's bad, just asking why. I usually only static link when I distribute a binary.

evert edel
Member #8,217
January 2007

To be honest , i did it at the very first , when i got the 'compile command' from the allegro IRC channel. I was new to allegro and i didn't knew how to compile stuff with it.

After that i kept using the static , because it's easy to test that executable somewhere else. It's not doing some bad stuff as far as I know ?

Neil Walker
Member #210
April 2000
avatar

so is it the mouse causing the delay or the drawing?

I suggest you remove stuff and retry to narrow it down, e.g. is it the timer, the rect, the drawing buffer, the mouse, etc.

Neil.
MAME Cabinet Blog / AXL LIBRARY (a games framework) / AXL Documentation and Tutorial

wii:0356-1384-6687-2022, kart:3308-4806-6002. XBOX:chucklepie

evert edel
Member #8,217
January 2007

But the same problem is happening with real basic test code they gave me at the Allegro IRC channel , so the problem isn't the code , neither my system. (I guess something in my gentoo).

Go to: