Git Product home page Git Product logo

Comments (5)

MarkCallow avatar MarkCallow commented on September 28, 2024 1

There is not enough information for me to take action on the first item. I need your actual example. The one in the doc only shows the key pieces. If the texture needs transcoding you must do it before calling ktxTexture_GLUpload. If you do not, KTX_INVALID_OPERATION will be returned.

The error cannot be avoided. In OpenGL there is no query to determine if the implementation accepts the given format. Rather than some error-prone heuristics the loader simply attempts to load the texture. If GL_INVALID_ENUM is returned, the loader checks if it has a software decoder for the format (only true for ETC[12]). If it does, it clears the error, decodes the texture and uploads the decoded texture. If not, it returns the GL_INVALID_ENUM in glerror.

I've fixed the typo in the documentation. It will be in the next release.

from ktx-software.

MarkCallow avatar MarkCallow commented on September 28, 2024 1

@Raffaello

  1. Automatically transcoding would require guessing the needs and intent of the application. The choice of target needs to be in the hands of the application writer.

from ktx-software.

Raffaello avatar Raffaello commented on September 28, 2024

@MarkCallow thanks.

  1. Doing the transcoding is enough to be succeful in GLUpload. I am wondering wouldn't be possible to have a function to do also the transcoding if needed for an easier usage?

  2. thanks, anyway that led me to improve my handling error routine.

  3. 👍

from ktx-software.

Raffaello avatar Raffaello commented on September 28, 2024

@MarkCallow One more thing, I noticed that GLUpload or `ktTexture_createdFromNamedFile' doesn't flip the Y of the images. Is there anything available in the ktxlib to tell to flip Y of the images?
As it is not really convinient after the texture being created to flip it or negate the tex coords...

from ktx-software.

MarkCallow avatar MarkCallow commented on September 28, 2024

You can set the orientation when you create a texture with ktx create. A y-flip will be performed if the input image orientation differs from that specified. (Default origin is top-left or, in terms of increasing s & t, right-down). You should make textures with the orientation you desire. If the texture and coordinates do not match, it is fairly easy to modify them. E.g,

    if (kTexture->orientation.x == KTX_ORIENT_X_LEFT)
        sign_s = -1;
    if (kTexture->orientation.y == KTX_ORIENT_Y_UP)
        sign_t = -1;

    if (sign_s < 0 || sign_t < 0) {
        // Transform the texture coordinates to get correct image orientation.
        for (uint32_t i = 0; i < vertexBuffer.size(); i++) {
            if (sign_t < 1) {
                vertexBuffer[i].uv[1] = vertexBuffer[i].uv[1] * -1 + 1;
            }
            if (sign_s < 1) {
                vertexBuffer[i].uv[0] = vertexBuffer[i].uv[0] * -1 + 1;
            }
        }
    }

If you do not want to modify the uv coordinates before loading it is easy to apply the texture coordinate transform in the vertex shader.

As with automatic transcoding, an automatic flip would require second guessing the application and would be wrong in some cases.

Re. ktxTexture_CreateFromNamedFile we chose to keep image processing out of libktx. Applications need to perform any necessary flip before calling this function.

from ktx-software.

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.