mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-18 21:59:58 +01:00
OSX opengl pedantic update
there was a strange warning " POSSIBLE ISSUE: unit 0 GLD_TEXTURE_INDEX_2D is unloadable and bound to sampler type (Float) - using zero texture because texture unloadable", related to the first use of the opengl texture. Initializing the white texture seems to fix the problem.
This commit is contained in:
@@ -37,7 +37,7 @@
|
|||||||
#define GLFW_EXPOSE_NATIVE_X11
|
#define GLFW_EXPOSE_NATIVE_X11
|
||||||
#define GLFW_EXPOSE_NATIVE_GLX
|
#define GLFW_EXPOSE_NATIVE_GLX
|
||||||
#endif
|
#endif
|
||||||
#include <GLFW/glfw3native.h>
|
//#include <GLFW/glfw3native.h>
|
||||||
|
|
||||||
#include <glm/gtc/matrix_transform.hpp> // glm::translate, glm::rotate, glm::scale
|
#include <glm/gtc/matrix_transform.hpp> // glm::translate, glm::rotate, glm::scale
|
||||||
#include <glm/ext/matrix_clip_space.hpp> // glm::perspective
|
#include <glm/ext/matrix_clip_space.hpp> // glm::perspective
|
||||||
@@ -1023,6 +1023,7 @@ bool RenderingWindow::init(int index, GLFWwindow *share)
|
|||||||
//
|
//
|
||||||
// default render black
|
// default render black
|
||||||
//
|
//
|
||||||
|
(void) Resource::getTextureWhite(); // init white texture too
|
||||||
textureid_ = Resource::getTextureBlack();
|
textureid_ = Resource::getTextureBlack();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -137,9 +137,9 @@ void Primitive::init()
|
|||||||
glBindVertexArray( vao_ );
|
glBindVertexArray( vao_ );
|
||||||
|
|
||||||
// compute the memory needs for points
|
// compute the memory needs for points
|
||||||
std::size_t sizeofPoints = sizeof(glm::vec3) * points_.size();
|
std::size_t sizeofPoints = sizeof(glm::fvec3) * points_.size();
|
||||||
std::size_t sizeofColors = sizeof(glm::vec4) * colors_.size();
|
std::size_t sizeofColors = sizeof(glm::fvec4) * colors_.size();
|
||||||
std::size_t sizeofTexCoords = sizeof(glm::vec2) * texCoords_.size();
|
std::size_t sizeofTexCoords = sizeof(glm::fvec2) * texCoords_.size();
|
||||||
|
|
||||||
// setup the array buffers for vertices
|
// setup the array buffers for vertices
|
||||||
glBindBuffer( GL_ARRAY_BUFFER, arrayBuffer_ );
|
glBindBuffer( GL_ARRAY_BUFFER, arrayBuffer_ );
|
||||||
@@ -151,16 +151,16 @@ void Primitive::init()
|
|||||||
|
|
||||||
// setup the element array for the triangle indices
|
// setup the element array for the triangle indices
|
||||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, elementBuffer_);
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, elementBuffer_);
|
||||||
std::size_t sizeofIndices = indices_.size() * sizeof(uint);
|
std::size_t sizeofIndices = indices_.size() * sizeof(GLuint);
|
||||||
glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeofIndices, &(indices_[0]), GL_STATIC_DRAW);
|
glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeofIndices, &(indices_[0]), GL_STATIC_DRAW);
|
||||||
|
|
||||||
// explain how to read attributes 0, 1 and 2 (for point, color and textcoord respectively)
|
// explain how to read attributes 0, 1 and 2 (for point, color and textcoord respectively)
|
||||||
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(glm::vec3), (void *)0 );
|
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(glm::fvec3), (void *)0 );
|
||||||
glEnableVertexAttribArray(0);
|
glEnableVertexAttribArray(0);
|
||||||
glVertexAttribPointer(1, 4, GL_FLOAT, GL_FALSE, sizeof(glm::vec4), (void *)(sizeofPoints) );
|
glVertexAttribPointer(1, 4, GL_FLOAT, GL_FALSE, sizeof(glm::fvec4), (void *)(sizeofPoints) );
|
||||||
glEnableVertexAttribArray(1);
|
glEnableVertexAttribArray(1);
|
||||||
if ( sizeofTexCoords ) {
|
if ( sizeofTexCoords ) {
|
||||||
glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, sizeof(glm::vec2), (void *)(sizeofPoints + sizeofColors) );
|
glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, sizeof(glm::fvec2), (void *)(sizeofPoints + sizeofColors) );
|
||||||
glEnableVertexAttribArray(2);
|
glEnableVertexAttribArray(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user