help render to texture 1024x1024

Started by
10 comments, last by Stylez99 20 years, 5 months ago
Well if you use 1024x768 resolution and you are rendering to the screen and then copying to a texture then it''s normal that the texture will look like crap because the framebuffer is only 1024x768 and the texture is 1024x1024. try using 1280x1024.

[ My Site ]

Member of "Un-Ban nes8bit" association (UNA) (to join put this in your sig) (Welcome back to JesperT)
Founding member of "Dave Astle is an ALIEN god" association (DAIAAGA) (proof here)(to join put this in your sig and praise Dave daily)
/*ilici*/
Advertisement
in fact, you are not rendering to the texture! Thats is only possible to do with PBuffers I thinck. What that tecnics does is to render to the frame buffers as normal and copy it to the texture. If one of your sides of the texture are biggers than the frame buffers, off corse part of the texture will be out of frame buffer and still be black! If you are using a 640*480 resolution, you cannot use a texture size if 512*512...One trick is to use the biggest resolution possible under the frame buffer resolution. In this case, 640*480 is better to use the resolution 512*256 for textures. For the 800*600 you can use the 512*512...and so on. If you wnat to do it mathematiclaly so that user can chose is resolution and have a texture of the right size, do this:
This is equal for width and height, so, size is the frame buffer size (that can be bouth width and height)

float screenExp = log(size)/log(2); //this will give you the exponent of texture. Notice that it isn''t an integer but a real number. Notice to that log is devided by the log of 2. Mathematiclaly this means that you are logging size by the base of 2.

float texExp = floor(screenExp); //this will calculate the biggest integer under your real number. The result is a integer number that is the exponent of texture.

int texSize = (int)pow(2,texExp); //now you calculate the texture size just powering 2 by the texExp that is the exponent.

If you don''t undestand a part or if you discover a bug, just post it, ok?
Techno Grooves

This topic is closed to new replies.

Advertisement