PDA

View Full Version : OpenGL



Programulator
June 29th, 2006, 08:32
I am programming using GLUT open gl library. When I call GlutMainLoop(); is there a way to call other functions after it? or for that matter have the emulation loop processing and GlutMainLoop() at the same time? I ask this because I want to init my emu I want to display the window, and then begin cpu execution, and it hasn't been working. I mean, I did figure out a way to do it, but when i click on the window while graphics are drawing, it hangs. Suggestions?

NoeOM
June 29th, 2006, 10:08
You have to write event processing functions. I they are called callbacks in GLUT. Once written, you have to set them using the glut*callback() functions, such as glutMouseCallback() for the mouse, glutKeyboardCallback() for the keyboard and so.

Anyway, GLUT is a well known library and there are lots of samples an tutorials out there. Google it!

Garstyciuks
June 29th, 2006, 12:04
I used tutorials at http://www.spacesimulator.net to learn glut programming.

blueshogun96
June 29th, 2006, 20:29
Check out this link too.

http://www.lighthouse3d.com/

Exophase
June 29th, 2006, 20:58
To do things in the background you should use the idle callback, however, you have to make it capable of working in steps at a time (for instance, have it emulate all of the instructions until vsync is hit)

Programulator
June 29th, 2006, 23:51
Alright, thanks for the links. I figured out what I needed to. Right now I am messing with opengl/sdl programming. Now my next question is when I render graphics, say from chip 8 with resolution 64x32, is there a way to stretch the screen so the graphics are not so tiny, or do I have to do that on my own? I really couldn't find a straight answer to this on google. Gosh, I really think allegro has spoiled me :unsure:

Garstyciuks
June 30th, 2006, 18:35
My emulator does it itself. It can draw 2 times, 4 times and 8 times bigger pixels. I do this by multiplying the coordinates of a pixel. You can check the source code. It uses OpenGL and MFC. There's a link in my signature.

Cyberman
July 5th, 2006, 21:06
Alright, thanks for the links. I figured out what I needed to. Right now I am messing with opengl/sdl programming. Now my next question is when I render graphics, say from chip 8 with resolution 64x32, is there a way to stretch the screen so the graphics are not so tiny, or do I have to do that on my own? I really couldn't find a straight answer to this on google. Gosh, I really think allegro has spoiled me :unsure:Spoiled programmer!
Try using a texture and changing it with every update. After this you can stretch the texture pretty much anyway you want even just a regular 2d surface :)
Now if you wanted to get fancy you could update it onto the surface of a cube or a 3d object. The skys the limit really.

Cyb