Advertisement Jump to content
  • Advertisement

McZ

Member
  • Content Count

    376
  • Joined

  • Last visited

Community Reputation

139 Neutral

About McZ

  • Rank
    Member
  1. I Can't get the "default" looks of my groupbox Groupbox that looks like this: http://stackoverflow.com/questions/214553/how-do-you-place-sub-controls-inside-a-group-box My code is the same for creating the groupbox but all I get is the title text no thin border. And I have a generic manifest file so I can use CommonControls v6.0, and that works because I can create a progressbar with PBS_MARQUEE style that AFAIK is only supported in Common controls v6.0 (or later I assume) I'm compiling with mingw32 using Code Blocks IDE. EDIT: I get the border if I disable windows XP's default theme and use classic theme. [Edited by - McZ on October 16, 2009 1:56:09 AM]
  2. I want to access the iterator of my list like this template <class T> class Data { std::vector<T> m_List; public: typedef std::vector<T> List; typedef List::iterator iterator; iterator begin() { return m_List.begin(); } iterator end() { return m_List.end(); } }; but I can't get it to work. get this error: Data.h|31|error: type `std::vector<T, std::allocator<_CharT> >' is not derived from type `Data<T>'| Data.h|31|error: ISO C++ forbids declaration of `iterator' with no type| using Code Blocks and mingw32
  3. Quote:Original post by Evil Steve Looks fine to me at first glance. Can we see your code for adding the events to the queue? Have you tried scattering some OutputDebugString()s about to check what's going on? well thanks for the help :D When you asked I noticed I had SetEvent(&m_Event[0]); how can I make one thread listen to one 'more-job'-event and one quit-event, and still be able to finish all jobs in a queue (if there is jobs to do).
  4. I am trying to learn to use win32 events so I created a small test program with a mainloop that just push numbers to a queue and 2 "working" threads that pops the top number and then prints it. The problem is that I try to use an event to tell my worker threads that an object has been queued. in short I do this: 1) create worker threads 2) create event m_Event[0] = CreateEvent(NULL, true, // TRUE=manual, FALSE=auto true, // signaled state "QueueEvent" // name of event; optional ); if( m_Event[0] == NULL ) { std::cout << "Failed to create QueueEvent." << std::endl; } 3) Main threads start its loop by Queueing new item and calling SetEvent(m_Event[0]); when new item is in queue. 4) Worker thread is waiting for events (I have 2 events) while(1) { DWORD e = WaitForMultipleObjects(2, m_Event, false, INFINITE); ResetEvent(m_Event[e]); ... }; So the problem is that my worker thread only recives the first event, doesn't matter if I create the thread with manualreset flag to false the thread will only recive one event, even though my mainloop queue 10 items. EDIT: The main thread has a Sleep(1000); between each object it adds in queue.
  5. So I have installed the new C++ 2008 Express edition from MS. I have created a .Dll project and a .exe project.. The .Dll project compiles fine and I get a .dll file But when I get to the linking part for the .exe file the linker breaks and says I have no .Lib file for my .Dll file. So I looked through my project settings for my .Dll project and found "Import Library" and it has the value of $(OutDir)\$(ProjectName).lib which means it would generate ..\debug\enginecore.lib but it doesn't, I have tried to rebuild but no .lib file. So have I missed any options for creating .lib files when creating a .dll file? EDIT: So I found a place where I have to define a Module defention file, I assume this is where I put in a path for a .def file. Altough I don't have one, I am converting a project from CodeBlocks to VC++ 2008 Express and CB generated a .def file on its own.
  6. Thank you for your answers :) I found late last night that mingw doesn't support #pragma commment(lib, ..) and there was no solution other than that you had to tell the linker by hand what libraries to use.
  7. I have switched to DevC++ at the moment because my school has it. Before have I used VC++ 2005 Express edition. So my question is: Does #pragma comment(lib, "mylib") only work in VC++? because I can't get it working. have searched the net (still doing that) but I can't find anything to get it working.
  8. oh.. forgot to write that, I'm using the ilut version in GLUT.
  9. I'm trying to write my own 3D engine without using GLUT... But it failes when I try to load an image with DevIL Top image is a screenshot with Win32 code and no glut lower image is from my GLUT engine.. the texture files are the same and is in JPG format. this is how I do in the non GLUT engine ILuint ilImage; ilGenImages( 1, &ilImage ); ilBindImage( ilImage ); const bool loaded = ilLoadImage( (const ILstring)FileName.c_str() ) == 1; if( !loaded ) { CLog::errorMessage( "Failed to load texture %s", FileName.c_str() ); return NULL; } ILenum ilFormat = IL_RGB; if( ilGetInteger(IL_IMAGE_BITS_PER_PIXEL) == 32 ) ilFormat = IL_RGBA; const bool converted = ilConvertImage( ilFormat, IL_UNSIGNED_BYTE ) == 1; if( !converted ) { CLog::errorMessage("Failed to convert image data for texture %s", FileName.c_str() ); return NULL; } GLenum target = GL_TEXTURE_2D; GLint MagFilter = GL_LINEAR; GLint MinFilter = GL_LINEAR; GLint format = GL_RGB; if( ilFormat == IL_RGBA ) format = GL_RGBA; glGenTextures( 1, &tu->m_iTextureID ); glBindTexture( target, tu->m_iTextureID ); // Set texture filter glTexParameteri(target, GL_TEXTURE_MAG_FILTER, MagFilter); glTexParameteri(target, GL_TEXTURE_MIN_FILTER, MinFilter); // Upload image data glTexImage2D(target, 0, ilGetInteger(IL_IMAGE_BPP), ilGetInteger(IL_IMAGE_WIDTH), ilGetInteger(IL_IMAGE_HEIGHT), 0, ilGetInteger(IL_IMAGE_FORMAT), GL_UNSIGNED_BYTE, ilGetData()); ilDeleteImages( 1, &ilImage ); I have tried with ilut and I got the same result. ilutInit(); tu->m_iTextureID = ilutGLLoadImage((ILstring)FileName.c_str());
  10. I'm trying to write my own itoa because it isn't included in the std C library altough different implementation of it may exists in different C libs. The thing is that I would like to write it without using any dynamic memory allocation inside the function, and without any help from other standard C library functions. I'm using only base 10 for now. char *itoa( int value, char *buffer ) { const char digits[] = "0123456789"; int digit = value % 10; int next = value / 10; *buffer = digits[digit]; // this will add the digit to the string as an ascii char. but if I go to the next one now it will be in reverse order 1234 will become 4321. }
  11. I'm calling ilInit() once at startup of the application, just after I create the OpenGL context
  12. I still can't DevIL to work :( This is how I do it now: CTexture::loadTexture( const std::string &FileName ) { ILuint ilImage; ilGenImages( 1, &ilImage ); ilBindImage( ilImage ); const bool loaded = ilLoadImage( (const ILstring)FileName.c_str() ) == 1; if( !loaded ) { CLog::errorMessage( "Failed to load texture %s", FileName.c_str() ); return NULL; } ILenum ilFormat = IL_RGB; if( ilGetInteger(IL_IMAGE_BITS_PER_PIXEL) == 32 ) ilFormat = IL_RGBA; const bool converted = ilConvertImage( ilFormat, IL_UNSIGNED_BYTE ) == 1; if( !converted ) { CLog::errorMessage("Failed to convert image data for texture %s", FileName.c_str() ); return NULL; } GLenum target = GL_TEXTURE_2D; GLint MagFilter = GL_LINEAR; GLint MinFilter = GL_LINEAR; GLint format = GL_RGB; glGenTextures( 1, &m_texID ); glBindTexture( target, m_texID ); // Set texture filter glTexParameteri(target, GL_TEXTURE_MAG_FILTER, MagFilter); glTexParameteri(target, GL_TEXTURE_MIN_FILTER, MinFilter); // Upload image data glTexImage2D(target, 0, ilGetInteger(IL_IMAGE_BPP), ilGetInteger(IL_IMAGE_WIDTH), ilGetInteger(IL_IMAGE_HEIGHT), 0, ilGetInteger(IL_IMAGE_FORMAT), GL_UNSIGNED_BYTE, ilGetData()); ilDeleteImages( 1, &ilImage ); }; it worked with the same texture in my testapp using glut and ilut upper part in my engine using DevIL only, the lower part the testapp using glut and ilut.
  13. LorenzoGatti > The texture looks like a mess of pixels and not like the marble texture it is. The texture is loaded from a JPG file. and I do almost the same as sirGustav posted. the difference is that I have split the OpenGL part of the code and IL part of the code to different functions because the OpenGL part is render specefic and the IL part is not.. so I load the IL image data and store the variables in a image class then I pass it on to the renderer (OpenGL so far) which then calls the OpenGL specefic API functions like sirGustav wrote but without the calls to IL it has a pointer to a Image instance with the member variables which hold the data I got from IL.
  14. I have found that I should do like this to load image with DevIL ILuint texid; ILboolean success; ilGenImages(1, &texid); ilBindImage(texid); success = ilLoadImage( file ); if( success ) { m_iBitsPerPixel = ilGetInteger(IL_IMAGE_BITS_PER_PIXEL); m_iWidth = ilGetInteger(IL_IMAGE_WIDTH); m_iHeight = ilGetInteger(IL_IMAGE_HEIGHT); CLog::beginFrame(LML_DEBUG, "Loading texture"); CLog::message(LML_DEBUG, "width x height x bpp: %i x %i x %i", m_iWidth, m_iHeight, m_iBitsPerPixel ); CLog::endFrame(LML_DEBUG); ILenum format = IL_RGB; if( m_iBitsPerPixel == 32 ) format = IL_RGBA; success = ilConvertImage(format, IL_UNSIGNED_BYTE); if( !success ) return success; pData = ilGetData(); } and then I just create the texture in OpenGL using the pData as data buffer for the texture. Well it works but the texture isn't correct if I would use ilut the OpenGL helper stuff for DevIL it works but I don't want to use that.
  15. McZ

    Intersection point of 3 planes

    Now I can see something but it is far from correct as far as I can see... I draw the bottom and top lines that connects the near and far planes but the lines are drawn as if the frustum would have a fov at 180 degrees and the fov is 20 degrees. EDIT: it doesn't matter how I change the fov the lines are drawn the same starting at the position of the light and are drawn as if the light frustum would have 180 degree fov. EDIT 2: I have now drawn the lines around the near and far plane and it looks like the near and far plane are at the same position, at 1.0f the far plane should be at 100.0f EDIT 3: All planes have the same information according to what I have logged into my logfile 15:20:04 +---------------------------------------------------------------------------------+ 15:20:04 | Plane 0 light 0 | 15:20:04 +---------------------------------------------------------------------------------+ 15:20:04 | Normal X:0.02 Y:-0.01 Z:-1.00 | 15:20:04 | Distance -0.82 | 15:20:04 +---------------------------------------------------------------------------------+ altough when I calculate the corners for the frustum I get the 8 corners of the near and far plane and when I draw them they are located around the lightsource except that the near and far plane is the "same" plane the quads that visualize the near and far plane are different sizes but it looks like they are the same plane. EDIT 4: I have fixed the "EDIT 3" problem so now the planes are different as they should be. And I have found out that if I use an Identity matrix as Modelview matrix the frustum planes works as they should. EDIT 5: Now I have fixed the modelview matrix, and I got nice frustums But they are at the wrong positions not where the light actually are and some of them has the wrong direction too. [Edited by - McZ on January 31, 2006 12:27:20 PM]
  • 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!