Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 8 of 8

Thread: Emulating Writing on Surface

  1. #1
    Junior Member Newbie
    Join Date
    Aug 2008
    Posts
    10

    Emulating Writing on Surface

    Hi all

    I'm interested in emulating writing on a surface. My current idea:

    i) map a blank texture onto a plane
    ii)use a mouse to explore the surface
    iii) where the mouse is (when button pressed), the pixel on the surface will be changed to a chosen colour.

    Questions:

    i) is this possible?
    ii) is there such thing as a canvas in openGL?
    iii) any suggestions on how I can achieve this?

    Regards

  2. #2
    Senior Member OpenGL Pro Zengar's Avatar
    Join Date
    Sep 2001
    Location
    Germany
    Posts
    1,979

    Re: Emulating Writing on Surface

    Can you explain what "emulating writing on a surface" means? And what do you mean by "canvas"?

  3. #3
    Intern Contributor
    Join Date
    Jan 2007
    Posts
    89

    Re: Emulating Writing on Surface

    You can can change rectanglular areas of an existing texture via glTexSubImage2D(), even single pixels.

    So just update the texel where the mouse cursor is. The texel coordinate you have to calculate yourself, OpenGL won't do it for you.

    But i'm not sure if i understood the question...

  4. #4
    Junior Member Newbie
    Join Date
    Aug 2008
    Posts
    10

    Re: Emulating Writing on Surface

    Its actually similar to paint applications. You can free write on the screen.

    I just want to create a simple application that can write something on a plane by using mouse interaction.

  5. #5
    Senior Member OpenGL Pro Zengar's Avatar
    Join Date
    Sep 2001
    Location
    Germany
    Posts
    1,979

    Re: Emulating Writing on Surface

    In this case I would "draw" on a texture and submit the dirty regions via TexSubImage and subsequently displaying the texture on the screen.

  6. #6
    Junior Member Newbie
    Join Date
    Aug 2008
    Posts
    10

    Re: Emulating Writing on Surface

    What parameters does texsubimage take? Coordinates?

  7. #7
    Intern Contributor
    Join Date
    Jan 2007
    Posts
    89

    Re: Emulating Writing on Surface


  8. #8
    Junior Member Newbie
    Join Date
    Aug 2008
    Posts
    10

    Re: Emulating Writing on Surface

    i shall give it a try but I'm still new in textures

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •