mirror of
https://git.mirrors.martin98.com/https://github.com/syoyo/tinygltf.git
synced 2025-08-01 21:20:36 +08:00
Fix non-KTX texture was not handled correctly.
Experience file drop API of glfw(not working yet).
This commit is contained in:
parent
c7bf800075
commit
98eef6ee75
@ -176,6 +176,8 @@ std::map<int, GLuint> bindMesh(std::map<int, GLuint> vbos,
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
valid = true;
|
||||||
|
|
||||||
if (image.component == 1) {
|
if (image.component == 1) {
|
||||||
format = GL_RED;
|
format = GL_RED;
|
||||||
} else if (image.component == 2) {
|
} else if (image.component == 2) {
|
||||||
@ -189,7 +191,7 @@ std::map<int, GLuint> bindMesh(std::map<int, GLuint> vbos,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (image.bits == 8) {
|
if (image.bits == 8) {
|
||||||
// ok
|
type = GL_UNSIGNED_BYTE;
|
||||||
} else if (image.bits == 16) {
|
} else if (image.bits == 16) {
|
||||||
type = GL_UNSIGNED_SHORT;
|
type = GL_UNSIGNED_SHORT;
|
||||||
} else {
|
} else {
|
||||||
@ -381,6 +383,14 @@ static void error_callback(int error, const char *description) {
|
|||||||
fprintf(stderr, "Error: %s\n", description);
|
fprintf(stderr, "Error: %s\n", description);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void drop_callback(GLFWwindow *window, int num, const char **paths) {
|
||||||
|
(void)window;
|
||||||
|
printf("dropCB %d\n", num);
|
||||||
|
for (int i = 0; i < num; i++) {
|
||||||
|
printf("%s\n", paths[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
std::string filename = "../../models/Cube/Cube.gltf";
|
std::string filename = "../../models/Cube/Cube.gltf";
|
||||||
|
|
||||||
@ -409,6 +419,9 @@ int main(int argc, char **argv) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
Window window = Window(800, 600, "TinyGLTF basic example");
|
Window window = Window(800, 600, "TinyGLTF basic example");
|
||||||
|
|
||||||
|
glfwSetDropCallback(window.window, drop_callback);
|
||||||
|
|
||||||
glfwMakeContextCurrent(window.window);
|
glfwMakeContextCurrent(window.window);
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
|
Loading…
x
Reference in New Issue
Block a user