View Full Version : Texture Lightning Problem
11-13-2003, 11:34 PM
i have a written a small application, where
i render OpenGL stuff to a system bitmap created by 'CreateDibSection'. This works pretty fine. But for some reason, textured
objects have no light spots, although
I'm using this 'glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SEPARATE_SPECULAR_COLOR);' call.
However, if i'm rendering objects to window
(instead of bitmap), texture lightning is visible again. It's just the same code.
Does anyone have a hint ? It's very frustating not having texture lightning, when rendering to bitmap.
When you render to a DIB you downst get the ICD driver, but rather the microsoft software implementation, and that doenst support that extension ( hint : always check extensions, dont assume them to be there)
11-14-2003, 12:14 AM
Hm, this is bad.
So, is there an alternative way to get texture lightning (like rendering object twice) ?
Or do i have to use window rendering ?
Well, maybe then i can hide the window always and just get the framebuffer afterwards.
But this is actually, what i want to avoid :-(
However, thank you very much for fast answering :-)
Redering twice, one time with diffuse + texturemap, and one additional render with only specular and additive blend should do the same.
You cannot render to a hidden window and expect anything to be there since the spec says that non-visible fragments are undefined. You could how ever have a hidden window ( for the sake of a rendercontext) and then render to PBuffers, and reading back that result. that will use accellerated rendering on all cards that supports pbuffers .
11-14-2003, 02:45 AM
Well, how it is done ?
I mean, "rendering to pBuffers".
By now, i just create a render context, and call some opengl functions. After glFinish(),
i use glReadPixels for getting what is rendered.
11-14-2003, 04:06 AM
A little nitpicking: A lightning is what you get in stormy weather with thunder and stuff. Your correct word is lighting.
11-14-2003, 09:05 AM
You can't retrieve the pixels of a hidden/obscured part of a window.
You can choose one of two ways of doing what you want:
1) Render to the back buffer, copy from the back buffer to a texture using CopyTexSubImage, then clear and render the real scene without swapping buffers. Works as long as your window is not obscured.
2) Render to pbuffer and use either the pbuffer-to-texture binding extension, or CopyTexSubImage to get the data into a texture.
Btw: glReadPixels() does an implicit finish up to that point in the pipeline.
Regarding how to use pbuffers, read the extension specification for WGL_ARB_pbuffer (perhaps just plug that term into Google, even).
11-17-2003, 06:07 AM
Ah, thank you for your reply.
I suppose, that this extension (p-Buffer)
only work for some special graphic cards.
However, if it is the only way ...
There is some strange behavious, which i don't understand. When using the "hidden-window" variant, i got good results
using full-scene-antialising on a machine with "NON-OPENGL" graphic card. Alas, i don't get texture lighting.
On another machine, which instead has an OPENGL-supporting card, i always lost antialiasing. But texture lighting is there.
It rather seems, as if accum buffer is not used. Only if i show the render window,
then antialising effect becomes visible.
But why does it work on the weaker machine
without problems ?
This does not make sense to me.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.