🔒 Locked
Does double buffer work?
Advertisement
Original Post
Hello,
I am new to OpenGl, and I just wrote OpenGL tetris.
It runs in 800x600 (fullscreen), but I have the following problem. Although I have 100+ fps, you can clearly see redrawing of the screen.
(in fact 640x480 is the same issue)
It is strange, however, because I am trying to
use doublebuffer via nehe''s code:
DrawGLScene(); SwapBuffers(hDC);
Is any possibility for example for retrace waiting or something like that, or am I missing something obvious here.
Thanks a lot for answers.
Jan.
and one more thing. I turned off VSync and
it seems to have 350+ frames.
for interested people, try
http://www.volny.cz/kavani/alfaverz.rar
It is just work version of my tetris, so take it easy :-) No criticising yet, please. Just try to help me to spot my mistake.
Thanks a lot
Jan
it seems to have 350+ frames.
for interested people, try
http://www.volny.cz/kavani/alfaverz.rar
It is just work version of my tetris, so take it easy :-) No criticising yet, please. Just try to help me to spot my mistake.
Thanks a lot
Jan
Thanks,
I have nVidia GeForce4 MX-420 with latest detonators,
I tried it also on some ATI Cards and problem occurs also there.
Note, that it isn''t visible on the first look. You have to watch
the falling piece, because it''s the only one where I am able to spot the problem. Somehow it looks like it''s leaving trace of some kind behind. And also it starts from the second half of the screen.
Jan
I have nVidia GeForce4 MX-420 with latest detonators,
I tried it also on some ATI Cards and problem occurs also there.
Note, that it isn''t visible on the first look. You have to watch
the falling piece, because it''s the only one where I am able to spot the problem. Somehow it looks like it''s leaving trace of some kind behind. And also it starts from the second half of the screen.
Jan
if you watch the rotating one you see the same..
my questions:
what sort of depthtest do you do?
do you perform some sort of backfaceculling?
could you post the code for:
drawing the cubes
setting the base settings (depthbuffer/backfaceculling and such)
"take a look around" - limp bizkit
www.google.com
my questions:
what sort of depthtest do you do?
do you perform some sort of backfaceculling?
could you post the code for:
drawing the cubes
setting the base settings (depthbuffer/backfaceculling and such)
"take a look around" - limp bizkit
www.google.com
Thanks a lot for your reply.
It seems I don''t know a lot of things.
Well, actually what I am doing here is following:
I have a matrix int field[24][12].
I''ve created a list
tetris_block = glGenLists(1);
glNewList(tetris_block,GL_COMPILE);
glBegin(GL_QUADS);
... Definition of simple Cube follows ...
glEnd();
glEndList();
Engine actually works only with 2d matrix, where it sets
numbers according to game. (0 - no cube in this place,
1 - static cube in this place, 2 - active piece I am
"driving" now) So rotations and so is done thus. The whole
drawing is done by walking through this matrix and calling
glCallList(tetris_block) on positions:
1
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
...
...
for (loopy = 0;loopy < PLAYFIELDY;loopy++) {
for (loopx = 0;loopx < 12;loopx++) {
if (field[loopy][loopx] > 0) {
glColor3f(1.0f,1.0f,1.0f);
glLoadIdentity();
glTranslatef(loopx*0.6+XBORDER,YTOP-0.6*loopy,-20.0f);
glCallList(tetris_block);
}
}
}
where XBORDER is leftomost position on SCREEN.
And that''s about it.
Thanks again
Jan
It seems I don''t know a lot of things.
Well, actually what I am doing here is following:
I have a matrix int field[24][12].
I''ve created a list
tetris_block = glGenLists(1);
glNewList(tetris_block,GL_COMPILE);
glBegin(GL_QUADS);
... Definition of simple Cube follows ...
glEnd();
glEndList();
Engine actually works only with 2d matrix, where it sets
numbers according to game. (0 - no cube in this place,
1 - static cube in this place, 2 - active piece I am
"driving" now) So rotations and so is done thus. The whole
drawing is done by walking through this matrix and calling
glCallList(tetris_block) on positions:
1
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
...
...
for (loopy = 0;loopy < PLAYFIELDY;loopy++) {
for (loopx = 0;loopx < 12;loopx++) {
if (field[loopy][loopx] > 0) {
glColor3f(1.0f,1.0f,1.0f);
glLoadIdentity();
glTranslatef(loopx*0.6+XBORDER,YTOP-0.6*loopy,-20.0f);
glCallList(tetris_block);
}
}
}
where XBORDER is leftomost position on SCREEN.
And that''s about it.
Thanks again
Jan
This is however not my situation.
First idea that occurs to me was, that I am
for some reason drawing at first screen without
shape and after that with it. I double checked, and
In each iteration moving shape is present. I also
tried to change different face cullings, and only
effect I achieved was partially cubes (eq. without back
face aso.)
Jan
First idea that occurs to me was, that I am
for some reason drawing at first screen without
shape and after that with it. I double checked, and
In each iteration moving shape is present. I also
tried to change different face cullings, and only
effect I achieved was partially cubes (eq. without back
face aso.)
Jan
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement