Hi! I had posted a message before about displayin the images well I got it sorted but still I wanted to ask one question. I read in two different images and draw them using in different buffers but I dont think so it is displaying both the images. Please can anyone suggest what the problem is and how can I do go about it.
I have not tried out your program but I did look at it.
I think the reason it never would draw is due to a problem in the ‘if’ logic of drawing the bitmaps. I could not see where you make the logic “TRUE” in order to draw the image.
I do not understand what you mean on this question?
I am trying to display two images on the screen simultaneously well like stereo images.
But the problem is glutMainLoop() function is not mutli threaded so it just displays one image and not the second one!!!. Is it possible to display both the images at one time ? . And thanks for looking at the code it is wrong I know I am trying to fix. It just displays one image and not the second. How can I get it to display both the images ??
glutPostRedisplay();
glutTimerFunc(100(time in milli-seconds), swap_images, (int)0); // Restart the timer
}
By adjusting the time, you can change the rate in which it flips between images.
Originally posted by pran1:
[b]Ok my question is :
I am trying to display two images on the screen simultaneously well like stereo images.
But the problem is glutMainLoop() function is not mutli threaded so it just displays one image and not the second one!!!. Is it possible to display both the images at one time ? . And thanks for looking at the code it is wrong I know I am trying to fix. It just displays one image and not the second. How can I get it to display both the images ??
Thanks
pran[/b]
[This message has been edited by nexusone (edited 03-09-2004).]
2.) You’re requesting a stereo pixelformat. Do you have an OpenGL quadbuffered stereo capable graphics board? (Mostly a workstation board) if not, you’re stuck here.
3.) Check what glGetBooleanv(GL_STEREO, &b) says.
4.) The drawing routine draws only one image?
And the draw buffer settings should be different. You set GL_BACK for the clear which is basically ok, though not for depth buffered rendering in case you want that in the future.
You must draw different images into GL_BACK_LEFT and GL_BACK_RIGHT to get a stereo effect.
You should do this:
glDrawBuffer(GL_BACK_LEFT)
glClear(GL_COLOR_BUFFER_BIT);
// Watch out, for depth buffered drawing there is only one depth buffer, you need to clear it for each eye!
…// Draw your image for the left eye here
glDrawBuffer(GL_BACK_LEFT);
glClear(GL_COLOR_BUFFER_BIT);
…// Draw your image for the right eye here.
[This message has been edited by Relic (edited 03-10-2004).]
Hey guys Well I managed to get the code work its displaying both the images now thanks alot for your help. Just last question when I display the images the color information for both images is lost and for some wiered reason I am not able to resize the image. Any suggestions.
You should not free() the images if you still need them for display. This should avoid the crash, you seemed to have figured that out.
Does GLUT offer a clean exit function? Use that to delete your resources.
OpenGL is a state machine, no need to set the ClearColor more than once at inint time.
No idea about the pixelzoom, it sucks anyway. Make sure you have nice values there.
It would be much faster and nicer to put the images onto two texture objects and use textured quads to display them with linear or better filtering.
[This message has been edited by Relic (edited 03-10-2004).]
Another option is make you images into textures, then map them to a quad. Resize now can be done, by changing the size of the quad.
As for clearing memory, as I suggested do it on exit.
keyboard(…)
{
if(key==‘ESC’)
{
//clear memory here then exit
free(…)
etc…
exit(0);
}
Originally posted by pran1:
[b]Hey guys Well I managed to get the code work its displaying both the images now thanks alot for your help. Just last question when I display the images the color information for both images is lost and for some wiered reason I am not able to resize the image. Any suggestions.
Hmm… thinking about the problem lets forget resizing for a while but what suprises me and trust me I have been trying hard and a question comes up … Is it possible to display the image on the screen with the actual size of the image using glutInitWindowSize() ??
It is bad practice to set window size this way, what if the image is bigger then the screen?
Better first to get windows max size and then scale image to fix it, then resize by user if needed.
The routine it looking for a int value, what type of variable is your pointer?
Could try something like this to force conversion:
glutInitWindowSize( (int) BitmapInfo1->bmiHeader.biWidth, (int) BitmapInfo1->bmiHeader.biHeight);
Originally posted by pran1:
[b]If I try to do glutInitWindowSize(BitmapInfo1->bmiHeader.biWidth,
BitmapInfo1->bmiHeader.biHeight); it crached baldy.
Please help
Pran
[This message has been edited by pran1 (edited 03-11-2004).][/b]
[This message has been edited by nexusone (edited 03-11-2004).]