Advertisement

Another newbie..

Started by April 14, 2002 05:40 AM
4 comments, last by jtarbox 22 years, 10 months ago
Ok, after about a week or so I''m starting to get the hang of OpenGL. My first code got into creating fonts with wglUseFontOutline(), and I had some fun with blending, setting the alpha channel each pass to do a fading effect, and some basic rotation. Fairly neat, but I have gotten to the point where I wanna add textures.. I have setup a lil texture manager which will create and load whatever I want, however, before I even got to test it (confirmed by just not calling it at all) I am seeing my original code about 10x darker then it should be (as in I can barely see it.) I''ve narrowed it down to the newly added glEnable(GL_TEXTURE_2D) call.. this call alone is what''s causing this. I even threw in a light right next to the text to see if that would work, but it doesn''t seem to do anything. I don''t notice this on the Nehe tutorial 8 (the first blending tutorial), but I do on the tutorial 24 when blending is enabled (everything darkens by a significant factor). I''m running a GeForce2 mx400 w/ 64 meg, athlon tbird 1.2 ghz, 256 meg ram, 40gig ata/100.. using the VS .NET compiler and the latest drivers for Windows 2000. any thoughts? My init code for the OpenGL state is near identical to the tutorial 8''s init. Jonathan Tarbox
Are u enabling texturing and then not actually texturing the font? If you aren't tetxuring an object then u have to make sure u call (if you've enabled it previously):
glDisable(GL_TEXTURE_2D) ;

before u draw that object.

This might be the problem, but isn't neccessarily.

[edited by - MelvinElvin on April 14, 2002 7:29:38 AM]
GSACP: GameDev Society Against Crap PostingTo join: Put these lines in your signature and don't post crap!
Advertisement
naw, that ain''t it, just tested by binding a texture each loop.. Though the texure isn''t applying due to me not setting tex coords (they are fonts created with the wgl functions, i''d need to do that auto-texture-coord stuff..

but it still shouldn''t be so dark.
The thing is - If you aint setting the texture properly, OGL does not know what to do with the materials... Try disabling the textures just before you render like the other poster said.

Landsknecht
My sig used to be, "God was my co-pilot but we crashed in the mountains and I had to eat him..."
But folks whinned and I had to change it.
ok, that''s.. weird behavior..

lesson learned though, either use a texture or disable texturing before you draw the object.

k, anyone know how one would fade the object then? it''s a font called from a display list.. i''m able to use a texture on it via the GL_TEXTURE_GEN_.. stuff. Before I added textures, I would control fading via the alpha channel in glColor4f(), obviously this won''t work with a textured object so anyone have any ideas?

-jtarbox
let me correct that.. my current transparency/fading code isn''t applying to the textures. thought in nehe lesson 8 he mentions he''s using the glColor function to define full brightness with 50% alpha.. my code isn''t full brightness but it is bouncing between 0 and 30 percent transparency with no change to the newly aded textures

This topic is closed to new replies.

Advertisement