Draw a 3d coordinate above a 2d coordinate. is it possible?

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

yes it is possible, try treating the image as a texture and render it, then render your 3d point.

disable depth write while drawing the 2D image

excuse me, too much abstract for me that answer…

neither my english is not perfect… :slight_smile:

U can reference something about “render to texture”…
It may help u…I hope so

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…

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
[...]

// swapbuffers

There may be simpler ways, but that should work.

thanks ZbuffeR!

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?