Homunculi

Members
  • Content count

    17
  • Joined

  • Last visited

Community Reputation

133 Neutral

About Homunculi

  • Rank
    Member
  1. OpenGL starting opengl 3/4 issues

    the program glewinfo that came with glew tells me what version of opengl my current graphics card supports. glProgramUniform is a opengl 4 function it seems.
  2. My program works on my laptop but it doesn't work on my friends laptop. The graphics card which I use is: GeForce 8600M GT/PCI/SSE2 from NVIDIA Corporation The graphics card which he uses is: ATI Mobility Radeon HD 3650 from ATI Technologies The error outputted to stdout is rather random but it's always along the lines of this: [quote] Shader Failed to Compile Vertex shader failed to compile with the following errors: ERROR: 0:8: error(#132) Syntax error: 'E968' parse error ERROR: error(#273) 1 compilation errors. No code generated Shader Failed to Compile Fragment shader failed to compile with the following errors: ERROR: 0:7: error(#132) Syntax error: 'ix' parse error ERROR: error(#273) 1 compilation errors. No code generated [/quote] I tried several different ways of doing the fragment shader including specifying different versions of glsl useing #version and it seems that no matter what I get to work on mine it doesn't work on his. The vertex shader seems to work on his though because it's outputting the polygons just they are all white. Right now the fragment shader is only this and it still doesn't work on his laptop but it works on mine: [code] uniform vec4 color; void main() { gl_FragColor = color; } [/code] Also, it seems to be very picky on my side on whether it will compile or not... like if I were to have something like: gl_Position = gl_ModelViewProjectionMatrix*gl_Vertex; then it would work but if I had gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; then it won't work. The spaces beside the '*' mess it up. Is this really normal?
  3. OpenGL and 3D Math

    Well good news. I do know a bit of linear algebra already. I am familiar with linear transformations, basis, dot product, matrix multiplication, transpose, determinants, inverse matrices etc. There is a lot of terminology and the whole opengl graphics pipeline that I need to get sorted out. I'll say a few things and if someone can correct me where I am wrong and I'll ask some questions and what not. Let me see if I have this right so far: The opengl projection matrix is about defining the viewing frustum and perspective or orthopraphic projection... so... are the clipped coordinates the coordinates that lay in the viewing frustum? Which is definied by the projection matrix? That would explain why to get the clipped coordinate one has to multiply the projection matrix and the eye coordinate. The modelview matrix is a combinaton of the model and the view matrix. It is used for doing transformations to a given vertex (scale, rotate and position). OpenGL doesn't use a "camera" or it can be thought of as the camera always being at (0,0,0) looking down the -Z axis. In order to change one's view, they need to transform all the objects positions so it's as if the world is moving around the "camera" not the "camera" moving around the world. songho is the best website I have found for the formulation of the projection matrix and modelview matrix. I still want to read it a bit more before I continue. What I understand I need to do is create the projection matrix and the modelview matrix. I can pass these into my vertex shader which I can then do matrix multiplication on them and my given vertex to get clipped coordinates. These coordinates will be passed down the pipeline eventually turned into window coordinates. The rasterization comes next in the pipeline right? The rasterization is the creation of the pixels to be rendered based on the vertices given if I understand correctly. This is where fragment shaders are used to control how the pixels are formed? Also known as "pixel shader"? Btw, khan academy is amazing =)
  4. I have read several sources saying along the lines "this has been explained at many other places already so I won't bother with it" and then they continue to explain what every place explains. Anyways there are a few things I would like to get a better understanding of and that's the opengl transformation matrices and how they are derived. I have found sources where they kinda explain it but they often skip quite a few details. Another subject I want to look into is quaternions. I have searched google for some of these already and I have found some places but none that really jump out at me as a [b]good[/b] source for learning the subject in a decent amount of detail. So any references would be awesome.
  5. OpenGL render vbo not working

    Ok, well I have been placing glGetError around my code and doing a bit of debugging. I have narrowed it down a bit. The error I am getting is "GL_INVALID_ENUM" and I you were onto something with the double buffer perhaps... the spot where I get the error is on the call to glEnable(GL_DOUBLEBUFFER); I commented it out because it should be doublebuffered anyways since on SDL_SetVideoMode() I put the flag SDL_GL_DOUBLEBUFFER I no longer get a gl error at any point in my code that I can get with glGetError() But I am still having the same problem with it making my screen blink and not rendering my triangle. EDIT: Ok, so I just tested my shaders using fixed pipeline functions (glVertex3f() etc). The shaders do work fine. It just doesn't work when trying to render the VBO way >.< EDIT2: Ok, I fixed the issue last night. It was my call to glDrawElements that was incorrect. I was passing in the address of the array that held the indices when I should have really been passing BUFFER_OFFSET(0)
  6. OpenGL render vbo not working

    I am not using GLUT I am using SDL to create an opengl context. I have SDL_GL_DOUBLEBUFFER enabled so that isn't the issue. I even put glEnable(GL_DOUBLEBUFFER) as well. I changed &triangle[0].x to just triangle as suggested. I am fully aware of what sizeof() does. Anyways. After making the recommended changes it still doesn't work.
  7. I am new to opengl. I setup a set of classes to manage shaders. I am now trying to debug it and I want to stick to opengl 3.3+. The following is the code I have written to setup a vbo for rendering a triangle. [code] Vertex triangle[3]; triangle[0].x = 0.0f; triangle[0].y = 0.0f; triangle[0].z = 0.0f; triangle[0].nx = 0.0f; triangle[0].ny = 0.0f; triangle[0].nz = 1.0f; triangle[0].s0 = 0.0f; triangle[0].s1 = 0.0f; triangle[1].x = 1.0f; triangle[1].y = 0.0f; triangle[1].z = 0.0f; triangle[1].nx = 0.0f; triangle[1].ny = 0.0f; triangle[1].nz = 1.0f; triangle[1].s0 = 1.0f; triangle[1].s1 = 0.0f; triangle[2].x = 0.0f; triangle[2].y = 1.0f; triangle[2].z = 0.0f; triangle[2].nx = 0.0f; triangle[2].ny = 0.0f; triangle[2].nz = 1.0f; triangle[2].s0 = 0.0f; triangle[2].s1 = 1.0f; glGenBuffers(1,&tri_id); glBindBuffer(GL_ARRAY_BUFFER,tri_id); glBufferData(GL_ARRAY_BUFFER, sizeof(Vertex)*3,&triangle[0].x,GL_STATIC_DRAW); glGenBuffers(1,&ind_id); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,ind_id); glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(unsigned short)*3,indices,GL_STATIC_DRAW); glEnableVertexAttribArray(0); glVertexAttribPointer(0,3,GL_FLOAT,GL_FALSE,sizeof(Vertex),(char*)(0)); glEnableVertexAttribArray(1); glVertexAttribPointer(1,3,GL_FLOAT,GL_FALSE,sizeof(Vertex),(char*)(12)); glEnableVertexAttribArray(2); glVertexAttribPointer(2,2,GL_FLOAT,GL_FALSE,sizeof(Vertex),(char*)(24)); [/code] I then call this function in my main loop of the program: [code] glClearColor(0.0f,0.0f,0.0f,1.0f); glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_SHORT, indices); [/code] The shaders which I am using are just a basic fragment and vertex shader. I have checked and they have been compiled and loaded succesfully. What happens is the screen blinks. The entire screen... rapidly... when running my program. Edit: I just noticed the triangle 0's for all verts thing and changed it... I also noticed the double bind buffer and removed that -
  8. msys glew mingw build

    Thanks I got it to work. That is what the problem was. I had glewInit() before everything else. Once I put it after SDL_Init() and SDL_SetVideoMode() the code compiles. The calling order was all messed up anyways.
  9. Yesterday I made a topic about linking issues with mingw. I resolved those and was able to make some programs using opengl 2.0 and SDL-1.2.15 with mingw. I was to be using opengl 3 standard so I decided to use glew-1.7.0. I was getting linking issues and then I realized I was making the same mistake again using libraries built for visual studio. So I downloaded glew-1.7.0.zip which had a makefile with it. I got MSYS ran it and went to the glew folder and ran [code] make make install [/code] This is what MSYS outputted: [code] Light@LIGHT-PC /c/Users/Light/Programming/glew-1.7.0 $ make gcc -DGLEW_NO_GLU -O2 -Wall -W -Iinclude -DGLEW_BUILD -o src/glew.o -c src/glew .c gcc -shared -Wl,-soname,libglew32.dll -Wl,--out-implib,lib/libglew32.dll.a -o lib/glew32.dll src/glew.o -L/mingw/lib -lglu32 -lopengl32 -lgdi32 -luser32 -lke rnel32 Creating library file: lib/libglew32.dll.a ar cr lib/libglew32.a src/glew.o sed \ -e "s|@prefix@|/usr|g" \ -e "s|@libdir@|/usr/lib|g" \ -e "s|@exec_prefix@|/usr/bin|g" \ -e "s|@includedir@|/usr/include/GL|g" \ -e "s|@version@|1.7.0|g" \ -e "s|@cflags@||g" \ -e "s|@libname@|GLEW|g" \ < glew.pc.in > glew.pc gcc -DGLEW_NO_GLU -DGLEW_MX -O2 -Wall -W -Iinclude -DGLEW_BUILD -o src/glew.mx. o -c src/glew.c gcc -shared -Wl,-soname,libglew32mx.dll -Wl,--out-implib,lib/libglew32mx.dll.a -o lib/glew32mx.dll src/glew.mx.o -L/mingw/lib -lglu32 -lopengl32 -lgdi32 -luser 32 -lkernel32 Creating library file: lib/libglew32mx.dll.a ar cr lib/libglew32mx.a src/glew.mx.o sed \ -e "s|@prefix@|/usr|g" \ -e "s|@libdir@|/usr/lib|g" \ -e "s|@exec_prefix@|/usr/bin|g" \ -e "s|@includedir@|/usr/include/GL|g" \ -e "s|@version@|1.7.0|g" \ -e "s|@cflags@|-DGLEW_MX|g" \ -e "s|@libname@|GLEWmx|g" \ < glew.pc.in > glewmx.pc gcc -c -O2 -Wall -W -Iinclude -o src/glewinfo.o src/glewinfo.c gcc -O2 -Wall -W -Iinclude -o bin/glewinfo.exe src/glewinfo.o -Llib -lglew32 - L/mingw/lib -lglu32 -lopengl32 -lgdi32 -luser32 -lkernel32 gcc -c -O2 -Wall -W -Iinclude -o src/visualinfo.o src/visualinfo.c gcc -O2 -Wall -W -Iinclude -o bin/visualinfo.exe src/visualinfo.o -Llib -lglew 32 -L/mingw/lib -lglu32 -lopengl32 -lgdi32 -luser32 -lkernel32 Light@LIGHT-PC /c/Users/Light/Programming/glew-1.7.0 $ make install install -d -m 0755 /usr/include/GL install -m 0644 include/GL/wglew.h /usr/include/GL/ install -m 0644 include/GL/glew.h /usr/include/GL/ install -m 0644 include/GL/glxew.h /usr/include/GL/ install -d -m 0755 /usr/lib install -d -m 0755 /usr/bin strip -x lib/glew32.dll install -m 0755 lib/glew32.dll /usr/bin/ install -m 0644 lib/libglew32.dll.a /usr/lib/ strip -x lib/libglew32.a install -m 0644 lib/libglew32.a /usr/lib/ install -d -m 0755 /usr/lib install -d -m 0755 /usr/lib/pkgconfig install -m 0644 glew.pc /usr/lib/pkgconfig/ [/code] I checked the folder .../glew-1.7.0/lib and it now had mingw type libraries to link to. Tried compiling my code with the following command: [code] g++ -mwindows main.cpp -o arcanacaelestia.exe -IC:\Users\Light\Programming\SDL-1.2.15\include -IC:\Users\Light\Programming\glew-1.7.0\include -LC:\Users\Light\Programming\SDL-1.2.15\lib -LC:\Users\Light\Programming\glew-1.7.0\lib -lmingw32 -lglew32 -lSDLmain -lSDL -lopengl32 [/code] Everything seemed to work. No errors. I started building a set of classes to manage shaders. It compiles perfectly fine. However I am getting a segmentation fault that I believe could be related to all of this. This is what I got from gdb about the segmentation fault: [code] Program received signal SIGSEGV, Segmentation fault. 0x00000000 in ?? () (gdb) backtrace #0 0x00000000 in ?? () #1 0x004013a0 in _fu0____glewCreateShader () #2 0x0040153f in SDL_main () #3 0x00402659 in console_main (argc=1, argv=0x8615b0) at ./src/main/win32/SDL_win32_main.c:315 #4 0x0040271b in WinMain@16 (hInst=0x400000, hPrev=0x0, szCmdLine=0x66377f "", sw=10) at ./src/main/win32/SDL_win32_main.c:398 #5 0x00401db2 in main ( argc=<error reading variable: Cannot access memory at address 0x0>, argv=<error reading variable: Cannot access memory at address 0x4>, __p__environ=<error reading variable: Cannot access memory at address 0x8>) at ../mingw/main.c:73 [/code] I tried commenting out some code to see if it would get rid of the seg-fault and it did. It seg faults on [code] unsigned int shdhandle = glCreateShader(GL_VERTEX_SHADER); [/code] I bet it will segfault on any of those type of OpenGL commands. Anyone have an idea on what I should do?
  10. linking problem with mingw

    It turns out I have a runtime error which I think is related to all of this because I was able to get the same code to run in MSVC. This is what I am getting: [code] Program received signal SIGSEGV, Segmentation fault. 0x764443f9 in strlen () from C:\Windows\syswow64\msvcrt.dll (gdb) backtrace #0 0x764443f9 in strlen () from C:\Windows\syswow64\msvcrt.dll #1 0x6810a5da in SDL_strdup () from C:\Users\Light\Programming\ArcanaCaelestia\SDL.dll #2 0x68126bbd in SDL_WM_SetCaption () from C:\Users\Light\Programming\ArcanaCaelestia\SDL.dll #3 0x004015f6 in SDL_main () #4 0x00402709 in console_main (argc=1, argv=0x9d15b0) at ./src/main/win32/SDL_win32_main.c:315 #5 0x004027cb in WinMain@16 (hInst=0x400000, hPrev=0x0, szCmdLine=0x74377f "", sw=10) at ./src/main/win32/SDL_win32_main.c:398 #6 0x00401e66 in main ( argc=<error reading variable: Cannot access memory at address 0x10>, argv=<error reading variable: Cannot access memory at address 0x14>, __p__environ=<error reading variable: Cannot access memory at address 0x18>) at ../mingw/main.c:73 [/code]
  11. linking problem with mingw

    I had a ton of different compilers and versions of the same libraries. I came to the conclusion that I'll just get rid of them all and redownload MinGW and the appropriate libraries that I need. Turns out I was linking to Visual Studio version of the SDL library with mingw... Also, it is important to put -lSDLmain before -lSDL or else I get undefined references as well. Anyways it seems to work now with the following command: [code] g++ main.cpp -o arcanacaelestia.exe -IC:\Users\Light\Programming\SDL-1.2.15\include -IC:\Users\Light\Programming\glew-1.7.0\include\GL -LC:\Users\Light\Programming\SDL-1.2.15\lib -LC:\Users\Light\Programming\glew-1.7.0\lib -lmingw32 -lglew32 -lSDLmain -lSDL -lopengl32 [/code]
  12. I am trying to link SDL, GL and GLew with mingw. This is my compile command: [code] g++ -mwindows main.cpp -o arcanacaelestia.exe -IC:\Users\Light\Programming\SDL-1.2.15\include -IC:\Users\Light\Programming\glew-1.7.0\include -LC:\Users\Light\Programming\SDL-1.2.15\lib\x86 -LC:\Users\Light\Programming\glew-1.7.0\lib -lmingw32 -lglew32 -lSDL -lSDLmain -lopengl32 [/code] and I am having problems with SDLmain. These are the errors I get: [code] C:\Users\Light\Programming\SDL-1.2.15\lib\x86/SDLmain.lib(./Release/SDL_win32_ma in.obj): (.text[_main]+0x0): multiple definition of `main' c:/mingw/bin/../lib/gcc/mingw32/4.6.1/../../../libmingw32.a(main.o):C:\MinGW\msy s\1.0\src\mingwrt/../mingw/main.c:24: first defined here Warning: .drectve `/manifestdependency:"type='win32' name='Microsoft.VC90.CRT' v ersion='9.0.21022.8' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3 b'" /DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized C:\Users\Light\Programming\SDL-1.2.15\lib\x86/SDLmain.lib(./Release/SDL_win32_ma in.obj): (.text[_main]+0x7): undefined reference to `__security_cookie' C:\Users\Light\Programming\SDL-1.2.15\lib\x86/SDLmain.lib(./Release/SDL_win32_ma in.obj): (.text[_main]+0x99): undefined reference to `_alloca_probe_16' C:\Users\Light\Programming\SDL-1.2.15\lib\x86/SDLmain.lib(./Release/SDL_win32_ma in.obj): (.text[_main]+0xc6): undefined reference to `SDL_strlcpy' C:\Users\Light\Programming\SDL-1.2.15\lib\x86/SDLmain.lib(./Release/SDL_win32_ma in.obj): (.text[_main]+0xe5): undefined reference to `SDL_GetError' C:\Users\Light\Programming\SDL-1.2.15\lib\x86/SDLmain.lib(./Release/SDL_win32_ma in.obj): (.text[_main]+0x11f): undefined reference to `SDL_SetModuleHandle' C:\Users\Light\Programming\SDL-1.2.15\lib\x86/SDLmain.lib(./Release/SDL_win32_ma in.obj): (.text[_main]+0x14e): undefined reference to `@__security_check_cookie@4 ' C:\Users\Light\Programming\SDL-1.2.15\lib\x86/SDLmain.lib(./Release/SDL_win32_ma in.obj): (.text[_WinMain@16]+0x7): undefined reference to `__security_cookie' C:\Users\Light\Programming\SDL-1.2.15\lib\x86/SDLmain.lib(./Release/SDL_win32_ma in.obj): (.text[_WinMain@16]+0x34): undefined reference to `SDL_getenv' C:\Users\Light\Programming\SDL-1.2.15\lib\x86/SDLmain.lib(./Release/SDL_win32_ma in.obj): (.text[_WinMain@16]+0x80): undefined reference to `_alloca_probe_16' C:\Users\Light\Programming\SDL-1.2.15\lib\x86/SDLmain.lib(./Release/SDL_win32_ma in.obj): (.text[_WinMain@16]+0xa7): undefined reference to `SDL_strlcpy' C:\Users\Light\Programming\SDL-1.2.15\lib\x86/SDLmain.lib(./Release/SDL_win32_ma in.obj): (.text[_WinMain@16]+0xca): undefined reference to `_alloca_probe_16' C:\Users\Light\Programming\SDL-1.2.15\lib\x86/SDLmain.lib(./Release/SDL_win32_ma in.obj): (.text[_WinMain@16]+0x10f): undefined reference to `@__security_check_co okie@4' C:\Users\Light\Programming\SDL-1.2.15\lib\x86/SDLmain.lib(./Release/SDL_win32_ma in.obj).text[_redirect_output]+0xa): undefined reference to `__security_cookie ' C:\Users\Light\Programming\SDL-1.2.15\lib\x86/SDLmain.lib(./Release/SDL_win32_ma in.obj).text[_redirect_output]+0x6a): undefined reference to `SDL_strlcpy' C:\Users\Light\Programming\SDL-1.2.15\lib\x86/SDLmain.lib(./Release/SDL_win32_ma in.obj).text[_redirect_output]+0x81): undefined reference to `SDL_strlcat' C:\Users\Light\Programming\SDL-1.2.15\lib\x86/SDLmain.lib(./Release/SDL_win32_ma in.obj).text[_redirect_output]+0xf1): undefined reference to `SDL_strlcpy' C:\Users\Light\Programming\SDL-1.2.15\lib\x86/SDLmain.lib(./Release/SDL_win32_ma in.obj).text[_redirect_output]+0x108): undefined reference to `SDL_strlcat' C:\Users\Light\Programming\SDL-1.2.15\lib\x86/SDLmain.lib(./Release/SDL_win32_ma in.obj): (.text[_redirect_output]+0x1a9): undefined reference to `@__security_che ck_cookie@4' [/code] I've tried with and without the -mwindows option. SDL and SDLmain are in the path C:\Users\Light\Programming\SDL-1.2.15\lib\x86
  13. My question is at the end of this post I will start out with a small explanation of what I am doing: Ok so I made some models in Blender 2.61 and now I am going to write a python script to export these files the way that I want them. For now I am working mainly on terrain. I am considering having two file formats. One for non-animating objects and another for animateable objects like monsters, players and npcs. These will all be exported in a binary format. Right now I am only worrying about exporting objects that won't animate. This is the information regarding these models that I think I need to render them: 1) Vertex positions 2) UV texture mapping 3) The actual textures (image files) 4) ... Now this is where I start to get some questions. Blender allows me to add shaders, do normal mapping and so on inside it. I will use my own shaders and not the ones in Blender. But to do normal mapping I will need to make sure to export the normal maps along with the model as well right? Then in my engine I will need to do the actual normal mapping process? I'm thinking of creating some header information for my file... like first 30-50 bytes or whatever I don't know at the moment will tell the engine how to process the file. Like whether it uses a normal map and so on. I don't imagine using normal mapping for every single thing. What is the performace costs of using normal maps? Sure it's better than using a buttload of poly's to gain certain detail (such as on walls etc) but at what point does it level out? I think this is how it would pretty much go for anything even besides normal mapping. I am just making all of this up I am not even sure if it's the effective way to go about it. It makes sense to me though. Any advice, tips and references would be much appreciated Thanks.
  14. I'm learning how to load and animate characters in OpenGL. I've created some models in blender and I can export then as any one of the following: Collada (.dae) Stanford (.ply) Stl (.stl) 3D Studio Max (.3ds) Autodesk FBX (.fbx) Wavefront (.obj) X3D Extensible 3D (.x3d) I was wondering what one in general would be best for game development. It seems that it is popular to create your own format for your own purposes. I haven't really gone about figuring that out. Right now I'm trying to learn how to load and get a walk cycle working. I've read that: .obj is only good for loading static models and even then it can be very large. .3ds is messy and difficult to work with and isn't really good for getting animations The other ones I haven't really heard much about besides .dae holds stuff in xml format. Honestly at the moment .fbx is sounding the most appealing to me. I'm new to this so I'm not sure which I should go with.
  15. Im on lesson 06 and cant figure out how to use the glaux replacement code, can someone please modify the following code to make a cube like they did using texture mapping with the glaux replacement code. I tried everything, and Ive been everywheres asking for help but not getting any, can someone please do this.. #define WIN32_LEAN_AND_MEAN #include <windows.h> #include <gl/gl.h> void EnableGL(HWND hwnd,HDC* hDC,HGLRC* hRC) { PIXELFORMATDESCRIPTOR pfd; int format; *hDC = GetDC(hwnd); ZeroMemory(&pfd,sizeof(&pfd)); pfd.nSize = sizeof(pfd); pfd.iPixelType = PFD_TYPE_RGBA; pfd.cColorBits = 32; pfd.cDepthBits = 16; pfd.nVersion = 1; pfd.dwFlags = PFD_DRAW_TO_WINDOW|PFD_SUPPORT_OPENGL|PFD_DOUBLEBUFFER; format = ChoosePixelFormat(*hDC,&pfd); SetPixelFormat(*hDC,format,&pfd); *hRC = wglCreateContext(*hDC); wglMakeCurrent(*hDC,*hRC); } void DisableGL(HWND hwnd,HDC hDC,HGLRC hRC) { wglDeleteContext(hRC); wglMakeCurrent(NULL,NULL); ReleaseDC(hwnd,hDC); } LRESULT CALLBACK WndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam) { switch(msg) { case WM_CLOSE: DestroyWindow(hwnd); break; case WM_DESTROY: PostQuitMessage(0); break; default: return DefWindowProc(hwnd,msg,wParam,lParam); } } int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR nCmdLine, int nCmdShow) { HGLRC hRC; HDC hDC; HWND hwnd; WNDCLASSEX wc; MSG Message; bool quit = false; float theta = 1.0f; wc.cbSize = sizeof(WNDCLASSEX); wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.style = 0; wc.lpfnWndProc = WndProc; wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); wc.lpszMenuName = NULL; wc.lpszClassName = "MAIN"; wc.hIcon = LoadIcon(NULL,IDI_APPLICATION); wc.hIconSm = LoadIcon(NULL,IDI_APPLICATION); wc.hCursor = LoadCursor(NULL,IDC_ARROW); wc.hInstance = hInstance; RegisterClassEx(&wc); hwnd = CreateWindowEx(0, "MAIN", "_-+OpenGL+-_", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT,CW_USEDEFAULT, 800,600, NULL, NULL, hInstance, NULL); EnableGL(hwnd,&hDC,&hRC); ShowWindow(hwnd,nCmdShow); while(quit == false) { if(PeekMessage(&Message,NULL,0,0,PM_REMOVE)) { TranslateMessage(&Message); DispatchMessage (&Message); if(Message.message == WM_QUIT){ quit = true; } } else { glEnable(GL_TEXTURE_2D); glClearColor(0.0f,0.0f,0.0f,0.0f); glClear(GL_COLOR_BUFFER_BIT); glPushMatrix(); glRotatef(theta,1.0f,1.0f,1.0f); glBegin(GL_QUADS); glColor3f(1.0f,0.0f,0.0f); glVertex3f(-0.5,-0.5,0.0); glVertex3f(-0.5,0.5,0.0); glVertex3f(0.5,0.5,0.0); glVertex3f(0.5,-0.5,0.0); glColor3f(0.0f,1.0f,0.0f); glVertex3f(0.5,-0.5,-1.0); glVertex3f(0.5,-0.5,0.0); glVertex3f(0.5,0.5,0.0); glVertex3f(0.5,0.5,-1.0); glColor3f(0.0f,0.0f,1.0f); glVertex3f(-0.5,-0.5,0.0); glVertex3f(-0.5,-0.5,-1.0); glVertex3f(-0.5,0.5,-1.0); glVertex3f(-0.5,0.5,0.0); glColor3f(1.0f,0.0f,1.0f); glVertex3f(-0.5,-0.5,-1.0); glVertex3f(-0.5,0.5,-1.0); glVertex3f(0.5,0.5,-1.0); glVertex3f(0.5,-0.5,-1.0); glColor3f(0.0f,1.0f,1.0f); glVertex3f(0.5,0.5,0.0); glVertex3f(-0.5,0.5,0.0); glVertex3f(-0.5,0.5,-1.0); glVertex3f(0.5,0.5,-1.0); glColor3f(0.5f,0.2f,0.7f); glVertex3f(-0.5,-0.5,0.0); glVertex3f(-0.5,-0.5,-1.0); glVertex3f(0.5,-0.5,-1.0); glVertex3f(0.5,-0.5,0.0); glEnd(); glPopMatrix(); SwapBuffers(hDC); theta+=1.0f; } } DisableGL(hwnd,hDC,hRC); return Message.wParam; } someone please help me lol.