OPENGL Белый треугольник, перевернутый над другим белым треугольником так, что их кончики встречаются, образуя форму песC++

Программы на C++. Форум разработчиков
Ответить Пред. темаСлед. тема
Anonymous
 OPENGL Белый треугольник, перевернутый над другим белым треугольником так, что их кончики встречаются, образуя форму пес

Сообщение Anonymous »

Я пишу белый треугольник, перевернутый над другим белым треугольником, чтобы их кончики соприкасались, образуя форму песочных часов. Мне нужна помощь в исправлении моего кода.
#include "SceneManager.h"
#ifndef STB_IMAGE_IMPLEMENTATION
#define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h"
#endif

#include

{
const char* g_ModelName = "model";
const char* g_ColorValueName = "objectColor";
const char* g_TextureValueName = "objectTexture";
const char* g_UseTextureName = "bUseTexture";
const char* g_UseLightingName = "bUseLighting";
}

SceneManager::SceneManager(ShaderManager *pShaderManager)
{
m_pShaderManager = pShaderManager;
m_basicMeshes = new ShapeMeshes();
}

SceneManager::~SceneManager()
{
m_pShaderManager = NULL;
delete m_basicMeshes;
m_basicMeshes = NULL;
}

void SceneManager::SetTransformations(
glm::vec3 scaleXYZ,
float XrotationDegrees,
float YrotationDegrees,
float ZrotationDegrees,
glm::vec3 positionXYZ)
{
// variables for this method
glm::mat4 modelView;
glm::mat4 scale;
glm::mat4 rotationX;
glm::mat4 rotationY;
glm::mat4 rotationZ;
glm::mat4 translation;
// set the scale value in the transform buffer
scale = glm::scale(scaleXYZ);
// set the rotation values in the transform buffer
rotationX = glm::rotate(glm::radians(XrotationDegrees), glm::vec3(1.0f, 0.0f, 0.0f));
rotationY = glm::rotate(glm::radians(YrotationDegrees), glm::vec3(0.0f, 1.0f, 0.0f));
rotationZ = glm::rotate(glm::radians(ZrotationDegrees), glm::vec3(0.0f, 0.0f, 1.0f));
// set the translation value in the transform buffer
translation = glm::translate(positionXYZ);

// matrix math to calculate the final model matrix
modelView = translation * rotationX * rotationY * rotationZ * scale;

if (NULL != m_pShaderManager)
{
// pass the model matrix into the shader
m_pShaderManager->setMat4Value(g_ModelName, modelView);
}
}

void SceneManager::SetShaderColor(
float redColorValue,
float greenColorValue,
float blueColorValue,
float alphaValue)
{
// variables for this method
glm::vec4 currentColor;

currentColor.r = redColorValue;
currentColor.g = greenColorValue;
currentColor.b = blueColorValue;
currentColor.a = alphaValue;

if (NULL != m_pShaderManager)
{
// set the color values into the shader
m_pShaderManager->setIntValue(g_UseTextureName, false);
m_pShaderManager->setVec4Value(g_ColorValueName, currentColor);
}
}

void SceneManager::PrepareScene()
{
// only one instance of a particular mesh needs to be
// loaded in memory no matter how many times it is drawn
// in the rendered 3D scene

m_basicMeshes->LoadPyramid4Mesh();
}

void SceneManager::RenderScene() {
// Set up the first pyramid transformations
glPushMatrix(); // Save the current matrix
// Apply transformations to the first pyramid
glTranslatef(0.0f, 1.0f, 0.0f); // Move it up so the tips meet
// Code to render the first pyramid
RenderPyramid();
glPopMatrix(); // Restore the saved matrix

// Set up the second pyramid transformations
glPushMatrix(); // Save the current matrix
// Apply transformations to the second pyramid
glRotatef(180.0f, 1.0f, 0.0f, 0.0f); // Invert the pyramid by rotating 180 degrees on `your text`the X-axis
glTranslatef(0.0f, -1.0f, 0.0f); // Move it down so the tips meet
// Code to render the second pyramid
RenderPyramid();
glPopMatrix(); // Restore the saved matrix
}


Подробнее здесь: https://stackoverflow.com/questions/785 ... -tips-meet
Реклама
Ответить Пред. темаСлед. тема

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение
  • Как скопировать нижний треугольник в верхний треугольник для четырехмерного массива в Numpy Python?
    Anonymous » » в форуме Python
    0 Ответы
    25 Просмотры
    Последнее сообщение Anonymous
  • Треугольник помещается в другой треугольник
    Anonymous » » в форуме C++
    0 Ответы
    19 Просмотры
    Последнее сообщение Anonymous
  • Треугольник помещается в другой треугольник
    Anonymous » » в форуме C++
    0 Ответы
    19 Просмотры
    Последнее сообщение Anonymous
  • Треугольник помещается в другой треугольник
    Anonymous » » в форуме C++
    0 Ответы
    21 Просмотры
    Последнее сообщение Anonymous
  • Треугольник помещается в другой треугольник
    Anonymous » » в форуме C++
    0 Ответы
    13 Просмотры
    Последнее сообщение Anonymous

Вернуться в «C++»