SetPixelFormat does not accept 3 parameters, whoah?

This is a discussion on SetPixelFormat does not accept 3 parameters, whoah? within the Game Programming forums, part of the General Programming Boards category; I am in the process of trying to structure my tiling engine in such a way as there is a ...

  1. #1
    'AlHamdulillah
    Join Date
    Feb 2003
    Posts
    790

    SetPixelFormat does not accept 3 parameters, whoah?

    I am in the process of trying to structure my tiling engine in such a way as there is a base class which holds all of my window and opengl initiation functions and variables. Well, it was all going ok structurely wise(no compile errors, but i messed up on initiation so that a window doesnt appear) until i was getting to my pixelformat function, which for now, is pretty much a direct copy of GameTutorials one:

    Code:
    bool GLApp::SetPixelFormat()
    {
    	PIXELFORMATDESCRIPTOR pfd;
    
    	int pixelformat; 
     
        pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR);	
    
    pfd.nVersion = 1;
    	
        pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER; 
    
        pfd.dwLayerMask = PFD_MAIN_PLANE;
    		
        pfd.iPixelType = PFD_TYPE_RGBA;	
    
      pfd.cColorBits = screen_depth;						
        pfd.cDepthBits = screen_depth;						
        pfd.cAccumBits = 0;
    
        pfd.cStencilBits = 0;			 
    	
    
        if ( (pixelformat = ChoosePixelFormat(g_hdc, &pfd)) == FALSE ) 
        { 
            MessageBox(NULL, "ChoosePixelFormat failed", "Error", MB_OK); 
            return FALSE; 
        } 
     
        if (SetPixelFormat(g_hdc, pixelformat, &pfd) == FALSE) 
        { 
            MessageBox(NULL, "SetPixelFormat failed", "Error", MB_OK); 
            return FALSE; 
        } 
     
        return TRUE;		
    }
    well, here is the compiler build error:

    Code:
    C:\Program Files\DevStudio\MyProjects\OpenGL Base\GLApp.cpp
    (80) : error C2660: 'SetPixelFormat' : function does not take 3 
    parameters
    Now that is funny, as since i pretty much did a copy paste from one of my other programs, which worked, one would expect this to work. I have checked my dependencies, and I have included all GL related libraries except for GLUT, as well as included the proper header files. What could be going on? if it helps, my compiler is Visual C++ 5.0 prof. edition.

    thanks,

    EvBladerunnervE


    EDIT:: Sorry for the ugly code, i tryed formatting it as it was filling up two screens worth for me but didnt get it all the way right.
    Last edited by EvBladeRunnervE; 11-17-2003 at 08:21 PM.

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,674
    This will be best solved if you can zip and attach a project that will compile with these errors.

    gg

  3. #3
    Banned frenchfry164's Avatar
    Join Date
    Oct 2001
    Posts
    1,552
    That's one thing I hate about DX. It changes so much that sometimes you got to modify tutorial code just to get it to work. Try looking up in the documentation the parameters of the function for the version of DX you are using. I actually found out that a few functions weren't even documented correctly, and they left parameter out.

  4. #4
    30 Helens Agree neandrake's Avatar
    Join Date
    Jan 2002
    Posts
    640
    Originally posted by frenchfry164
    That's one thing I hate about DX. It changes so much that sometimes you got to modify tutorial code just to get it to work. Try looking up in the documentation the parameters of the function for the version of DX you are using. I actually found out that a few functions weren't even documented correctly, and they left parameter out.
    he's using OpenGL

    Check for any calls to the function, or the prototype of the function. That's about as much as I can offer.
    Environment: OS X, GCC / G++
    Codes: Java, C#, C/C++
    AOL IM: neandrake, Email: neandrake (at) gmail (dot) com

  5. #5
    Banned
    Join Date
    Jan 2003
    Posts
    1,708
    wtf, you BROKE OpenGL, sunnova...
    Here's my gl renderer creation code, which isn't copied from anywhere but for all intents and purposes might as well have been

    Code:
    	DEVICE_CONTEXT=GetDC(hWnd);
    	GLuint		PixelFormat;
    	PixelFormat=ChoosePixelFormat(DEVICE_CONTEXT,&pfd);	
    	SetPixelFormat(DEVICE_CONTEXT,PixelFormat,&pfd);
    	RENDERING_CONTEXT=wglCreateContext(DEVICE_CONTEXT);
    	wglMakeCurrent(DEVICE_CONTEXT,RENDERING_CONTEXT);
    It's gotta be yoru freaking compiler. What in the hell are you doing with vc 5 btw?
    Oh, and for the record, I'm still not talking to you, so don't bother IMing me. I'm still ........ED about the MIT thing because I never meant MIT, I meant *W* IT, which is near MIT, but you were being a little dingle $$$$ before I could explain the error (so don't bother pm ing me, because i'll give you the same response as last time).
    this is business stuff so ill help

    EDIT: go into your GL header files that you are *actually using*, THEN MAKE ABSOLUTELY SURE YOU HAVE A FUNCTION CALLED SETPIXELFORMAT THAT TAKES 3 PARAMETERS...you might *think* you have the latest GL stuff, but perhaps it's possible that you somehow have headers from an older GL implementaqtion (sorta unlikely because GL doesn't change as often as DX< but on the other hand you have a $$$$astically old version of visual studio. it might've came with its own GL stuff because it at least comes with windows gl functions. Im still looking through that small tidbit of code trying to find the problem).
    Last edited by Silvercord; 11-21-2003 at 04:38 PM.

  6. #6
    'AlHamdulillah
    Join Date
    Feb 2003
    Posts
    790
    My Setpixelformat does use 3 parameters. There is the thing, SetPixelFormat works perfectly in all of my other GL apps that I had made previously(and they still compile fine), everything is the same, including libraries and windows as well as gl header files. I will post code when i can actually get onto the internet with my development computer.

    To Silver:
    Silvercord, sorry about that, WIT makes sense, but when you said MIT twice in a row, i couldnt believe it was a typo, so I apologize. Good job man . But when I say "BS", then you say "if you dont believe me then i am going to block you"(was there a message in between that? my home internet was running at 9600bps do to local telco maintenance, so i had horrible packet loss that night), what do you expect me to do? That is like Me saying I have invented a new form of space partitioning that is 1000% more efficient than BSP, you would of said the same thing.

  7. #7
    Banned
    Join Date
    Jan 2003
    Posts
    1,708
    i never said MIT twice. I just looked at my history, I only made one typo. i was initially offended because I thought you were referring to WIT when you said those sarcastic $$$$$$$ remarks, and WIT isn't hard to get into. but then I realized why you said it, but i'm still blocking you because you are the most annoying person ever, and you can't ever get anything done even when i try to help you (so again, the pms will be ignored)

    You can read this thread to see what major:
    Electromechanical Engineering
    I was bragging not because it's a hard school, but because they readily accepted me into the engineering program when they don't usually accept this early. and now i have to stop because this is off topic, but this is the only time you'll hear from me because im not letting u contact me any other way.

  8. #8
    'AlHamdulillah
    Join Date
    Feb 2003
    Posts
    790
    attached is my project
    Attached Files Attached Files

  9. #9
    Banned
    Join Date
    Jan 2003
    Posts
    1,708
    That's your own SetPixelFormat function that YOU made, that isn't the one that is used by windows. Take it out of the class. Took me about two seconds to find when I saw that the one trying to be called returned bool and not BOOL (which is actualy an unsigned 32bit int I think, as put in windef.h)

    next time, don't do that

  10. #10
    'AlHamdulillah
    Join Date
    Feb 2003
    Posts
    790
    ah, this is what happens to people who stupidly name functions after actual system library functions, and are too blind to see a glaring mistake(actually, its more like mentally undercasing read words, and therefore thinking my function was setpixelformat, instead of the same name).

    The question is, even though it is fixed, is there anyway around this problem, as in, could I have a function in my class named the same as another function(in this case, SetPixelFormat) without it hurting me(yes I know it would be in general pretty ugly, but still).

  11. #11
    carry on JaWiB's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    1,972
    The question is, even though it is fixed, is there anyway around this problem, as in, could I have a function in my class named the same as another function(in this case, SetPixelFormat) without it hurting me(yes I know it would be in general pretty ugly, but still).
    I thought that was the whole idea of namespaces :P

    Although I don't know if you are using C or C++, since I haven't looked at your code...
    "Think not but that I know these things; or think
    I know them not: not therefore am I short
    Of knowing what I ought."
    -John Milton, Paradise Regained (1671)

    "Work hard and it might happen."
    -XSquared

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 6
    Last Post: 07-21-2008, 06:04 AM
  2. function with variable number of parameters
    By mikahell in forum C++ Programming
    Replies: 3
    Last Post: 07-23-2006, 03:35 PM
  3. async Client/Server app, accept() stalls?
    By JaWiB in forum Networking/Device Communication
    Replies: 14
    Last Post: 01-31-2005, 04:59 PM
  4. Additional parameters for operator delete
    By darksaidin in forum C++ Programming
    Replies: 0
    Last Post: 09-21-2003, 11:46 AM
  5. Passing parameters from VB to C++ through ActiveX DLL
    By torbjorn in forum Windows Programming
    Replies: 0
    Last Post: 12-10-2002, 02:13 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21