mirror of
https://github.com/devZoGok/vb01.git
synced 2026-08-26 19:43:30 +00:00
models are correctly rendered in framebuffers
This commit is contained in:
+2
-2
@@ -131,10 +131,10 @@ namespace vb01{
|
||||
shader->setVec2(particles[i].size,"size["+to_string(i)+"]");
|
||||
}
|
||||
|
||||
glDisable(GL_CULL_FACE);
|
||||
//glDisable(GL_CULL_FACE);
|
||||
glBindVertexArray(VAO);
|
||||
glDrawElementsInstanced(GL_TRIANGLES,6,GL_UNSIGNED_INT,0,numParticles);
|
||||
glEnable(GL_CULL_FACE);
|
||||
//glEnable(GL_CULL_FACE);
|
||||
}
|
||||
|
||||
void ParticleEmitter::setDirection(Vector3 dir){
|
||||
|
||||
@@ -53,8 +53,8 @@ namespace vb01{
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glEnable(GL_STENCIL_TEST);
|
||||
glEnable(GL_CULL_FACE);
|
||||
glCullFace(GL_FRONT);
|
||||
glDepthMask(GL_TRUE);
|
||||
glCullFace(GL_BACK);
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
@@ -63,11 +63,11 @@ namespace vb01{
|
||||
Texture *texture=new Texture(width,height,false);
|
||||
glFramebufferTexture2D(GL_FRAMEBUFFER,GL_COLOR_ATTACHMENT0,GL_TEXTURE_2D,*(texture->getTexture()),0);
|
||||
|
||||
/*
|
||||
glGenRenderbuffers(1,&RBO);
|
||||
glBindRenderbuffer(GL_RENDERBUFFER,RBO);
|
||||
glRenderbufferStorage(GL_RENDERBUFFER,GL_DEPTH24_STENCIL8,width,height);
|
||||
glFramebufferRenderbuffer(GL_FRAMEBUFFER,GL_DEPTH_STENCIL_ATTACHMENT,GL_RENDERBUFFER,RBO);
|
||||
/*
|
||||
*/
|
||||
if(glCheckFramebufferStatus(GL_FRAMEBUFFER)!=GL_FRAMEBUFFER_COMPLETE)
|
||||
cout<<"Not complete\n";
|
||||
@@ -90,10 +90,10 @@ namespace vb01{
|
||||
|
||||
if(skybox){
|
||||
glDepthMask(GL_FALSE);
|
||||
glCullFace(GL_BACK);
|
||||
//glCullFace(GL_FRONT);
|
||||
skybox->update();
|
||||
glDepthMask(GL_TRUE);
|
||||
glCullFace(GL_FRONT);
|
||||
//glCullFace(GL_BACK);
|
||||
}
|
||||
|
||||
rootNode->update();
|
||||
@@ -102,12 +102,10 @@ namespace vb01{
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
|
||||
|
||||
glDisable(GL_CULL_FACE);
|
||||
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
|
||||
guiPlane->update();
|
||||
/*
|
||||
*/
|
||||
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
guiNode->update();
|
||||
|
||||
|
||||
+5
-3
@@ -53,7 +53,7 @@ namespace vb01{
|
||||
glBindTexture(GL_TEXTURE_2D,0);
|
||||
}
|
||||
|
||||
Texture::Texture(string path){
|
||||
Texture::Texture(string path,bool flip){
|
||||
bool png=false;
|
||||
int length=path.length();
|
||||
if(path.substr(length-4,string::npos)==".png")
|
||||
@@ -68,7 +68,7 @@ namespace vb01{
|
||||
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
|
||||
|
||||
//stbi_set_flip_vertically_on_load(true);
|
||||
stbi_set_flip_vertically_on_load(flip);
|
||||
|
||||
data=stbi_load(path.c_str(),&width,&height,&numChannels,0);
|
||||
|
||||
@@ -77,12 +77,14 @@ namespace vb01{
|
||||
stbi_image_free(data);
|
||||
}
|
||||
|
||||
Texture::Texture(string paths[6]){
|
||||
Texture::Texture(string paths[6],bool flip){
|
||||
this->type=TextureType::TEXTURE_CUBEMAP;
|
||||
|
||||
glGenTextures(1,&texture);
|
||||
glBindTexture(GL_TEXTURE_CUBE_MAP,texture);
|
||||
|
||||
stbi_set_flip_vertically_on_load(flip);
|
||||
|
||||
for(int i=0;i<6;i++){
|
||||
data=stbi_load(paths[i].c_str(),&width,&height,&numChannels,0);
|
||||
if(data){
|
||||
|
||||
@@ -13,8 +13,8 @@ namespace vb01{
|
||||
~Texture();
|
||||
Texture(int,int,bool=true);
|
||||
Texture(FT_Face&,char);
|
||||
Texture(std::string);
|
||||
Texture(std::string[6]);
|
||||
Texture(std::string,bool=false);
|
||||
Texture(std::string[6],bool=false);
|
||||
void select(int=0);
|
||||
inline unsigned int* getTexture(){return &texture;}
|
||||
inline std::string getPath(){return path;}
|
||||
|
||||
Reference in New Issue
Block a user