PDA

View Full Version : Draw a 3d coordinate above a 2d coordinate. is it possible?



tirengarfio
07-11-2006, 07:13 AM
Hi,

Is it possible with opengl to draw the coordinate (0,0,0) of an object 3D above a 2D image in the coordinate (25,25)??

The coordinates are examples, of course

Mridul
07-11-2006, 08:35 AM
yes it is possible, try treating the image as a texture and render it, then render your 3d point.

ZbuffeR
07-11-2006, 08:54 AM
disable depth write while drawing the 2D image

tirengarfio
07-11-2006, 10:06 AM
excuse me, too much abstract for me that answer...

neither my english is not perfect.. :)

suaver
07-13-2006, 03:35 AM
U can reference something about "render to texture"..
It may help u..I hope so

tirengarfio
07-19-2006, 10:20 AM
Originally posted by Mridul:
treating the image as a texture and render it what should be the result of this?
what are the fuctions i should handle?

im newbie on this...

ZbuffeR
07-24-2006, 07:09 AM
I think you want to do something along this :


// per frame :
//clear both color and depth
glClear(GL_COLOR_BUFFER_BIT || GL_DEPTH_BUFFER_BIT);

// disable depth testing
glDisable( GL_DEPTH_TEST );
// disable depth write
glDepthMask(0);
// draw your image (ie. with a single textured GL_QUAD)
[...]

// enable depth testing
glEnable( GL_DEPTH_TEST );
// enable depth write
glDepthMask(1);
// draw your 3D objects
[...]

// swapbuffersThere may be simpler ways, but that should work.

tirengarfio
07-24-2006, 09:05 AM
thanks ZbuffeR!

tirengarfio
08-03-2006, 05:02 AM
Anyway, i have been thinking more...

Let's imagine my image 2d is this photo: http://www.colossusblog.com/mt/archives/images/rubiks.jpg

And my object 3d is a pyramid that i want to draw above the 2d image like it is on the rubiks cube ,you know, like a tower: the pyramid on the blue face.


You told there is no problem to put the coordinates of the base of the pyramid at the upper corners ,blue corners, of the cube. But,

what would be the coordinates of the top of the pyramid? who calculate them?