On Fri, 02 Mar 2007 03:26:59 -0500 Per Inge Mathisen 
<[EMAIL PROTECTED]> wrote:
>On 3/2/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>> Before the hardcode of 512, it was change to 
>BACKDROP_HACK_WIDTH,
>> and BACKDROP_HACK_HEIGHT (which still is 512).
>>
>> In code below this with
>>         glBegin(GL_TRIANGLE_STRIP);
>>                 glTexCoord2f(0, 0);
>>                 glVertex2f(0, 0);
>>                 glTexCoord2f(255, 0);
>>                 glVertex2f(screenWidth, 0);
>>                 glTexCoord2f(0, 255);
>>                 glVertex2f(0, screenHeight);
>>                 glTexCoord2f(255, 255);
>>                 glVertex2f(screenWidth, screenHeight);
>>         glEnd();
>>
>> should not the 255 be also changed?  Why is it 255 in first 
>place?
>> if BACKDROP_HACK_HEIGHT = 1024, then it no look right ?
>>
>> Anybody explain why this value used?  I think it is mistake?
>
>I believe those are texture coordinates that get translated into 
>0.0f
>-> 1.0f. Although I must admit I am a bit mystified about how 
>exactly
>this works.
>
>  - Per
I find this,
        glViewport(0, 0, width, height);
        glMatrixMode(GL_PROJECTION);
        glPushMatrix();
        glLoadIdentity();
        glOrtho(0, width, height, 0, 1, -1);
        glMatrixMode(GL_TEXTURE);
        glScalef(1/256.0, 1/256.0, 1);
        glMatrixMode(GL_MODELVIEW);
        glLoadIdentity();
        glCullFace(GL_FRONT);
        glEnable(GL_CULL_FACE);

So we deal with glOrtho to set up coordinates.
Then  map coordinates of 0 to width and 0 to height is used yes?
Then mapping should be 0 to width = 0 to 1.0, same for height.  If 
width=1024, height=768 = 1.0,1.0 I thinks.
glTexCoord2f(255, 255) =  255/256 right because call to 
glScalef(1/256.0, 1/256.0, 1) is in the GL_TEXTURE matrix ?

Is logic right?
If yes, then why we scale Texture matrix at all?  Is it to save 
time from doing division? Why 1/256?    Is because original 
textures are 256x256?










--
Click for free info on paralegal training and make up to $150K/ year
http://tagline.hushmail.com/fc/CAaCXv1RDFsF40ZrpcjUAfRPfHw0o9Rs/


_______________________________________________
Warzone-dev mailing list
[email protected]
https://mail.gna.org/listinfo/warzone-dev

Reply via email to