Variable window size, fixed resolution ...

Started by
4 comments, last by snoutmate 14 years, 10 months ago
Hi, After spending a while now experimenting with the features of OpenGL, I'd like to start developing something a bit more substantial. I have decided to remake an old classic that originally used ray-casting (Bet you can't guess the game). I'd like to maintain the look and feel of the original and also like to use the original resources - textures, sprites etc. For this to work I'd like to have my OpenGL window maintain a fixed resolution of 320 x 200 no matter how big the window is made by the end user, or even if they opt for full screen. Is this possible with OpenGL ? If so, could anyone give me any pointers on how to achieve this, or any examples ? All help will be greatly appreciated. I'm using GLUT as the basis. Thanks -Mic
Advertisement
Quote:I have decided to remake an old classic that originally used ray-casting (Bet you can't guess the game).
Marathon? Doom? Wolfenstein?
Quote:I'd like to maintain the look and feel of the original and also like to use the original resources - textures, sprites etc. For this to work I'd like to have my OpenGL window maintain a fixed resolution of 320 x 200 no matter how big the window is made by the end user, or even if they opt for full screen.

Is this possible with OpenGL ? If so, could anyone give me any pointers on how to achieve this, or any examples?
Generally speaking, when using a graphics API such as OpenGL, the rendering resolution is independent of the screen resolution. When the resolutions do not match, however, there are various things that have to be taken into consideration, such as differing aspect ratios and up- or down-sampling of images.

To be honest, I'm not sure how you would implement a 'true' raycasting engine using OpenGL, but I admit I haven't given it much thought. Maybe someone else can offer some input on this.
@jyk

Rise of the Triad :-)

I'm not planning in implementing a ray-casting engine, all drawing will be done via OpenGL in true 3d. The original game maps are to be used, but I have written some code that projects them into 3d using simple textured quads instead of ray-casting.

I've a feeling it's something to do with gluPerspective and glViewport but I'm not too sure ?

Thanks

-Mic

Okay, to put it another way.

I'd like to use the original textures and sprites from the game. The textures are all low resolution, 64 x 64.

So what is the best way to be able to use these textures without blowing them up to some stupidly large scale where they just become big blocks of color ?

Thanks

-Mic
Well, you could render at a higher resolution. The textures would just be "stretched" during raserization, i.e. the texels will be interpolated.

As an alternative you could render the whole thing to a smaller texture and draw a textured fullscreen quad (using your offscreen texture) to the screen.
If I was helpful, feel free to rate me up ;)If I wasn't and you feel to rate me down, please let me know why!
Quote:Original post by mic-pringle
I'd like to maintain the look and feel of the original and also like to use the original resources - textures, sprites etc. For this to work I'd like to have my OpenGL window maintain a fixed resolution of 320 x 200 no matter how big the window is made by the end user, or even if they opt for full screen.

If you absolutely want to retain the blockiness feeling of the original, you can use offscreen rendering to render to 320x200 texture (using FBOs or pixel buffers), then display the texture as a fullscreen quad with disabled interpolation (MIN/MAG_FILTER set to GL_NEAREST). Note that 320,200 aren't power-of-two values, so you have to either use NPOT textures (where supported) or use only part of a larger texture (512x256) with adjusted texture coordinates.

This topic is closed to new replies.

Advertisement