Hi guys.
I am using Opengl TEXTURE Mapping to run left/right images on 120Hz SamsungLCD(I am using Nvidida quadro card as well that does support 120hz Refresh r). for texture mapping i am using this tutorial as it is(http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=06 ) in-spite of the one change which is rendering two images left@60hz and right@60 alternatively

Problem:- When i debug it, it works fine..both left/right images can be seen alternatively on one window and run SMOOTHLY.....BUT after 30seconds...it starts FLICKERING...i do not understand what is the reason of this flicker..If i don't use Texture-mapping and run two white quads for left/right at 60hz each then it works fine...both left/right images run smoothly (flicker free) for hours and hours.
Please help............

ZbuffeR

04-30-2010, 07:32 AM

Are you sure you do not create a new texture each frame ? This would explode the card VRAM, and force some memory management that would slow down your rendering.

Can you describe the problem more precisely ?
It flickers to white/ to black ? Or between different images ?
Does the rendering time per frame changes a lot ?

desiboy

04-30-2010, 08:01 AM

thanks for replying so quick.
flicker happens between two bitmap images,e.g as i am using 120hz SamsungLCD, left (60hz)/ right(60hz) images on alternative frame should run smoothly..but it doesn't..it slowly flickers

I just noticed something weired, as i am using two bitmap images and rendering them using texture-mapping technique(code below), both images resolution is 256x256 and size is 192KB each, using this size & resolution..the flicking starts after 30seconds.
BUT if i change their resolution to 100x100 and size about 27KB...then the flicking starts after 2 minutes.
AND if i change these images with other having 5MB size nd higher resolution...then flicker is horrible....
Can you suggest anyway i can avoid this.

I am using this code: please have a look if you can find anything weird that is causing FLICKERING:

/*
* This Code Was Created By Jeff Molofee 2000
* A HUGE Thanks To Fredric Echols For Cleaning Up
* And Optimizing The Base Code, Making It More Flexible!
* If You've Found This Code Useful, Please Let Me Know.
* Visit My Site At nehe.gamedev.net
*/

GLvoid KillGLWindow(GLvoid) // Properly Kill The Window
{
if (fullscreen) // Are We In Fullscreen Mode?
{
ChangeDisplaySettings(NULL,0); // If So Switch Back To The Desktop
ShowCursor(TRUE); // Show Mouse Pointer
}

if (hRC) // Do We Have A Rendering Context?
{
if (!wglMakeCurrent(NULL,NULL)) // Are We Able To Release The DC And RC Contexts?
{
MessageBox(NULL,"Release Of DC And RC Failed.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION);
}

if (!wglDeleteContext(hRC)) // Are We Able To Delete The RC?
{
MessageBox(NULL,"Release Rendering Context Failed.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION);
}
hRC=NULL; // Set RC To NULL
}

if (hWnd &amp;&amp; !DestroyWindow(hWnd)) // Are We Able To Destroy The Window?
{
MessageBox(NULL,"Could Not Release hWnd.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION);
hWnd=NULL; // Set hWnd To NULL
}

if (!UnregisterClass("OpenGL",hInstance)) // Are We Able To Unregister Class
{
MessageBox(NULL,"Could Not Unregister Class.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION);
hInstance=NULL; // Set hInstance To NULL
}
}

/* This Code Creates Our OpenGL Window. Parameters Are: *
* title - Title To Appear At The Top Of The Window *
* width - Width Of The GL Window Or Fullscreen Mode *
* height - Height Of The GL Window Or Fullscreen Mode *
* bits - Number Of Bits To Use For Color (8/16/24/32) *
* fullscreenflag - Use Fullscreen Mode (TRUE) Or Windowed Mode (FALSE) */

if(!SetPixelFormat(hDC,PixelFormat,&amp;pfd)) // Are We Able To Set The Pixel Format?
{
KillGLWindow(); // Reset The Display
MessageBox(NULL,"Can't Set The PixelFormat.","ERROR",MB_OK|MB_ICONEXCLAMATION);
return FALSE; // Return FALSE
}

if (!(hRC=wglCreateContext(hDC))) // Are We Able To Get A Rendering Context?
{
KillGLWindow(); // Reset The Display
MessageBox(NULL,"Can't Create A GL Rendering Context.","ERROR",MB_OK|MB_ICONEXCLAMATION);
return FALSE; // Return FALSE
}

// Ask The User Which Screen Mode They Prefer
if (MessageBox(NULL,"Would You Like To Run In Fullscreen Mode?", "Start FullScreen?",MB_YESNO|MB_ICONQUESTION)==IDNO)
{
fullscreen=FALSE; // Windowed Mode
}

If you're using a Quadro card, why don't you use Quad Buffered stereo?

Chances are your movie playback is just drifting in respect to your frame flipping. Quite normal for the two clocks to not be 100%. If you miss a single frame, would that push you off?

Bruce

desiboy

05-02-2010, 04:04 AM

Thanks Bruce,
I think my problem is more towards Texture-Mapping, why the above code is causing flickering when i texture-map my images in stereo mode...why it starts flickering with little delay if i reduce the size of image and resolution ....and it starts flickering very badly so quickly if i increase the resolution and size of image(mentiond above in red text)....Lets assume if i use Quad Buffered Stere, the problem will still be there as i have to Texture-map my bitmap left/right images to quads to run them in alternative 60hz->lefteye/ 60hz->righteye...isn't???

mfort

05-02-2010, 07:52 AM

Do not call LoadGLTextures() / LoadGLTextures1() every frame.
Call it once, during InitGL();