Giter VIP home page Giter VIP logo

Comments (3)

carlHR avatar carlHR commented on June 1, 2024

Hi there,

So, I am going through the tutorials right now, implementing everything from scratch. I've seen that the cube using the textures I've also made myself was wrong as well.

The problem is actually with the common/texture.cpp script.

Line 61:

// Read the actual data from the file into the buffer
fread(data,1,imageSize,file);

Should have this command as well, to use the dataPos variable:

// Use the dataPos offset inside the file
fseek(file, dataPos, SEEK_SET);

// Read the actual data from the file into the buffer
fread(data,1,imageSize,file);

With this additional line, this issue should have been fixed.

Note: I tried this using the loadBMP_custom() given in the tutorial, to load BMP files only. Didn't tried anything with other texture loaders (DDS or TGA).

Carlos HR.

from ogl.

b1060t avatar b1060t commented on June 1, 2024

Thanks. I'll try this later since I've turned to another opengl tutorial.

from ogl.

GabrielLins64 avatar GabrielLins64 commented on June 1, 2024

Hi. I know this is already closed, but about the mentioned DDS texture issue, I came across a stack overflow answer where basically the contributor explains that "DDS has a different-D3D-based coordinate system compared to OpenGL, so we either invert the y component of the UV-coords in the fragment shader or invert the image before compressing it".

So, I solved by replacing, in the SimpleFragmentShader.glsl:

color = texture(myTextureSampler, UV).rgb;

by

color = texture(myTextureSampler, vec2(UV.x, 1.0-UV.y)).rgb;

from ogl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.