Mixing 2D & 3D stuff in opengl

I have a problem that i can locate. I draw 3D cube in screen and i enter
in ortho mode with functions from testgl.c for drawing a texture in 2D.
After doing it i swap buffers.

The problem is that only remains in screen the 2D stuff the 3D cube only
appears like a flash at start of the while. I conpared with testgl.c and
it looks good.

Some idea ?

Any code?
I still don’t like the idea of using ortho-mode (as you call it). Why
don’t you define a texture and draw a textured box? Seems to me like the
easiest way, but not if your “texture” is changing!!!
Anyhow, another idea would be, have you turned on depth test or blend? If
it’s depth test (I think this one is the default from OGL), then you should
try {glDisable(GL_DEPTH_TEST); glEnable(GL_BLEND);}, and your problem could
be solved. If it’s not, then check if you do the buffer-swapping twice,
this could explain, why the cube appears and then disappears …
hope that helps,
St0fF 64.

At 20:16 18.02.2002 +0100, you wrote:>I have a problem that i can locate. I draw 3D cube in screen and i enter

in ortho mode with functions from testgl.c for drawing a texture in 2D.
After doing it i swap buffers.

The problem is that only remains in screen the 2D stuff the 3D cube only
appears like a flash at start of the while. I conpared with testgl.c and
it looks good.

Some idea ?


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

You need to push the rendering matrix before you change the ortho, and
then pop it afterwards.

Also, regarding 2D on 3D, you can create a single texture that you can
write to, as long as it’s the same size; just use the subtexture
functions with the same texture you used for creating the texture. It
has to be the same size, but if you are just animating something, it
shouldn’t matter. This is far faster than destroying and recreating the
texture each time.> ----- Original Message -----

From: sdl-admin@libsdl.org [mailto:sdl-admin at libsdl.org] On Behalf Of
St0fF 64
Sent: Monday, February 18, 2002 10:14 PM
To: sdl at libsdl.org
Subject: Re: [SDL] Mixing 2D & 3D stuff in opengl

Any code?
I still don’t like the idea of using ortho-mode (as you call it). Why
don’t you define a texture and draw a textured box? Seems to me like
the
easiest way, but not if your “texture” is changing!!!
Anyhow, another idea would be, have you turned on depth test or blend?
If
it’s depth test (I think this one is the default from OGL), then you
should
try {glDisable(GL_DEPTH_TEST); glEnable(GL_BLEND);}, and your problem
could
be solved. If it’s not, then check if you do the buffer-swapping twice,

this could explain, why the cube appears and then disappears …
hope that helps,
St0fF 64.

At 20:16 18.02.2002 +0100, you wrote:

I have a problem that i can locate. I draw 3D cube in screen and i
enter
in ortho mode with functions from testgl.c for drawing a texture in 2D.
After doing it i swap buffers.

The problem is that only remains in screen the 2D stuff the 3D cube
only
appears like a flash at start of the while. I conpared with testgl.c
and
it looks good.

Some idea ?