enrike wrote:
>
>
> hi
>
>>> when i run my progam it takes 98% of the CPU.
>>> I would like to know some suggestions about who to reduce and
>>> control this.
>>> maybe reducing the fps?. is there any other way?
>>
>>
>>
>> synchronize to vsync -- only draw as many frames as get displayed.
>
>
> sorry. how do i do this? I am kind of new to many of these concepts.
>
It depends on your OS and drivers... nVidia cards under Windows can be
set in the display control panel or using WGL:
if OpenGL.WGL.EXT.swap_control.wglInitSwapControlARB(): #
Returns 1 if it's working
OpenGL.WGL.EXT.swap_control.wglSwapIntervalEXT(1) # Swap
only at frame syncs
if OpenGL.WGL.EXT.swap_control.wglGetSwapIntervalEXT() == 1:
success = 1
In linux, nVidia cards can be set with the environment variable
__GL_SYNC_TO_VBLANK
>
>>> I have been using SDL and there you would tipicly optimise this by
>>> controlling which parts of the screen are updated.
>>>
>>> Another question is if anyone knows some module that implements
>>> python scripts to import images (to use as textures).
>>> I am using Image but this is a rather big module for my pourpose
>>> and would like to use some python based scripts for this.
>>
>>
>>
>> Another option would be pygame -- see, for example:
>> http://cvs.sourceforge.net/viewcvs.py/visionegg/visionegg/src/
>> Textures.py?view=markup
>
>
> yes i know pygame but i actually went into openGL because i need to do
> graphics in a wxpython application frame. Pygame and wxpython dont like
> each other.
Well, how many images are you trying to load? Image doesn't seem
particularly onerous to me...
|