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

07-11-2006, 06:13 AM

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

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

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

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

neither my english is not perfect.. :)

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

07-19-2006, 09: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...

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

// per frame :
//clear both color and depth

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

// enable depth testing
glEnable( GL_DEPTH_TEST );
// enable depth write
// draw your 3D objects

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

07-24-2006, 08:05 AM
thanks ZbuffeR!

08-03-2006, 04: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?