46 VL_DEBUG_SET_OBJECT_NAME()
52 VL_DEBUG_SET_OBJECT_NAME()
57 width = img->
width() - startx;
60 height = img->
height() - starty;
70 VL_DEBUG_SET_OBJECT_NAME()
100 if (discard_local_storage)
115 mDraws.setAutomaticDelete(
false);
124 glMatrixMode(GL_MODELVIEW);
129 glMatrixMode(GL_PROJECTION);
132 glOrtho( -0.5f, viewport[2]-0.5f, -0.5f, viewport[3]-0.5f, -1.0f, +1.0f );
VL_CHECK_OGL();
134 glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT);
VL_CHECK_OGL();
136 for(
int i=0; i<(int)
mDraws.size(); ++i)
140 if (cmd->
image() == 0)
161 pos_x -= cmd->
mSize.
x() -1;
163 pos_x -= cmd->
mSize.
x() / 2;
165 pos_y -= cmd->
mSize.
y() -1;
167 pos_y -= cmd->
mSize.
y() / 2;
171 if ( camera && actor && actor->
transform() )
179 v.
x() -= viewport[0];
180 v.
y() -= viewport[1];
182 pos_x += int(v.
x() + 0.5);
183 pos_y += int(v.
y() + 0.5);
188 if ( pos_x + cmd->
mSize.
x() -1 < 0 )
191 if ( pos_y + cmd->
mSize.
y() -1 < 0 )
194 if (pos_x > viewport[2] - 1)
197 if (pos_y > viewport[3] - 1)
202 int clip_left = pos_x < 0 ? -pos_x : 0;
203 int clip_bottom = pos_y < 0 ? -pos_y : 0;
204 int clip_right = (pos_x+cmd->
mSize.
x()-1)-( viewport[2]-1 );
205 int clip_top = (pos_y+cmd->
mSize.
y()-1)-( viewport[3]-1 );
213 glRasterPos2f( (
float)pos_x + clip_left, (
float)pos_y + clip_bottom );
216 glColor4f(1.0f,1.0f,1.0f,1.0f);
217 glNormal3f(0,0,1.0f);
222 glPixelStorei( GL_UNPACK_ROW_LENGTH, cmd->
image()->
width() );
223 glPixelStorei( GL_UNPACK_SKIP_PIXELS, cmd->
mStart.
x() + clip_left );
224 glPixelStorei( GL_UNPACK_SKIP_ROWS, cmd->
mStart.
y() + clip_bottom );
235 VL_glBindBuffer( GL_PIXEL_UNPACK_BUFFER, 0 );
243 VL_glBindBuffer( GL_PIXEL_UNPACK_BUFFER, 0 );
251 glMatrixMode(GL_MODELVIEW);
254 glMatrixMode(GL_PROJECTION);
262 for(
int i=0; i<(int)
mDraws.size(); ++i)
264 mDraws[i]->image()->pixelBufferObject()->deleteBufferObject();
271 for(
int i=0; i<(int)
mDraws.size(); ++i)
278 if ( !( Has_GL_ARB_pixel_buffer_object||Has_GL_EXT_pixel_buffer_object ) )
284 std::map< ref<Image>,
unsigned int> pbomap;
286 for(
int i=0; i<(int)
mDraws.size(); ++i)
294 mDraws[i]->generatePixelBufferObject(usage, discard_local_storage);
301 if ( (Has_GL_ARB_pixel_buffer_object||Has_GL_EXT_pixel_buffer_object) )
const Collection< Pixels > * draws() const
Associates a Renderable object to an Effect and Transform.
Vector2< int > ivec2
A 2 components vector with int precision.
const T_Scalar & x() const
void deleteBufferObject()
Transform * transform()
Returns the Transform bound tho an Actor.
const unsigned char * pixels() const
Raw pointer to pixels.
void releaseImages()
Iterates on the Pixels objects and sets their Image references to NULL.
bool mUsePixelBufferObject
const BufferObject * pixelBufferObject() const
The associated OpenGL Buffer Object.
Represents an OpenGL context, possibly a widget or a pbuffer, which can also respond to keyboard...
bool generatePixelBufferObject(EBufferObjectUsage usage, bool discard_local_storage)
Generates a pixel buffer object for the associated Image calling image()->bufferObject()->setBufferDa...
bool isValid() const
Returns true if the image has valid width/height/depth, pitch and byte alignment, type/format combina...
void setUsePixelBufferObject(bool use_pbo)
void deletePixelBufferObjects()
deallocate PBOs
int byteAlignment() const
Returns the byte-alignment of the row of the image.
Viewport * viewport()
The viewport bound to a camera.
Visualization Library main namespace.
Represents a bitmap to be drawn on the screen.
bool project(const vec4 &in_world, vec4 &out_viewp) const
Projects a vector from world coordinates to viewport coordinates.
void deletePixelBufferObject()
The base class for all the reference counted objects.
Buffer * imageBuffer()
The buffer used to store the image pixels.
Represents a vl::Image with an associated Pixel Buffer Object.
const T_Scalar & y() const
bool generatePixelBufferObjects(EBufferObjectUsage usage, bool discard_local_storage)
generates PBOs only for Pixels objects without a PBO handle
Manages most of the OpenGL rendering states responsible of the final aspect of the rendered objects...
void render_Implementation(const Actor *actor, const Shader *shader, const Camera *camera, OpenGLContext *gl_context) const
Renders the bitamps.
bool hasPixelBufferObject() const
The BufferObject class is a Buffer that can upload its data on the GPU memory.
unsigned int handle() const
Pixels & operator=(const Pixels &other)
void setBufferData(EBufferObjectUsage usage, bool discard_local_storage=false)
const T_Scalar & x() const
Represents a virtual camera defining, among other things, the point of view from which scenes can be ...
Collection< Pixels > mDraws
const T_Scalar & y() const
EImageFormat format() const