Changeset View
Changeset View
Standalone View
Standalone View
libkwineffects/kwinglutils.h
Show First 20 Lines • Show All 413 Lines • ▼ Show 20 Line(s) | |||||
414 | * | 414 | * | ||
415 | * @author Rivo Laks <rivolaks@hot.ee> | 415 | * @author Rivo Laks <rivolaks@hot.ee> | ||
416 | **/ | 416 | **/ | ||
417 | class KWINGLUTILS_EXPORT GLRenderTarget | 417 | class KWINGLUTILS_EXPORT GLRenderTarget | ||
418 | { | 418 | { | ||
419 | public: | 419 | public: | ||
420 | /** | 420 | /** | ||
421 | * Constructs a GLRenderTarget | 421 | * Constructs a GLRenderTarget | ||
422 | * @since 5.13 | ||||
423 | **/ | ||||
424 | explicit GLRenderTarget(); | ||||
425 | | ||||
426 | /** | ||||
427 | * Constructs a GLRenderTarget | ||||
422 | * @param color texture where the scene will be rendered onto | 428 | * @param color texture where the scene will be rendered onto | ||
423 | **/ | 429 | **/ | ||
424 | explicit GLRenderTarget(const GLTexture& color); | 430 | explicit GLRenderTarget(const GLTexture& color); | ||
425 | ~GLRenderTarget(); | 431 | ~GLRenderTarget(); | ||
426 | 432 | | |||
427 | /** | 433 | /** | ||
428 | * Enables this render target. | 434 | * Enables this render target. | ||
429 | * All OpenGL commands from now on affect this render target until the | 435 | * All OpenGL commands from now on affect this render target until the | ||
430 | * @ref disable method is called | 436 | * @ref disable method is called | ||
431 | **/ | 437 | **/ | ||
432 | bool enable(); | 438 | bool enable(); | ||
433 | /** | 439 | /** | ||
434 | * Disables this render target, activating whichever target was active | 440 | * Disables this render target, activating whichever target was active | ||
435 | * when @ref enable was called. | 441 | * when @ref enable was called. | ||
436 | **/ | 442 | **/ | ||
437 | bool disable(); | 443 | bool disable(); | ||
438 | 444 | | |||
439 | /** | 445 | /** | ||
440 | * Sets the target texture | 446 | * Sets the target texture | ||
441 | * @param target texture where the scene will be rendered on | 447 | * @param target texture where the scene will be rendered on | ||
442 | * @since 4.8 | 448 | * @since 4.8 | ||
443 | **/ | 449 | **/ | ||
444 | void attachTexture(const GLTexture& target); | 450 | void attachTexture(const GLTexture& target); | ||
445 | 451 | | |||
452 | /** | ||||
453 | * Detaches the texture that is currently attached to this framebuffer object. | ||||
454 | * @since 5.13 | ||||
455 | **/ | ||||
456 | void detachTexture(); | ||||
457 | | ||||
446 | bool valid() const { | 458 | bool valid() const { | ||
447 | return mValid; | 459 | return mValid; | ||
448 | } | 460 | } | ||
449 | 461 | | |||
462 | void setTextureDirty() { | ||||
463 | mTexture.setDirty(); | ||||
464 | } | ||||
465 | | ||||
450 | static void initStatic(); | 466 | static void initStatic(); | ||
451 | static bool supported() { | 467 | static bool supported() { | ||
452 | return sSupported; | 468 | return sSupported; | ||
453 | } | 469 | } | ||
470 | | ||||
471 | /** | ||||
472 | * Pushes the render target stack of the input parameter in reverse order. | ||||
473 | * @param targets The stack of GLRenderTargets | ||||
474 | * @since 5.13 | ||||
475 | **/ | ||||
476 | static void pushRenderTargets(QStack <GLRenderTarget*> targets); | ||||
fredrik: This assumes that s_renderTargets is empty when this function is called, which might not be the… | |||||
477 | | ||||
454 | static void pushRenderTarget(GLRenderTarget *target); | 478 | static void pushRenderTarget(GLRenderTarget *target); | ||
455 | static GLRenderTarget *popRenderTarget(); | 479 | static GLRenderTarget *popRenderTarget(); | ||
456 | static bool isRenderTargetBound(); | 480 | static bool isRenderTargetBound(); | ||
457 | /** | 481 | /** | ||
458 | * Whether the GL_EXT_framebuffer_blit extension is supported. | 482 | * Whether the GL_EXT_framebuffer_blit extension is supported. | ||
459 | * This functionality is not available in OpenGL ES 2.0. | 483 | * This functionality is not available in OpenGL ES 2.0. | ||
460 | * | 484 | * | ||
461 | * @returns whether framebuffer blitting is supported. | 485 | * @returns whether framebuffer blitting is supported. | ||
▲ Show 20 Lines • Show All 340 Lines • Show Last 20 Lines |
This assumes that s_renderTargets is empty when this function is called, which might not be the case.
How about naming it pushRenderTargets(), and have it add the targets to s_renderTargets instead of replacing it?