Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

145 Neutral

About neverland

  • Rank
  1. Quote:Original post by zedzeek ive never used glew but i think u need to call a function before u can use it to setup the extension points (ie just including the header aint enuf) eg init_glew(); glBlendEquation is part of gl1.2 i think + gffx supports it in hardware also GL_FUNC_ADD is just normal blending use GL_LOGIC_OP for some different blending methods ( coincidently i was playing around with today) I couldn't find glBlendEquation ni gl.h, so I googled. And I found the GLEW library which includes glBlendEquation, but I don't know how to use it. If I don't use GLEW library, is there any other method could let me use the extensions in OpenGL 1.2 or later?
  2. Quote:Original post by Skeleton_V@T glBlendEquation () is not part of the core OpenGL functions. You should check for GL_ARB_imaging extension before using it. I guess your hardware doesn't support that extension. My graphics card is Geforce FX5700 which dose support GL_ARB_imaging extension. And I've updated OpenGL driver to 2.0. Any other reason?
  3. Hello All I am reading "The Red Book" 4th edition. In chapter 6 the book introduces a blend function called glBlendEquation. I wrote a program using it. The code was successfully compiled, but an error occured when I ran it. code: #include <Windows.h> #include <gl/glew.h> #include <gl/glut.h> void init() { glClearColor(1.0, 1.0, 0.0, 0.0); glBlendFunc(GL_ONE, GL_ONE); glEnable(GL_BLEND); } void display() { glClear(GL_COLOR_BUFFER_BIT); glColor3f(0.0, 0.0, 1.0); glBlendEquation(GL_FUNC_ADD); // this line causes a run-time error! glRectf(-0.5, -0.5, 0.5, 0.5); glFlush(); } int main(int argc, char** argv) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB); glutInitWindowPosition(200, 100); glutInitWindowSize(400, 400); glutCreateWindow("Blend Equation"); init(); glutDisplayFunc(display); glutMainLoop(); } anything wrong?
  4. Nvidia's Cg, Microsoft's HLSL and OpenGL's GLSL are all high-level shader language. What are the differences and relations among the three? Which one is most widely used in games development?
  5. I was asked to write a function that do some calculation and return a real number as the result. Is there any library function in C/C++ that make a real number accurate up to n decimal places?
  6. std::string str; cout << sizeof(str) << endl; I'm reading a book said that std::string object size is 8. But on gcc the output is 4, on VC the output is 28. I am confused.
  7. neverland

    include "gl.h" error

    Thanks SiCrane! It works.
  8. consider the following simple code from "OpenGL Programming Guide": #include <gl/gl.h> // if i comment out this line, it will compile #include <gl/glut.h> void init() { glClearColor(0.0, 0.0, 0.0, 0.0); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0); } void display() { glClear(GL_COLOR_BUFFER_BIT); glColor3f(1.0, 1.0, 1.0); glBegin(GL_POLYGON); glVertex3f(0.25, 0.25, 0.0); glVertex3f(0.75, 0.25, 0.0); glVertex3f(0.75, 0.75, 0.0); glVertex3f(0.25, 0.75, 0.0); glEnd(); glFlush(); } int main(int argc, char** argv) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB); glutInitWindowPosition(100, 100); glutInitWindowSize(250, 250); glutCreateWindow("Hello GLUT"); init(); glutDisplayFunc(display); glutMainLoop(); } There are hundreds of errors when I compile the code. But if I comment out the first line, it will compile all right. The code is exactly from the book "OpenGL Programming Guide". Anything wrong?
  9. When an exception thrown, all the objects successfully constructed in the try block will be destroyed. But consider the following code: #include <iostream> using namespace std; class A { public: A() throw(int) { ID = count++; cout << "object ID:" << ID << " generated." << endl; if (3 == ID) throw 0; } ~A() { cout << "object ID:" << ID << " destroyed." << endl; } private: static int count; int ID; }; int A::count = 0; int main() { try { A *a1 = new A; A *a2 = new A; A *a3 = new A[3]; delete a1; delete a2; delete[] a3; cout << "Exit Now" << endl; } catch(int) { cout << "exception caught" << endl; } } The output is: object ID:0 generated. object ID:1 generated. object ID:2 generated. object ID:3 generated. object ID:2 destroyed. exception caught The first element in the a3 array is successfully destroyed but a1 and a2 not. Why? If I change the try block to the following code: try { A a1; A a2; A *a3 = new A[3]; delete[] a3; cout << "Exit Now" << endl; } The output is: object ID:0 generated. object ID:1 generated. object ID:2 generated. object ID:3 generated. object ID:2 destroyed. object ID:1 destroyed. object ID:0 destroyed. exception caught a1 and a2 are successfully destroyed. I am a little bit confused.
  10. Hello I got the book "Tricks of the 3D Game Programming Gurus - Advanced 3D Graphics and Rasterization". All the book talks about is to built your own 3D library. Hradly any 3D API used in this book, and just like the author said in the book: this is a math math world. And the author also said that "if you understand 3D graphics principles, you can learn 3D APIs(e.g. Direct3D and OpenGL) in couples of week". That sounds so cool. But the math is a headache for me. Is "3D graphics principles" essential for a 3D game programmer? Need I learn 3D graphics principles if I want to be a 3D game programmer? Any advice welcome Thanks in advance!
  11. 64bit CPUs have come into the market for months. And 64bit OSs are coming soon. What does the "64bit" means ? Does it have the same meaning of CPU and OS ? And what 64bit will bring for programmers ? I heared someone said that "from DOS to Win32" was a great calamity for programmers. I am wondering if there will be another calamity for programmers when 64bit really comes.
  12. I'm using VC2005 Beta2 and gcc 3.3.3 Neither of them compile
  13. consider the following code:class A { public: A(int i) : i(i) { } private: int i; }; int main() { A a; return 0; } The code cannot compile because there is no default constructor of class A, but the book says that "the compiler will generate the default constructor if you don't define it" What's wrong ?
  14. If I use just a STL container such as std::vector in my program. Is "using std::vector;" better than "using namespace std" ? Does "using namespace std" cost ?
  15. consider the following code:class X { }; X f() { return X(); } void g1(X& x) {} void g2(const X& x) {} int main() { g1(f()); g2(f()); return 0; } I know that reference to a local object is bad. But function g2() is successfully compiled while g1() not. Why ?
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!