Comments (5)
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.
- 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.
@MarkCallow thanks.
-
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? -
thanks, anyway that led me to improve my handling error routine.
-
👍
from ktx-software.
@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.
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)
- Conversion to ktx2 using toktx of a jpg image is resulting into a black ktx2 texture HOT 8
- compile fail linux HOT 2
- After converting the image to ktx format using "ktx create" I get a texture that is not similar to the input image. HOT 1
- pyktx docs use of `_` prefix conflicts with GitHub Pages' Jekyll. HOT 2
- ktx create --depth x have no use HOT 11
- libglvnd-devel conflict when installing KTX-Software-4.2.1 x86_64 RPM on Fedora with a pre-installed SDL2 HOT 5
- Neither `create` nor `encode` write the codec choice in KTXwriterScParams HOT 4
- using libKTX on Linux when linking report errors on Threads::Threads HOT 9
- When compiling under Windows, it prompts unix2dos: command not found. HOT 5
- Error using ktx create --assign-primaries none HOT 6
- [OS X] There are no include files. HOT 3
- Feature request: Tool to create combined image by gathering channels from input images HOT 6
- OptionsSingleInSingleOut does not warn or give error on excess positional parameters
- ktx transcode does not remove existing KTXwriterScParams metadata HOT 4
- Update code for KTX-Spec changes HOT 2
- createDFDPackedPadded creates DFD with bits and padding in the wrong order
- Support R16G16_S10_5_NV format
- Allow A8B8G8R8 PACK32 formats
- Loading KTX1 and KTX2 file on Linux/OpenGL 4.3 leads to weird error if not luch the program with sudo HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ktx-software.