Jump to content
  • Advertisement
Sign in to follow this  
mic-pringle

OpenGL Variable window size, fixed resolution ...

This topic is 3316 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
@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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!