remove some un-used data from b3Generic6DofConstraint
add GLRenderToTexture helper class enable OpenGLTrueTypeFont test
This commit is contained in:
@@ -56,6 +56,8 @@ function createProject(vendor)
|
||||
"../../btgui/OpenGLWindow/LoadShader.h",
|
||||
"../../btgui/OpenGLWindow/TwFonts.cpp",
|
||||
"../../btgui/OpenGLWindow/TwFonts.h",
|
||||
"../../btgui/OpenGLWindow/GLRenderToTexture.cpp",
|
||||
"../../btgui/OpenGLWindow/GLRenderToTexture.h",
|
||||
"../../btgui/OpenGLTrueTypeFont/fontstash.cpp",
|
||||
"../../btgui/OpenGLTrueTypeFont/fontstash.h",
|
||||
"../../btgui/OpenGLTrueTypeFont/opengl_fontstashcallbacks.cpp",
|
||||
|
||||
@@ -32,7 +32,7 @@ subject to the following restrictions:
|
||||
#include "opengl_fontstashcallbacks.h"
|
||||
|
||||
|
||||
#include "Bullet3Common/b3Quickprof.h"
|
||||
//#include "Bullet3Common/b3Quickprof.h"
|
||||
#include "Bullet3Common/b3Quaternion.h"
|
||||
#include "Bullet3Common/b3CommandLineArgs.h"
|
||||
#include "../OpenGLWindow/LoadShader.h"
|
||||
@@ -471,7 +471,6 @@ int main(int argc, char* argv[])
|
||||
|
||||
while (!window->requestedExit())
|
||||
{
|
||||
b3ProfileManager::Reset();
|
||||
GLint err = glGetError();
|
||||
b3Assert(err==GL_NO_ERROR);
|
||||
|
||||
@@ -633,11 +632,9 @@ int main(int argc, char* argv[])
|
||||
b3Assert(err==GL_NO_ERROR);
|
||||
|
||||
{
|
||||
B3_PROFILE("glFinish");
|
||||
glFinish();
|
||||
}
|
||||
|
||||
b3ProfileManager::Increment_Frame_Counter();
|
||||
|
||||
static bool printStats = true;
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
"../OpenGLWindow/LoadShader.cpp",
|
||||
"../OpenGLWindow/LoadShader.h",
|
||||
"../../src/Bullet3Common/b3AlignedAllocator.cpp",
|
||||
"../../src/Bullet3Common/b3Logging.cpp",
|
||||
"../Timing/b3Quickprof.cpp",
|
||||
"../Timing/b3Quickprof.h" ,
|
||||
"../Timing/b3Clock.cpp",
|
||||
|
||||
78
btgui/OpenGLWindow/GLRenderToTexture.cpp
Normal file
78
btgui/OpenGLWindow/GLRenderToTexture.cpp
Normal file
@@ -0,0 +1,78 @@
|
||||
|
||||
///See http://www.opengl-tutorial.org/intermediate-tutorials/tutorial-14-render-to-texture/
|
||||
|
||||
#include "GLRenderToTexture.h"
|
||||
|
||||
GLRenderToTexture::GLRenderToTexture()
|
||||
:m_framebufferName(0)
|
||||
{
|
||||
}
|
||||
|
||||
void GLRenderToTexture::init(int width, int height)
|
||||
{
|
||||
glGenFramebuffers(1, &m_framebufferName);
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, m_framebufferName);
|
||||
|
||||
GLuint m_renderedTexture;
|
||||
glGenTextures(1, &m_renderedTexture);
|
||||
|
||||
// "Bind" the newly created texture : all future texture functions will modify this texture
|
||||
glBindTexture(GL_TEXTURE_2D, m_renderedTexture);
|
||||
|
||||
// Give an empty image to OpenGL ( the last "0" )
|
||||
glTexImage2D(GL_TEXTURE_2D, 0,GL_RGB, width, height, 0,GL_RGB, GL_UNSIGNED_BYTE, 0);
|
||||
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
|
||||
|
||||
// The depth buffer
|
||||
glGenRenderbuffers(1, &m_depthrenderbuffer);
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, m_depthrenderbuffer);
|
||||
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT, width, height);
|
||||
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, m_depthrenderbuffer);
|
||||
|
||||
glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, m_renderedTexture, 0);
|
||||
|
||||
}
|
||||
|
||||
bool GLRenderToTexture::enable()
|
||||
{
|
||||
bool status = false;
|
||||
|
||||
// Set the list of draw buffers.
|
||||
GLenum drawBuffers[2] = {GL_COLOR_ATTACHMENT0,0};
|
||||
glDrawBuffers(1, drawBuffers);
|
||||
|
||||
// Always check that our framebuffer is ok
|
||||
if(glCheckFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE)
|
||||
{
|
||||
status = true;
|
||||
}
|
||||
|
||||
return status;
|
||||
|
||||
}
|
||||
|
||||
void GLRenderToTexture::disable()
|
||||
{
|
||||
glBindFramebuffer( GL_FRAMEBUFFER, 0 );
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
}
|
||||
|
||||
GLRenderToTexture::~GLRenderToTexture()
|
||||
{
|
||||
glBindFramebuffer( GL_FRAMEBUFFER, 0 );
|
||||
|
||||
if (m_depthrenderbuffer)
|
||||
glDeleteRenderbuffers(1,&m_depthrenderbuffer);
|
||||
|
||||
if(m_renderedTexture)
|
||||
glDeleteTextures(1, &m_renderedTexture);
|
||||
|
||||
if( m_framebufferName)
|
||||
{
|
||||
glDeleteFramebuffers(1, &m_framebufferName);
|
||||
}
|
||||
}
|
||||
|
||||
28
btgui/OpenGLWindow/GLRenderToTexture.h
Normal file
28
btgui/OpenGLWindow/GLRenderToTexture.h
Normal file
@@ -0,0 +1,28 @@
|
||||
|
||||
#ifndef GL_RENDER_TO_TEXTURE_H
|
||||
#define GL_RENDER_TO_TEXTURE_H
|
||||
|
||||
///See http://www.opengl-tutorial.org/intermediate-tutorials/tutorial-14-render-to-texture/
|
||||
#include "OpenGLInclude.h"
|
||||
|
||||
struct GLRenderToTexture
|
||||
{
|
||||
GLuint m_framebufferName;
|
||||
GLuint m_renderedTexture;
|
||||
GLuint m_depthrenderbuffer;
|
||||
bool m_initialized;
|
||||
public:
|
||||
|
||||
GLRenderToTexture();
|
||||
|
||||
void init(int width, int height);
|
||||
bool enable();
|
||||
void disable();
|
||||
|
||||
virtual ~GLRenderToTexture();
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif //GL_RENDER_TO_TEXTURE_H
|
||||
|
||||
@@ -130,7 +130,7 @@
|
||||
-- include "../demo/gpu_initialize"
|
||||
-- include "../opencl/lds_bank_conflict"
|
||||
-- include "../opencl/reduce"
|
||||
-- include "../btgui/OpenGLTrueTypeFont"
|
||||
include "../btgui/OpenGLTrueTypeFont"
|
||||
-- include "../btgui/OpenGLWindow"
|
||||
-- include "../demo/ObjLoader"
|
||||
|
||||
|
||||
@@ -137,19 +137,19 @@ public:
|
||||
b3Vector3 m_accumulatedImpulse;
|
||||
//! Linear_Limit_parameters
|
||||
//!@{
|
||||
b3Scalar m_limitSoftness;//!< Softness for linear limit
|
||||
b3Scalar m_damping;//!< Damping for linear limit
|
||||
b3Scalar m_restitution;//! Bounce parameter for linear limit
|
||||
b3Vector3 m_normalCFM;//!< Constraint force mixing factor
|
||||
b3Vector3 m_stopERP;//!< Error tolerance factor when joint is at limit
|
||||
b3Vector3 m_stopCFM;//!< Constraint force mixing factor when joint is at limit
|
||||
//!@}
|
||||
bool m_enableMotor[3];
|
||||
b3Vector3 m_targetVelocity;//!< target motor velocity
|
||||
b3Vector3 m_maxMotorForce;//!< max force on motor
|
||||
b3Vector3 m_currentLimitError;//! How much is violated this limit
|
||||
b3Vector3 m_currentLinearDiff;//! Current relative offset of constraint frames
|
||||
int m_currentLimit[3];//!< 0=free, 1=at lower limit, 2=at upper limit
|
||||
b3Scalar m_limitSoftness;//!< Softness for linear limit
|
||||
b3Scalar m_damping;//!< Damping for linear limit
|
||||
b3Scalar m_restitution;//! Bounce parameter for linear limit
|
||||
//!@}
|
||||
bool m_enableMotor[3];
|
||||
int m_currentLimit[3];//!< 0=free, 1=at lower limit, 2=at upper limit
|
||||
|
||||
b3TranslationalLimitMotor()
|
||||
{
|
||||
@@ -280,8 +280,8 @@ protected:
|
||||
|
||||
//! Jacobians
|
||||
//!@{
|
||||
b3JacobianEntry m_jacLinear[3];//!< 3 orthogonal linear constraints
|
||||
b3JacobianEntry m_jacAng[3];//!< 3 orthogonal angular constraints
|
||||
// b3JacobianEntry m_jacLinear[3];//!< 3 orthogonal linear constraints
|
||||
// b3JacobianEntry m_jacAng[3];//!< 3 orthogonal angular constraints
|
||||
//!@}
|
||||
|
||||
//! Linear_Limit_parameters
|
||||
|
||||
Reference in New Issue
Block a user