Converting to OpenGL

Hi there,

I want to convert a game to OpenGL(Win32). On the other system I had dircct access to the screen memory, and a couple of custom graphic functions.
It is possible to directly access the surfaces with DirectX and so draw pixels by accessing the memory.
But I would prefer to use OpenGL because it is easier to port to Linux or MacOS.
So I’m looking for a way to do screen memory accessing with OpenGL. It would be ok to create a bitmap and copy it to the screenbuffer.
Has anyone any suggestions or a link to a tutorial where I can get informations on that issue.

Thanks very much,

Dom

Originally posted by dh5877:
Hi there,
So I’m looking for a way to do screen memory accessing with OpenGL. It would be ok to create a bitmap and copy it to the screenbuffer.
Dom

don’t know about directx but with opengl you can’t access the framebuffer in that way. there are some functions for copying bitmaps graphics… and now that i mentioned that they exist… forget them, they are slow.

What you would like to do is to store your own screenbuffer as a bitmap in memory and let all your custom built pixelroutines work on it as it would in classic 2d environment.

Then use this bitmap to texture Quads that fit the screen. Texutes are always power of 2 so either you go for the largest texture that fits your need or subdivide textures to smaller parts.

Also set up ortohgraphic projection, for example with gluOrtho2D.

gluOrtho2D(0,639,479,0) would give a 640x480 screen projection mode so any vertexes you output could be mapped to
cooresponding pixels( coord 0,0 as top left and coord 639,479 as bottom right)

then in everyframe when you are done with the bitmap upload the changes to the textures(glTexSubImage);

once you got this up and running you can forget about the 3d environment and work on your bitmap, or make use of the 3d environment to do layers with blending, rotation and stuff.

Or try SDL.

SDL is looking quite good for my purpose but but it seems there is fullscreen support only for linux which is a big handicap since I’m working with Win2k :-(.
What I’m working on is a fullscreen-game and so I would go for glut/openGL, but the SDL api is looking so nice …