mirror of
https://github.com/devZoGok/vb01.git
synced 2026-08-26 19:43:30 +00:00
renderbuffers are usable for various resolutions
This commit is contained in:
@@ -59,7 +59,7 @@ namespace vb01{
|
||||
|
||||
glGenFramebuffers(1,&FBO);
|
||||
glBindFramebuffer(GL_FRAMEBUFFER,FBO);
|
||||
Texture *texture=new Texture();
|
||||
Texture *texture=new Texture(width,height,false);
|
||||
glFramebufferTexture2D(GL_FRAMEBUFFER,GL_COLOR_ATTACHMENT0,GL_TEXTURE_2D,*(texture->getTexture()),0);
|
||||
|
||||
/*
|
||||
|
||||
@@ -136,9 +136,8 @@ TEXTURE_H texture.h /^#define TEXTURE_H$/;" d
|
||||
TEXT_H text.h /^#define TEXT_H$/;" d
|
||||
Text text.cpp /^ Text::Text(string fontPath,string entry){$/;" f class:vb01::Text
|
||||
Text text.h /^ class Text{$/;" c namespace:vb01
|
||||
Texture texture.cpp /^ Texture::Texture(){$/;" f class:vb01::Texture
|
||||
Texture texture.cpp /^ Texture::Texture(FT_Face &face, char ch){$/;" f class:vb01::Texture
|
||||
Texture texture.cpp /^ Texture::Texture(int width, int height){$/;" f class:vb01::Texture
|
||||
Texture texture.cpp /^ Texture::Texture(int width, int height, bool shadowMap){$/;" f class:vb01::Texture
|
||||
Texture texture.cpp /^ Texture::Texture(string path){$/;" f class:vb01::Texture
|
||||
Texture texture.cpp /^ Texture::Texture(string paths[6]){$/;" f class:vb01::Texture
|
||||
Texture texture.h /^ class Texture{$/;" c namespace:vb01
|
||||
|
||||
+17
-19
@@ -8,31 +8,29 @@
|
||||
using namespace std;
|
||||
|
||||
namespace vb01{
|
||||
Texture::Texture(){
|
||||
width=800,height=600;
|
||||
|
||||
glGenTextures(1,&texture);
|
||||
glBindTexture(GL_TEXTURE_2D,texture);
|
||||
glTexImage2D(GL_TEXTURE_2D,0,GL_RGB,width,height,0,GL_RGB,GL_UNSIGNED_BYTE,NULL);
|
||||
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT);
|
||||
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT);
|
||||
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
|
||||
}
|
||||
|
||||
Texture::Texture(int width, int height){
|
||||
Texture::Texture(int width, int height, bool shadowMap){
|
||||
this->width=width;
|
||||
this->height=height;
|
||||
|
||||
glGenTextures(1,&texture);
|
||||
glBindTexture(GL_TEXTURE_2D,texture);
|
||||
glTexImage2D(GL_TEXTURE_2D,0,GL_DEPTH_COMPONENT,width,height,0,GL_DEPTH_COMPONENT,GL_FLOAT,NULL);
|
||||
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP_TO_BORDER);
|
||||
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_CLAMP_TO_BORDER);
|
||||
float borderColor[]={1,1,1,1};
|
||||
glTexParameterfv(GL_TEXTURE_2D,GL_TEXTURE_BORDER_COLOR,borderColor);
|
||||
if(shadowMap){
|
||||
glTexImage2D(GL_TEXTURE_2D,0,GL_DEPTH_COMPONENT,width,height,0,GL_DEPTH_COMPONENT,GL_FLOAT,NULL);
|
||||
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP_TO_BORDER);
|
||||
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_CLAMP_TO_BORDER);
|
||||
float borderColor[]={1,1,1,1};
|
||||
glTexParameterfv(GL_TEXTURE_2D,GL_TEXTURE_BORDER_COLOR,borderColor);
|
||||
}
|
||||
else{
|
||||
glTexImage2D(GL_TEXTURE_2D,0,GL_RGB,width,height,0,GL_RGB,GL_UNSIGNED_BYTE,NULL);
|
||||
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT);
|
||||
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT);
|
||||
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
|
||||
}
|
||||
}
|
||||
|
||||
Texture::Texture(FT_Face &face, char ch){
|
||||
|
||||
Reference in New Issue
Block a user