Skip to main content
replaced http://gamedev.stackexchange.com/ with https://gamedev.stackexchange.com/
Source Link

I want to resize my texture. I am using cubemap to compute reflection. I want to use this cubemap to draw skybox. Skybox is drawn but I want to resize texture down, because it is dilated. As I wrote in my previous question (questionquestion), to draw skybox I use shaders:

I want to resize my texture. I am using cubemap to compute reflection. I want to use this cubemap to draw skybox. Skybox is drawn but I want to resize texture down, because it is dilated. As I wrote in my previous question (question), to draw skybox I use shaders:

I want to resize my texture. I am using cubemap to compute reflection. I want to use this cubemap to draw skybox. Skybox is drawn but I want to resize texture down, because it is dilated. As I wrote in my previous question (question), to draw skybox I use shaders:

corrected vertex shader code
Source Link
martin pilch
  • 551
  • 2
  • 6
  • 17
    uniform mat4 modelViewMatrix;
  uniform mat4 projectionMatrix;
  uniform mat3 normalMatrix;
                                                  
    attribute vec4 position;
    varying mediump vec4vec3 texCoord;
    void main() {
        
        gl_Position = projectionMatrix * modelViewMatrix * position;
        texCoord = modelViewMatrixnormalMatrix * (gl_Position.xyz);
    }
    uniform mat4 modelViewMatrix;
  uniform mat4 projectionMatrix;
                                                  
    attribute vec4 position;
    varying mediump vec4 texCoord;
    void main() {
        
        gl_Position = projectionMatrix * modelViewMatrix * position;
        texCoord = modelViewMatrix * (gl_Position);
    }
    uniform mat4 modelViewMatrix;
  uniform mat4 projectionMatrix;
  uniform mat3 normalMatrix;
                                                  
    attribute vec4 position;
    varying mediump vec3 texCoord;
    void main() {
        
        gl_Position = projectionMatrix * modelViewMatrix * position;
        texCoord = normalMatrix * (gl_Position.xyz);
    }
added 670 characters in body
Source Link
Tetrad
  • 30.1k
  • 12
  • 96
  • 143

Edit: It is strange, but when I multiply modelviewMatrix with projectionMatrix it does not work. Now my code is:

    uniform mat4 modelViewMatrix;
  uniform mat4 projectionMatrix;
                                                  
    attribute vec4 position;
    varying mediump vec4 texCoord;
    void main() {
        
        gl_Position = projectionMatrix * modelViewMatrix * position;
        texCoord = modelViewMatrix * (gl_Position);
    }

I have attached the screenshot, it looks quite good. Maybe it is distorted, because of the aspect ratio: screen

Edit: It is strange, but when I multiply modelviewMatrix with projectionMatrix it does not work. Now my code is:

    uniform mat4 modelViewMatrix;
  uniform mat4 projectionMatrix;
                                                  
    attribute vec4 position;
    varying mediump vec4 texCoord;
    void main() {
        
        gl_Position = projectionMatrix * modelViewMatrix * position;
        texCoord = modelViewMatrix * (gl_Position);
    }

I have attached the screenshot, it looks quite good. Maybe it is distorted, because of the aspect ratio: screen

Source Link
martin pilch
  • 551
  • 2
  • 6
  • 17
Loading