Michel Dänzer wrote:
> On Mon, 2007-04-09 at 16:44 +0200, Agustin Rubio Mingorance wrote:
>
>> I'm writting a 2D-app with double buffering. I use the env variable
>> vblank_mode=3
>> for syncing to vblank and avoiding tearing. The monitor VertRefresh is
>> set at 60 Hz.
>>
>> I'm using Xorg 7.1.1 + mesa 6.51 + i810 1.7.2
>>
>
> A lot of improvements have been made in this area recently. I recommend
> at least Mesa 6.5.2 or git and i915 DRM 1.6 or newer, possibly also a
> newer version of xf86-video-intel.
>
>
>
Hi,
I still have the problem with the new versions of Mesa and DRM.
I have noticed that the problem only appears in apps where I use textures.
I send a example below that get 27 FPS, no matter what value vblank_mode
has (vert refresh is 60 Hz).
¿Any idea?
Thanks in advance
//main.cpp
extern "C"{
#include <GL/gl.h>
#include <GL/glut.h>
}
#include <iostream>
int fps_time = 0;
int fps_timebase = 0;
int frame = 0;
int sleep_time = 0;
#define TEXT_NUM 1
#define TEXT_SIZE 256
GLuint textures[TEXT_NUM];
void initGL (int argc, char* argv[])
{
unsigned char* bitmap = new unsigned char [TEXT_SIZE * TEXT_SIZE * 3];
//Color
for (int i = 0; i < TEXT_SIZE * TEXT_SIZE * 3; i += 3){
bitmap[i] = (i * 4) % 256;
bitmap[i + 1] = 0;
bitmap[i + 2] = 0;
glGenTextures (TEXT_NUM , textures);
glEnable (GL_TEXTURE_2D);
for (int i = 0; i < TEXT_NUM; i++){
glBindTexture (GL_TEXTURE_2D, textures[i]);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, TEXT_SIZE, TEXT_SIZE,
0, GL_RGB, GL_UNSIGNED_BYTE, bitmap);
}
delete[] bitmap;
}
void
keyPressed(unsigned char key, int x, int y)
{
if (key == 'q') {
exit (0);
}
}
void
drawGLScene()
{
frame++;
fps_time = glutGet (GLUT_ELAPSED_TIME);
if((fps_time - fps_timebase) > 1000){
std::cout << "FPS:" << (1000 * frame) / (fps_time - fps_timebase)
<< std::endl;
frame = 0;
fps_timebase = fps_time;
}
float w = 200;
float h = 75;
float x = 0.0;
for (int i = 0; i < 4; i++){
float y = 0.0;
for (int j = 0; j < 8; j++){
glBindTexture (GL_TEXTURE_2D, textures[(j * 4) % TEXT_NUM]);
glBegin (GL_QUADS);
glVertex3f (x, y, -5);
glTexCoord2f (0.0, 0.0);
glVertex3f (x + w, y, -5);
glTexCoord2f (1.0, 0.0);
glVertex3f (x +w, y +h, -5);
glTexCoord2f (1.0, 1.0);
glVertex3f (x, y + h, -5);
glTexCoord2f (0.0, 1.0);
glEnd();
y += h;
}
x += w;
}
glutSwapBuffers();
}
void
idle()
{
glutPostRedisplay ();
}
int
main (int argc, char* argv[])
{
glutInit (&argc, argv);
glutInitDisplayMode (GLUT_RGBA| GLUT_DOUBLE );
glutInitWindowSize (800, 600);
glutInitWindowPosition (100, 100);
glutCreateWindow ("");
glClearColor (0.0f, 0.0f, 0.0f, 0.0f);
glMatrixMode (GL_PROJECTION);
glLoadIdentity ();
glOrtho (0, 800, 0, 600, 0, 500);
glMatrixMode (GL_MODELVIEW);
glutSetCursor(GLUT_CURSOR_NONE);
glShadeModel (GL_FLAT);
glDisable (GL_DITHER);
glEnable (GL_BLEND);
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glDisable(GL_DITHER);
initGL (argc, argv);
glutIdleFunc (idle);
glutReshapeFunc (0);
glutKeyboardFunc (keyPressed);
glutDisplayFunc (drawGLScene);
glutMainLoop ();
return 0;
}
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Mesa3d-dev mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev