View Full Version : Emulating Writing on Surface
09-03-2008, 02:33 AM
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.
i) is this possible?
ii) is there such thing as a canvas in openGL?
iii) any suggestions on how I can achieve this?
09-03-2008, 03:36 AM
Can you explain what "emulating writing on a surface" means? And what do you mean by "canvas"?
09-03-2008, 03:53 AM
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...
09-03-2008, 06:03 AM
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.
09-03-2008, 06:05 AM
In this case I would "draw" on a texture and submit the dirty regions via TexSubImage and subsequently displaying the texture on the screen.
09-03-2008, 06:08 AM
What parameters does texsubimage take? Coordinates?
09-03-2008, 06:45 AM
The x/y-offsets are ints.
09-03-2008, 06:58 AM
i shall give it a try but I'm still new in textures :(
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.