Hello
I am an OpenGL beginner, and I'm trying to use both textured and
non-textured faces in the same scene. Is that possible ?
I took the following code from a tutorial (www.gametutorials.com) that draw
a textured square.
I'd like to draw another square right after this one but using no texture
(only a color set by glColor())
I trying to simply put glColor() followed by vertex creation but I had no
visible square on the screen.
How can I acheive that ?
Thank you in advance for you help.
// Bind the texture stored at the zero index of g_Texture[]
glBindTexture(GL_TEXTURE_2D, g_Texture[0]);
// Display a quad texture to the screen
glBegin(GL_QUADS);
// Display the top left vertice
glTexCoord2f(0.0f, 0.0f);
glVertex3f(-1, 1, 0);
// Display the bottom left vertice
glTexCoord2f(0.0f, 1.0f);
glVertex3f(-1, -1, 0);
// Display the bottom right vertice
glTexCoord2f(1.0f, 1.0f);
glVertex3f(1, -1, 0);
// Display the top right vertice
glTexCoord2f(1.0f, 0.0f);
glVertex3f(1, 1, 0);
// What if I wanna draw a non-textured QUAD here ?
glEnd();
|
|
0
|
|
|
|
Reply
|
Stab
|
10/28/2004 4:48:25 PM |
|
Stab wrote:
> Hello
>
> I am an OpenGL beginner, and I'm trying to use both textured and
> non-textured faces in the same scene. Is that possible ?
Of course.
> // What if I wanna draw a non-textured QUAD here ?
>
glEnd();
glDisable(GL_TEXTURE_2D);
glBegin(GL_QUADS);
--
<\___/> For email, remove my socks.
/ O O \
\_____/ FTB. The Cheat is not dead!
|
|
0
|
|
|
|
Reply
|
fungus
|
10/28/2004 5:12:03 PM
|
|
"Stab" <stabrico@yahoo.fr> wrote in message
news:41812283$0$13810$636a15ce@news.free.fr...
snip
> // What if I wanna draw a non-textured QUAD here ?
>
> glEnd();
>
Either glDisable(GL_TEXTURE_2D) or glBind to texture id 0 (the default)
before you draw your next quad.
Roger
|
|
0
|
|
|
|
Reply
|
Roger
|
10/28/2004 5:33:37 PM
|
|
Roger Rowland wrote:
> Either glDisable(GL_TEXTURE_2D) or glBind to texture id 0 (the default)
> before you draw your next quad.
Of course, you might have a texture bound to texture ID 0. :-)
--
Andy V
|
|
0
|
|
|
|
Reply
|
Andy
|
10/30/2004 11:20:43 PM
|
|
"Andy V" <noone@nowhere.togo> wrote in message
news:flVgd.704$Zx3.28379@petpeeve.ziplink.net...
> Roger Rowland wrote:
>
> > Either glDisable(GL_TEXTURE_2D) or glBind to texture id 0 (the default)
> > before you draw your next quad.
>
> Of course, you might have a texture bound to texture ID 0. :-)
>
> --
> Andy V
>
True :-)
But if not (who would do such a thing?!), is it not preferable to do that
rather than turning texturing on and off?
(I'm sure someone will correct me if I'm wrong, but it would be nice to have
confirmation if I'm not!)
Rog
|
|
0
|
|
|
|
Reply
|
Roger
|
11/1/2004 12:58:19 PM
|
|
Roger Rowland wrote:
> >> glBind to texture id 0
>
> is it not preferable to do that
> rather than turning texturing on and off?
>
Are you asking "Is it better to use another
function to turn texture off rather than
the function designed to turn it off?"
--
<\___/> For email, remove my socks.
/ O O \
\_____/ FTB. The Cheat is not dead!
|
|
0
|
|
|
|
Reply
|
fungus
|
11/1/2004 2:13:43 PM
|
|
Thank you, it works :)
In fact I tried this but it wouldn't work because I did it in the same
glBegin / glEnd block.
"Roger Rowland" <see.sig@bottomof.message> a �crit dans le message de news:
1099313903.85278.0@despina.uk.clara.net...
> "Andy V" <noone@nowhere.togo> wrote in message
> news:flVgd.704$Zx3.28379@petpeeve.ziplink.net...
> > Roger Rowland wrote:
> >
> > > Either glDisable(GL_TEXTURE_2D) or glBind to texture id 0 (the
default)
> > > before you draw your next quad.
> >
> > Of course, you might have a texture bound to texture ID 0. :-)
> >
> > --
> > Andy V
> >
>
> True :-)
>
> But if not (who would do such a thing?!), is it not preferable to do that
> rather than turning texturing on and off?
>
> (I'm sure someone will correct me if I'm wrong, but it would be nice to
have
> confirmation if I'm not!)
>
> Rog
>
>
|
|
0
|
|
|
|
Reply
|
Stab
|
11/1/2004 2:16:49 PM
|
|
"fungus" <openglMY@SOCKSartlum.com> wrote in message
news:swrhd.1465$f85.188@news.ono.com...
> Roger Rowland wrote:
> > >> glBind to texture id 0
> >
> > is it not preferable to do that
> > rather than turning texturing on and off?
> >
>
> Are you asking "Is it better to use another
> function to turn texture off rather than
> the function designed to turn it off?"
>
Not really.
I was asking, is it better performance-wise to bind to texture 0 (with no
texture loaded) rather than glDisable(GL_TEXTURE_2D)? Would there be any
difference in the end result (visually), and would the former involve (I'm
guessing) no state change in the pipeline and (I'm still guessing) better
performance?
I suppose I could try it, but if you know anything in theory, I'd be
interested in your comments.
Roger
|
|
0
|
|
|
|
Reply
|
Roger
|
11/1/2004 4:22:46 PM
|
|
>
> Not really.
>
> I was asking, is it better performance-wise to bind to texture 0 (with no
> texture loaded) rather than glDisable(GL_TEXTURE_2D)? Would there be any
> difference in the end result (visually), and would the former involve (I'm
> guessing) no state change in the pipeline and (I'm still guessing) better
> performance?
>
> I suppose I could try it, but if you know anything in theory, I'd be
> interested in your comments.
>
> Roger
>
>
If there's a speed differerence, glDisable should be faster:
The drivers should be optimized for binding existing textures,
since this is the normal case. Binding a new texture involves more
changes (texture image size, number of mipmaps, lod bias, etc) than just
disabling texturing. It could be that drivers do some calculations
for that stuff before checking if texture 0 is a valid texture.
Philipp
|
|
0
|
|
|
|
Reply
|
Philipp
|
11/1/2004 5:37:25 PM
|
|
Roger Rowland wrote:
>
> I suppose I could try it, but if you know anything
> in theory, I'd be interested in your comments.
>
I know that all documentation says that glBindTexture
is usually the most expensive OpenGL operation of all.
--
<\___/> For email, remove my socks.
/ O O \
\_____/ FTB. The Cheat is not dead!
|
|
0
|
|
|
|
Reply
|
fungus
|
11/1/2004 5:51:28 PM
|
|
|
9 Replies
122 Views
(page loaded in 0.713 seconds)
Similiar Articles: Mutltitexturing - comp.graphics.api.openglI have two rectangle surfaces covered by a texture, one faces ... ... GL_TEXTURE1 for the second), then the both rectangles get textured with the first texture ... glDrawElements with different texture indices - comp.graphics.api ...... these vertices, plus i have an array of texture ... FLAT shaded with one normal/color per face ... as a spinning piece of heavy geometry, textured ... Therefore I cannot use ... renderbuffer objects - comp.graphics.api.openglI mean that the copy to a non-resident texture ... are set: glEnable(GL_CULL_FACE ... texture as said in ARB_depth_texture. In my case (direct use w/o shader) the textured ... FTGL font engine - comp.graphics.api.openglWhile OpenGL texture targets GL_TEXTURE_[123]D and ... glReadPixels see data > bottom to top, cubemap face ... First let me tell you, that you should better use textured ... How to draw framebuffer to device context ? - comp.graphics.api ...Or you can render into a texture, then use the resulting texture to render textured polygons to the ... to device context ? - comp.graphics.api ..... events (e.g. a non ... Fisheye - comp.graphics.api.openglCurrently I render the scene into a texture and do the warping in image space with a high resolution textured grid. ... see were my bottleneck is and stay with the non ... VBOs vs Display Lists - lets test it out! - comp.graphics.api ...What happens if you use texture... or colors? What happens ... flicking through these here and they appear to be non ... load two .PLY meshes BIG: 327323 vertices 654666 Faces ... Part color when shaded - comp.cad.solidworksThere is also a difference in using real ... all. >> >>Gary > > > Color ..and texture ...can be changed at different levels, > face ... any other card's value in a non ... Neural Network Classification - comp.soft-sys.matlabHi I'm working on a face recognition project(using MATLAB) and I ... images as MRI or non-MRI,fundus-non ... Need code for Texture Classification using ANN - comp.soft-sys ... SPEED TEST: DirectX9 vs openGL - comp.graphics.api.opengl ...... as a spinning piece of heavy geometry, textured ... Vertex cache is an issue sending non-stripped ... > selecting what features to use in D3D FFP multi-texture is a lot easier ... Doc:2.4/Manual/Textures/Mapping/UV/Unwrapping - BlenderWikiSet 'Draw type' to 'Textured' ... later on: a face's UV image texture only has to use part of the ... for the addtional face will be added to the existing set in a non ... Doc:2.4/Manual/Textures/Painting - BlenderWiki... the currently select UV Texture, using its UV map to transfer the colors to the faces of ... if the 3D View is in textured viewport mode). However, the modified texture will ... 7/17/2012 9:15:41 AM
|