-
Anonymous
Текстура OpenGL показывает сплошной цвет текстуры, а не всей текстуры.
Сообщение
Anonymous »
main.cpp
Код: Выделить всё
#include
#include
#include
#include
#include"glheader.h"
#define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h"
//Variables
const int tilesX = 30;
const int tilesY = 18;
int height = 720/2;
int width = 1280/2;
float incrementX = (float)2 / (tilesX-1);
float incrementY = (float)2 / (tilesY-1);
float vertices[] = {
//Vertices //Texture
1.f, 1.f, 0.0f, 0.0f,
1.f, -1.f, 1.0f, 0.0f,
-1.f, 1.f, 0.0f, 1.0f,
-1.f, -1.f, 1.0f, 1.0f,
};
unsigned int indices[] = {
0, 1, 2,
2, 3, 1
};
int main(){
glfwInit();
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
// Create window
GLFWwindow* window = glfwCreateWindow(width, height, "Lentern", NULL, NULL);
if (window == NULL) {
std::cout
Подробнее здесь: [url]https://stackoverflow.com/questions/78825878/opengl-texture-shows-a-solid-color-from-the-texture-and-not-the-entire-texture[/url]
1722646791
Anonymous
main.cpp
[code]#include
#include
#include
#include
#include"glheader.h"
#define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h"
//Variables
const int tilesX = 30;
const int tilesY = 18;
int height = 720/2;
int width = 1280/2;
float incrementX = (float)2 / (tilesX-1);
float incrementY = (float)2 / (tilesY-1);
float vertices[] = {
//Vertices //Texture
1.f, 1.f, 0.0f, 0.0f,
1.f, -1.f, 1.0f, 0.0f,
-1.f, 1.f, 0.0f, 1.0f,
-1.f, -1.f, 1.0f, 1.0f,
};
unsigned int indices[] = {
0, 1, 2,
2, 3, 1
};
int main(){
glfwInit();
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
// Create window
GLFWwindow* window = glfwCreateWindow(width, height, "Lentern", NULL, NULL);
if (window == NULL) {
std::cout
Подробнее здесь: [url]https://stackoverflow.com/questions/78825878/opengl-texture-shows-a-solid-color-from-the-texture-and-not-the-entire-texture[/url]