Advertisement

Stupid newbie problem:vertex moving

Started by September 20, 2002 07:35 AM
13 comments, last by dEpression 22 years, 5 months ago
hey pal,thanks for the reply.one more thing,u mean i shud create named buffers?i havent tried what u have said.i will do that now.but just confirm this.named buffers.cud u just write 2 lines on this.i mean a small code on how to create named buffers.
also of what i get out of ur mail,i need to create a buffer and draw my new scene and then swap it with the front buffer.so 1st i create 2 buffers.i draw things in both buffers.and at the end flush the front and then swap it with back.do u mean that?in the back,i draw the same thing with black rite?which wud overdraw on it.but wont it leave a trail behind?
He mean, draw on the back buffer (wich is not shown) and then flip them so it do a kind of blitting and seem much more smoother than always drawing the same buffer.. but I don''t know about double buffering in linux or solaris since windows it is set in the pixel format and then use a wgl command to swap buffer... anyway.. and I never heard of named buffer... its just back and front, you specify double buffer and it do all the job
Advertisement
If you''re using Windows and OpenGL it''s easy. Just create a PixelFormatDescriptor with a double buffer in it (front and back). You ALWAYS draw on the backbufer (it''s automatic). When you make a call to SwapBuffers the back becomes front and you can see you work. If you use any other programs (linux, delphi, directX, whatever) then I really have no idea. Oh.. And I too have never heared of named buffers...

Sander Maréchal
[Lone Wolves Production][Articles][GD Emporium][E-mail]

<hr />
Sander Marechal<small>[Lone Wolves][Hearts for GNOME][E-mail][Forum FAQ]</small>

Moving things requires measurements of time.
I also had a similar problem some time ago and I solved it by just taking a time measurement. Don''t ask me why, it just worked.


glTranslatef(x, y, z);
x+=.005f;
y+=.04f;
z+=.008f;

Depending on the machine it will go very fast or very slow, because it will update every frame. Trust me, flickering can be caused by this.

glTranslatef(x, y, z);
x+=.005f*TimeElapsed;
y+=.04f*TimeElapsed;
z+=.008f*TimeElapsed;

It''s better.

I don''t think this post will be useful but those are my two cents. Maybe it will help looking in other directions...

Previously "Krohm"

I rebuilt my program (copy-pasted the cube-drawing code into another project) and tried moving with glTranslatef again. Well, it worked!
Thanks for all the help (even though I can''t figure out the problem - the two files seem identical).

Krohm: I''m aware of the time/frame-problem. Now that I got the base code working I''m going to fix that.

This topic is closed to new replies.

Advertisement