My program got the error of "GL_HISTOGRAM was not declared". But, I did
include the header <gl.h>, which I supposed to cope with this. Is it correct?
Or what other headers should be included to fix it? Tks.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Header files are simply text source files; why don't you actually take a look
to see if it is defined, or perform a file search to see where it is defined?
Also check that it is not disabled by a conditional compilation macro.
Beyond that, as ever, don't describe your errors; post them! Post the
compile log and the code as requested in the PLEASE READ BEFORE POSTING A
QUESTION thread.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I do not agree with your saying that I am bad to ask at several forums. In
fact, it's shown that I would like to fix the problem sincerely. And different
forums would have different group of well-experienced talents or experts
providing valuable advises taht would speed up the process. Please understand
that we are looking for problem solving through the experience of different
people, ie the spirit of forum............
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I did not say you were bad _to ask on multiple forums; I said it is
_considered bad form.
Personally I don't worry about it, but I note that on other forums you have
posted this to, people have objected. It is considered rude and poor
etiquette, so if you do it, you are likely to get a poor response from those
that might otherwise assist you, and a bad reputation that may affect your
ability to get help in the future.
There is a very real problem with doing this however; now for example when I
Google "GL_HISTOGRAM" in a genuine attempt to assist you, all I get is a list
of forum posts made by you asking the same question everywhere!
Anyway, I have told you how to determine if GL_HISTOGRAM is defined; did you
find it yet? Unfortunately it seems you do not really want to solve your
problem, and would rather pick a fight, since you chose not to post the
requested diagnostic information.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
No matter you argee or not, I don't think it is a big deal.... Once some one
gets sick seriously, he should get different advice from different doctor.
Either try to get the solution right away, or not to being mislead. This is a
normal practice, which depends very much how you think the importance of the
problem it is. Maybe this is come from different culture. I wonder you are
over-reacted.
On the other hand, I was so disappointed that you said I was try to pick a
fight. How can I start a fight by just rasing a same question on several
forums? Tell you the truth, I only got valuable response from one or two
forums, and the others are not.
If it is really the case, I will not post multi-forum later on.
By the way, the problem was not solved yet, and can you help?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The difference is your doctors get paid for their work and is not a volunteer.
Besides I don't know why you are arguing with me; I am merely pointing out the
convention; if you choose to ignore the convention, people will choose to
react accordingly to your request for assistance. Your problem, not mine.
How can I start a fight by just raising a same question on several forums?
You chose to pick a fight when you chose to challenge the advice _not _to post
on multiple forums. It was just advice.
By the way, the problem was not solved yet, and can you help?
Yes! I am ready and waiting; you have not yet provided feedback on my first
suggestion (post #2), and I requested further diagnostic information, but you
have not yet provided it.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The source code is "Imaging.cpp" from OpenGL SuperBible Demonstrates Imaging
Operations Program by Richard S. Wright Jr., as below, and the platform is
Windows Vista:
======================================================================
include "gl/gltools.h" // OpenGL toolkit
include "gl/gl.h"
include "gl/glut.h"
include <math.h>
include <stdio.h>
include <stdlib.h>
//////////////////////////////////////////////////////////////////
// Module globals to save source image data
static GLbyte *pImage = NULL;
static GLint iWidth, iHeight, iComponents;
static GLenum eFormat;
// Global variable to store desired drawing mode
static GLint iRenderMode = 1;
static GLboolean bHistogram = GL_FALSE;
//////////////////////////////////////////////////////////////////
// This function does any needed initialization on the rendering
// context.
void SetupRC(void)
{
// Black background
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
void ShutdownRC(void)
{
// Free the original image data
free(pImage);
}
//////////////////////////////////////////////////////////////////////////////
/
// Reset flags as appropriate in response to menu selections
void ProcessMenu(int value)
{
// For historgram, do not change render mode, just set
// histogram flag to true
if(value == 6) // Histogram
{
bHistogram = GL_TRUE;
glutPostRedisplay();
return;
}
if(value == 0)
// Save image
gltWriteTGA("ScreenShot.tga");
else
// Change render mode index to match menu entry index
iRenderMode = value;
// Trigger Redraw
glutPostRedisplay();
}
///////////////////////////////////////////////////////////////////////
// Called to draw scene
void RenderScene(void)
{
GLint i; // Looping variable
GLint iViewport; // Viewport
GLint iLargest; // Largest histogram value
static GLubyte invertTable;// Inverted color table
// Do a black and white scaling
static GLfloat lumMat = { 0.30f, 0.30f, 0.30f, 0.0f,
0.59f, 0.59f, 0.59f, 0.0f,
0.11f, 0.11f, 0.11f, 0.0f,
0.0f, 0.0f, 0.0f, 1.0f };
static GLint histoGram; // Storeage for histogram statistics
// Clear the window with current clearing color
glClear(GL_COLOR_BUFFER_BIT);
// Current Raster Position always at bottom left hand corner of window
glRasterPos2i(0, 0);
glGetIntegerv(GL_VIEWPORT, iViewport);
glPixelZoom((GLfloat) iViewport / (GLfloat)iWidth, (GLfloat) iViewport /
(GLfloat)iHeight);
if(bHistogram == GL_TRUE) // Collect Historgram data
{
// We are collecting luminance data, use our conversion formula
// instead of OpenGL's (which just adds color components together)
glMatrixMode(GL_COLOR);
glLoadMatrixf(lumMat);
glMatrixMode(GL_MODELVIEW);
// Reset everyting to default
glMatrixMode(GL_COLOR);
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);
glDisable(GL_CONVOLUTION_2D);
glDisable(GL_COLOR_TABLE);
// Show our hard work...
glutSwapBuffers();
}
void ChangeSize(int w, int h)
{
// Prevent a divide by zero, when window is too short
// (you cant make a window of zero width).
if(h == 0)
h = 1;
glViewport(0, 0, w, h);
// Reset the coordinate system before modifying
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
// Set the clipping volume
gluOrtho2D(0.0f, (GLfloat) w, 0.0, (GLfloat) h);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
/////////////////////////////////////////////////////////////
// Main program entrypoint
int main(int argc, char* argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB | GL_DOUBLE);
glutInitWindowSize(600 ,600);
glutCreateWindow("OpenGL Imaging subset");
// Check for imaging subset, must be done after window
// is create or there won't be an OpenGL context to query
if(gltIsExtSupported("GL_ARB_imaging") == 0)
{
printf("Imaging subset not supported\r\n");
return 0;
}
OK, since you won't take advice, I have looked for you! Here is the glext.h header that
defines GL_HISTOGRAM. You will see that it is not defined if
GL_ARB_imaging_DEPRECATED is defined.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
i agree, thats why i give general answers. also because of the information
they provide, thats all i can do sometimes. when the programer posted the
source code, i felt it was his orignal code and not openGL header code. i dont
know openGL so i gave a general answer.
if they know what they are doing and understand whats going on, i believe even
a general hint could solve the problem.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
My program got the error of "GL_HISTOGRAM was not declared". But, I did
include the header <gl.h>, which I supposed to cope with this. Is it correct?
Or what other headers should be included to fix it? Tks.
Header files are simply text source files; why don't you actually take a look
to see if it is defined, or perform a file search to see where it is defined?
Also check that it is not disabled by a conditional compilation macro.
Beyond that, as ever, don't describe your errors; post them! Post the
compile log and the code as requested in the PLEASE READ BEFORE POSTING A
QUESTION thread.
... Also scatter gunning your question on every forum available is considered
bad form.
I do not agree with your saying that I am bad to ask at several forums. In
fact, it's shown that I would like to fix the problem sincerely. And different
forums would have different group of well-experienced talents or experts
providing valuable advises taht would speed up the process. Please understand
that we are looking for problem solving through the experience of different
people, ie the spirit of forum............
I did not say you were bad _to ask on multiple forums; I said it is
_considered bad form.
Personally I don't worry about it, but I note that on other forums you have
posted this to, people have objected. It is considered rude and poor
etiquette, so if you do it, you are likely to get a poor response from those
that might otherwise assist you, and a bad reputation that may affect your
ability to get help in the future.
There is a very real problem with doing this however; now for example when I
Google "GL_HISTOGRAM" in a genuine attempt to assist you, all I get is a list
of forum posts made by you asking the same question everywhere!
Anyway, I have told you how to determine if GL_HISTOGRAM is defined; did you
find it yet? Unfortunately it seems you do not really want to solve your
problem, and would rather pick a fight, since you chose not to post the
requested diagnostic information.
Hi, cpns,
No matter you argee or not, I don't think it is a big deal.... Once some one
gets sick seriously, he should get different advice from different doctor.
Either try to get the solution right away, or not to being mislead. This is a
normal practice, which depends very much how you think the importance of the
problem it is. Maybe this is come from different culture. I wonder you are
over-reacted.
On the other hand, I was so disappointed that you said I was try to pick a
fight. How can I start a fight by just rasing a same question on several
forums? Tell you the truth, I only got valuable response from one or two
forums, and the others are not.
If it is really the case, I will not post multi-forum later on.
By the way, the problem was not solved yet, and can you help?
The difference is your doctors get paid for their work and is not a volunteer.
Besides I don't know why you are arguing with me; I am merely pointing out the
convention; if you choose to ignore the convention, people will choose to
react accordingly to your request for assistance. Your problem, not mine.
You chose to pick a fight when you chose to challenge the advice _not _to post
on multiple forums. It was just advice.
Yes! I am ready and waiting; you have not yet provided feedback on my first
suggestion (post #2), and I requested further diagnostic information, but you
have not yet provided it.
The source code is "Imaging.cpp" from OpenGL SuperBible Demonstrates Imaging
Operations Program by Richard S. Wright Jr., as below, and the platform is
Windows Vista:
======================================================================
include "gl/gltools.h" // OpenGL toolkit
include "gl/gl.h"
include "gl/glut.h"
include <math.h>
include <stdio.h>
include <stdlib.h>
//////////////////////////////////////////////////////////////////
// Module globals to save source image data
static GLbyte *pImage = NULL;
static GLint iWidth, iHeight, iComponents;
static GLenum eFormat;
// Global variable to store desired drawing mode
static GLint iRenderMode = 1;
static GLboolean bHistogram = GL_FALSE;
//////////////////////////////////////////////////////////////////
// This function does any needed initialization on the rendering
// context.
void SetupRC(void)
{
// Black background
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
// Load the horse image
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
pImage = gltLoadTGA("horse.tga", &iWidth, &iHeight, &iComponents, &eFormat);
}
void ShutdownRC(void)
{
// Free the original image data
free(pImage);
}
//////////////////////////////////////////////////////////////////////////////
/
// Reset flags as appropriate in response to menu selections
void ProcessMenu(int value)
{
// For historgram, do not change render mode, just set
// histogram flag to true
if(value == 6) // Histogram
{
bHistogram = GL_TRUE;
glutPostRedisplay();
return;
}
if(value == 0)
// Save image
gltWriteTGA("ScreenShot.tga");
else
// Change render mode index to match menu entry index
iRenderMode = value;
// Trigger Redraw
glutPostRedisplay();
}
///////////////////////////////////////////////////////////////////////
// Called to draw scene
void RenderScene(void)
{
GLint i; // Looping variable
GLint iViewport; // Viewport
GLint iLargest; // Largest histogram value
static GLubyte invertTable;// Inverted color table
// Do a black and white scaling
static GLfloat lumMat = { 0.30f, 0.30f, 0.30f, 0.0f,
0.59f, 0.59f, 0.59f, 0.0f,
0.11f, 0.11f, 0.11f, 0.0f,
0.0f, 0.0f, 0.0f, 1.0f };
static GLfloat mSharpen = { // Sharpen convolution kernel
{0.0f, -1.0f, 0.0f},
{-1.0f, 5.0f, -1.0f },
{0.0f, -1.0f, 0.0f }};
static GLfloat mEmboss = { // Emboss convolution kernel
{ 2.0f, 0.0f, 0.0f },
{ 0.0f, -1.0f, 0.0f },
{ 0.0f, 0.0f, -1.0f }};
static GLint histoGram; // Storeage for histogram statistics
// Clear the window with current clearing color
glClear(GL_COLOR_BUFFER_BIT);
// Current Raster Position always at bottom left hand corner of window
glRasterPos2i(0, 0);
glGetIntegerv(GL_VIEWPORT, iViewport);
glPixelZoom((GLfloat) iViewport / (GLfloat)iWidth, (GLfloat) iViewport /
(GLfloat)iHeight);
if(bHistogram == GL_TRUE) // Collect Historgram data
{
// We are collecting luminance data, use our conversion formula
// instead of OpenGL's (which just adds color components together)
glMatrixMode(GL_COLOR);
glLoadMatrixf(lumMat);
glMatrixMode(GL_MODELVIEW);
// Start collecting histogram data, 256 luminance values
glHistogram(GL_HISTOGRAM, 256, GL_LUMINANCE, GL_FALSE);
glEnable(GL_HISTOGRAM);
}
// Do image operation, depending on rendermode index
switch(iRenderMode)
{
case 5: // Sharpen image
glConvolutionFilter2D(GL_CONVOLUTION_2D, GL_RGB, 3, 3, GL_LUMINANCE, GL_FLOAT,
mSharpen);
glEnable(GL_CONVOLUTION_2D);
break;
case 4: // Emboss image
glConvolutionFilter2D(GL_CONVOLUTION_2D, GL_RGB, 3, 3, GL_LUMINANCE, GL_FLOAT,
mEmboss);
glEnable(GL_CONVOLUTION_2D);
glMatrixMode(GL_COLOR);
glLoadMatrixf(lumMat);
glMatrixMode(GL_MODELVIEW);
break;
case 3: // Invert Image
for(i = 0; i < 255; i++)
{
invertTable_ = (GLubyte)(255 - i);
invertTable_ = (GLubyte)(255 - i);
invertTable_ = (GLubyte)(255 - i);
}
glColorTable(GL_COLOR_TABLE, GL_RGB, 256, GL_RGB, GL_UNSIGNED_BYTE,
invertTable);
glEnable(GL_COLOR_TABLE);
break;
case 2: // Brighten Image
glMatrixMode(GL_COLOR);
glScalef(1.25f, 1.25f, 1.25f);
glMatrixMode(GL_MODELVIEW);
break;
case 1: // Just do a plain old image copy
default:
// This line intentially left blank
break;
}
// Do the pixel draw
glDrawPixels(iWidth, iHeight, eFormat, GL_UNSIGNED_BYTE, pImage);
// Fetch and draw histogram?
if(bHistogram == GL_TRUE)
{
// Read histogram data into buffer
glGetHistogram(GL_HISTOGRAM, GL_TRUE, GL_LUMINANCE, GL_INT, histoGram);
// Find largest value for scaling graph down
iLargest = 0;
for(i = 0; i < 255; i++)
if(iLargest < histoGram_)
iLargest = histoGram_;
// White lines
glColor3f(1.0f, 1.0f, 1.0f);
glBegin(GL_LINE_STRIP);
for(i = 0; i < 255; i++)
glVertex2f((GLfloat)i, (GLfloat)histoGram_ / (GLfloat) iLargest * 128.0f);
glEnd();
bHistogram = GL_FALSE;
glDisable(GL_HISTOGRAM);
}
// Reset everyting to default
glMatrixMode(GL_COLOR);
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);
glDisable(GL_CONVOLUTION_2D);
glDisable(GL_COLOR_TABLE);
// Show our hard work...
glutSwapBuffers();
}
void ChangeSize(int w, int h)
{
// Prevent a divide by zero, when window is too short
// (you cant make a window of zero width).
if(h == 0)
h = 1;
glViewport(0, 0, w, h);
// Reset the coordinate system before modifying
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
// Set the clipping volume
gluOrtho2D(0.0f, (GLfloat) w, 0.0, (GLfloat) h);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
/////////////////////////////////////////////////////////////
// Main program entrypoint
int main(int argc, char* argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB | GL_DOUBLE);
glutInitWindowSize(600 ,600);
glutCreateWindow("OpenGL Imaging subset");
// Check for imaging subset, must be done after window
// is create or there won't be an OpenGL context to query
if(gltIsExtSupported("GL_ARB_imaging") == 0)
{
printf("Imaging subset not supported\r\n");
return 0;
}
glutReshapeFunc(ChangeSize);
glutDisplayFunc(RenderScene);
// Create the Menu and add choices
glutCreateMenu(ProcessMenu);
glutAddMenuEntry("Save Image",0);
glutAddMenuEntry("Raw Stretched Image",1);
glutAddMenuEntry("Increase Contrast",2);
glutAddMenuEntry("Invert Color", 3);
glutAddMenuEntry("Emboss Image", 4);
glutAddMenuEntry("Sharpen Image", 5);
glutAddMenuEntry("Histogram", 6);
glutAttachMenu(GLUT_RIGHT_BUTTON);
SetupRC(); // Do setup
glutMainLoop(); // Main program loop
ShutdownRC(); // Do shutdown
return 0;
}
===================================================================
Appreciate any comment and suggestion. Tks.
correct me if im wrong, but if its not declared it doesnt exist.
or like cpns said it somehow got "microed out".
dont forget some object get enabled by micros like assert, debug, wchar
ect....
you know those #ifdefined statements.
happy hunting
This is hard work! Where's the log!?
The compile log is on the tab labled "Compile Log", and the right mouse button
brings up the
copy menu.
OK, since you won't take advice, I have looked for you!
Here is the glext.h header that
defines GL_HISTOGRAM. You will see that it is not defined if
GL_ARB_imaging_DEPRECATED is defined.
wow
cpns you went above and beyond the call of duty. if your last post doesnt
solve the problem, maybe this clown is only playing.
The aim was to get people to understand how to solve their own problems.
i agree, thats why i give general answers. also because of the information
they provide, thats all i can do sometimes. when the programer posted the
source code, i felt it was his orignal code and not openGL header code. i dont
know openGL so i gave a general answer.
if they know what they are doing and understand whats going on, i believe even
a general hint could solve the problem.