PDA

View Full Version : OpenGLed but slow



piccaliili
11-18-2003, 05:51 AM
Hello everyone! http://www.opengl.org/discussion_boards/ubb/smile.gif

I'm a college student I'm writing a program for my faculty, and I meet with some bottleneck here:

it's a demonstration of some particles moving around, and I do it like this: a timer call InvalidateRect every 50ms, and in OnPaint, I call a function updates the particles' positions and redraw the whole scene, it was ok, but after I add some texture mapping on the experiment devices, the speed becomes unbearably slow, I think redrawing the whole scene rapidly cost much resource, but I wonder how those 3D games make it? For examp, in a tank game, when a tank fires a bullet out, don't it need to redraw the whole scene?

So I need some help to boost my program's performance here ...

Thank you ahead!

ps: I used gluBuild2DMipmap, I've already seen in some post that it's slow, but I don't know what to take the place of it...

kansler
11-18-2003, 06:21 AM
First, the obvious questions:

Does your test-computer contain a videocard which accelerates opengl?

If so, are the correct drivers for this card installed?

And are you requesting an accelerated pixel format?

V-man
11-18-2003, 11:14 AM
Using gluBuild2DMipmap in your paint function?

piccaliili
11-18-2003, 06:38 PM
Originally posted by V-man:
Using gluBuild2DMipmap in your paint function?

Yep, the paint function repaints everything on the screen, including the texture.

piccaliili
11-18-2003, 06:45 PM
Originally posted by kansler:
First, the obvious questions:

Does your test-computer contain a videocard which accelerates opengl?

If so, are the correct drivers for this card installed?

And are you requesting an accelerated pixel format?

I think the video card supports at least OpenGL 1.1 and the operation system is Windows 2000; and when I rotate or translate the world coordinate by the mouse, it's not slow, just when I call the timer to reposition the particles and repaint the screen, the particles seems moving more slowly with the texture.


[This message has been edited by piccaliili (edited 11-18-2003).]

[This message has been edited by piccaliili (edited 11-18-2003).]

kansler
11-19-2003, 12:43 AM
And what do the functions

glGetString(GL_RENDERER)
and
glGetString(GL_VENDOR)

return?

Mazy
11-19-2003, 12:47 AM
gluBuild2DMipmap upload a texture to opengl, no need to do that more than once if you dont change teh content of it each frame

Relic
11-19-2003, 01:53 AM
If you use more than one texture, use texture objects. Functions are glGenTextures, glBindTexture, glDeleteTextures.
Texture objects store TexParameter with them.
Texture object id 0 is the immediate (default) texture if you need to switch back from a texture object to the immediate texture.

piccaliili
11-19-2003, 05:09 AM
Wow, I got it, thank you all!