Slow drawing

Hi.

I’m kinda new do C++, SDL and OpenGL, i’m working on a game, but when
drawing a tile map it slows down a great deal. I’m using opengl and each
tile is a quad, but this only results in 2000 polys, not a huge amount
for my system (amd64 3500+ radeon x800xt) yet the drawing starts to
crawl. I can run ut2004 and doom3 at nice frame rates.

If anyone has nothing better to do could you take a look at my code and
see where i’m going wrong. It probably won’t build in it’s current state
on windows as i use linux (ubuntu) most of the time.

download from http://ratty.ath.cx/junk/Dizzy-0.1.tar.gz

“make install” is probably a bad idea for the moment, just do:

./configure
make
cd src
./dizzy

arrow keys move the player around, it moves 1 pixel per frame.

Thanks

-Ratty

I’m not good enough at REAL coding to compile your source code, since
I’m on Windows/Mac, but I know that immediate-mode drawing for OpenGL
can be VERY slow indeed, which may explain your particular situation.

You didn’t mention this, so are you using display lists in OpenGL for
each tile type? That speeds up rendering SO fast, I cannot begin to
describe it! :slight_smile: I have worked out the beginnings of a Java 3D game
framework, and I can render multi-thousand poly models at full
framerate (more than 75 fps – monitor refresh) using display lists.
Without, it starts choking at anywhere near a few thousand.

Look up display lists online if you aren’t using them. It’s pretty
simple, I just don’t remember the function names offhand. Basically
you tell openGL you’re starting a list (when you first make the poly
object/instance/whatever it’s called not an object – can you tell
I’m a Java programmer?), then do your drawing code as normal, and
close the list. Like loading textures, you’re given a number for the
list, and you simply call the list using that number whenever you
need to draw that 3D object. :slight_smile:

I hope I’ve not been TOO obscure in my description. Look up display
lists for OpenGL and they’ll probly be clearer.
–ScottOn 22 Jul, 2005, at 9:08 PM, Ratty wrote:

Hi.

I’m kinda new do C++, SDL and OpenGL, i’m working on a game, but
when drawing a tile map it slows down a great deal. I’m using
opengl and each tile is a quad, but this only results in 2000
polys, not a huge amount for my system (amd64 3500+ radeon x800xt)
yet the drawing starts to crawl. I can run ut2004 and doom3 at nice
frame rates.

If anyone has nothing better to do could you take a look at my code
and see where i’m going wrong. It probably won’t build in it’s
current state on windows as i use linux (ubuntu) most of the time.

download from http://ratty.ath.cx/junk/Dizzy-0.1.tar.gz

“make install” is probably a bad idea for the moment, just do:

./configure
make
cd src
./dizzy

arrow keys move the player around, it moves 1 pixel per frame.

Thanks

-Ratty


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

Display lists are your friend…use them for, errmm, just about
everything. :slight_smile:

-Matt Bailey

On Friday 22 July 2005 23:14, Scott Harper set 1,000 monkies in front of
keyboards and came up with the following:> I’m not good enough at REAL coding to compile your source code, since

I’m on Windows/Mac, but I know that immediate-mode drawing for OpenGL
can be VERY slow indeed, which may explain your particular situation.

You didn’t mention this, so are you using display lists in OpenGL for
each tile type? That speeds up rendering SO fast, I cannot begin to
describe it! :slight_smile: I have worked out the beginnings of a Java 3D game
framework, and I can render multi-thousand poly models at full
framerate (more than 75 fps – monitor refresh) using display lists.
Without, it starts choking at anywhere near a few thousand.

Look up display lists online if you aren’t using them. It’s pretty
simple, I just don’t remember the function names offhand. Basically
you tell openGL you’re starting a list (when you first make the poly
object/instance/whatever it’s called not an object – can you tell
I’m a Java programmer?), then do your drawing code as normal, and
close the list. Like loading textures, you’re given a number for the
list, and you simply call the list using that number whenever you
need to draw that 3D object. :slight_smile:

I hope I’ve not been TOO obscure in my description. Look up display
lists for OpenGL and they’ll probly be clearer.
–Scott

Umm… Can you use them for characters who animate? Well, I guess
you could for frame-based animation. But skeletal animation with
weighted vertices and such seems unlikely…?

–ScottOn 22 Jul, 2005, at 11:09 PM, Matt Bailey wrote:

Display lists are your friend…use them for, errmm, just about
everything. :slight_smile:

-Matt Bailey

You can’t change the geometry after compiling the list, no. It’s good if you
only need to do a bunch of matrix translations/rotations. In my case, and
probably for most reasonably simple 3D games, all movement can be handled
nicely with translations & rotations. Notice I said "just about"
everything. :slight_smile:

-Matt Bailey

On Saturday 23 July 2005 01:10, Scott Harper set 1,000 monkies in front of
keyboards and came up with the following:> Umm… Can you use them for characters who animate? Well, I guess

you could for frame-based animation. But skeletal animation with
weighted vertices and such seems unlikely…?

–Scott

On 22 Jul, 2005, at 11:09 PM, Matt Bailey wrote:

Display lists are your friend…use them for, errmm, just about
everything. :slight_smile:

-Matt Bailey

You might be able to pull of DL with skeletal animation by doing a DL
for each set of verticies tied to a bone and then just send the ones at
the joint each frame.

Just a thought.

HTH,
Richard

Scott Harper wrote:> Umm… Can you use them for characters who animate? Well, I guess

you could for frame-based animation. But skeletal animation with
weighted vertices and such seems unlikely…?

–Scott

On 22 Jul, 2005, at 11:09 PM, Matt Bailey wrote:

Display lists are your friend…use them for, errmm, just about
everything. :slight_smile:

-Matt Bailey

SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

Umm… Can you use them for characters who animate? Well, I guess
you could for frame-based animation. But skeletal animation with
weighted vertices and such seems unlikely…?

That is what vertex arrays are for. It also helps to have a system with a
shared memory architecture, but that isn’t common on PCs.On Sat, 23 Jul 2005, Scott Harper wrote:

–Scott

On 22 Jul, 2005, at 11:09 PM, Matt Bailey wrote:

Display lists are your friend…use them for, errmm, just about
everything. :slight_smile:

-Matt Bailey


Jeff Jackowski
http://ro.com/~jeffj/