• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.

ashstampede

Members
  • Content count

    41
  • Joined

  • Last visited

Community Reputation

122 Neutral

About ashstampede

  • Rank
    Member
  1. I have been trying to multi blend 3 textures together with no luck, I was following an example in "more opengl game programming" The difference I was using the example against my own project. This is the result of the multiblending. http://i285.photobucket.com/albums/ll75/ashstampede/multiattempt.png So I an not sure where I have gone wrong, but the image kind of blends but also looks streched. Below is a step by step of the 3 main code blocks where I try to use multiple textures. I load the texture using SOIL library then build a mipmap glGenTextures(1,&TextureID); glBindTexture(GL_TEXTURE_2D, TextureID); gluBuild2DMipmaps(GL_TEXTURE_2D, 3,imageW, imageH,GL_RGB,GL_UNSIGNED_BYTE, textureData); // Set up filtering. glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); // Enable largest anisotropic filtering. if (GLEE_EXT_texture_filter_anisotropic) { GLfloat largest_supported_anisotropy; glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &largest_supported_anisotropy); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, largest_supported_anisotropy); } // Set up the wrap. glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T, GL_REPEAT); Then I generate and apply the textures // The first texture is placed, ignoring the vertex color. glActiveTextureARB(GL_TEXTURE0_ARB); glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); // The second texture and the previous texture are combined based // on the vertex color. glActiveTextureARB(GL_TEXTURE1_ARB); glEnable(GL_TEXTURE_2D); glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB); glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_INTERPOLATE_ARB); glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_PREVIOUS_ARB); glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND0_RGB_ARB, GL_SRC_COLOR); glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_TEXTURE); glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND1_RGB_ARB, GL_SRC_COLOR); glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE2_RGB_ARB, GL_PRIMARY_COLOR_ARB); glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND2_RGB_ARB, GL_SRC_COLOR); glDisable(GL_TEXTURE_2D); // The third texture and the previous result are combined based // on the vertex alpha value. glActiveTextureARB(GL_TEXTURE2_ARB); glEnable(GL_TEXTURE_2D); glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB); glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_INTERPOLATE_ARB); glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_PREVIOUS_ARB); glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND0_RGB_ARB, GL_SRC_COLOR); glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_TEXTURE); glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND1_RGB_ARB, GL_SRC_COLOR); glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE2_RGB_ARB, GL_PRIMARY_COLOR_ARB); glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND2_RGB_ARB, GL_SRC_ALPHA); glDisable(GL_TEXTURE_2D); Then when In the triangle strip, which i am just using glbegin/glend for simplicity for(int z = 0; z < length; z++) { //Makes OpenGL draw a triangle at every three consecutive vertices //specify two vertices, gl connects the dots to the third glBegin(GL_TRIANGLE_STRIP); for(int x = 0; x < realSize; x++) { Vertex vert = hmTerrain[z * realSize + x ]; Vertex vert1 = hmTerrain[(z+1) * realSize + x ]; Vertex nodeNormal = hmNormals[z * realSize + x ]; //color calculations are off glMultiTexCoord2fARB(GL_TEXTURE2_ARB, hmTextures[z * realSize + x].u*0.5f, hmTextures[z * realSize + x].v*0.5f); glMultiTexCoord2fARB(GL_TEXTURE1_ARB, hmTextures[z * realSize + x].u*0.5f, hmTextures[z * realSize + x].v*0.5f); glMultiTexCoord2fARB(GL_TEXTURE0_ARB, hmTextures[z * realSize + x].u*0.5f, hmTextures[z * realSize + x].v*0.5f); glNormal3f(nodeNormal.x,nodeNormal.y,nodeNormal.z); glVertex3f(vert.x ,vert.y,vert.z); nodeNormal = hmNormals[(z+1) * realSize + x ]; glMultiTexCoord2fARB(GL_TEXTURE2_ARB, hmTextures[(z+1) * realSize + x].u*0.5f, hmTextures[z * realSize + x].v*0.5f); glMultiTexCoord2fARB(GL_TEXTURE1_ARB, hmTextures[(z+1) * realSize + x].u*0.5f, hmTextures[z * realSize + x].v*0.5f); glMultiTexCoord2fARB(GL_TEXTURE0_ARB, hmTextures[(z+1) * realSize + x].u*0.5f, hmTextures[z * realSize + x].v*0.5f); glNormal3f(nodeNormal.x,nodeNormal.y,nodeNormal.z); glVertex3f( vert1.x,vert1.y,vert1.z); } glEnd(); }
  2. so when loading a model and getting to the material file I have some models with multiple textures. can I just binded them to the model and then blended them? or what is the appropriate method? I am not talking about shaders either, I am still not there and a bit lost on binormal and tangents for a model.
  3. as undescriptive as that error is, I am following examples and the line of shader code that returns the error is identical to the example. //ERROR HERE sumColor += tex2D(Tex0, i.TexCoord0 + step * direction[ i ]); what does it mean? if i remove TexCoord0 the shader will compile and display a result not the one i want but still does somthing. //Access to render texture sampler Tex0; //the width to grab the next texture float step; //which direction do we go using uv coordinates //we will make 2 passes const float2 direction[8] = { -0.353 , -0.337 , // nw -0.01 , 0.282 , //north 0.231 , 0.341 , // ne 0.382 , 0.0 , //east 0.212 , 0.16 , //se 0.011 , 0.287 , //south -0.143 , 0.013 , // sw -0.321 , 0.12 , //west }; //----------------------------------------------------------------------------- // Input / output structures //----------------------------------------------------------------------------- // Input to Pixel Shader struct PS_Input { float2 TexCoord0 : TEXCOORD0; }; // Output from Pixel Shader struct PS_Output { float4 Color : COLOR0; }; //add 6 neighbouring pixels to the current pixels void main( in PS_Input i, out PS_Output o ) { float4 sumColor = tex2D(Tex0, i.TexCoord0); //add the color values for(int i = 0; i < 8; i++) { //ERROR HERE sumColor += tex2D(Tex0, i.TexCoord0 + step * direction[ i ]); } //average off the sum to prevent white. sumColor /= 9; o.Color.rgb = sumColor.rgb; o.Color.a = 1.0f; } //error here sumColor += tex2D(Tex0, i.TexCoord0 + step * direction[ i ]);
  4. OpenGL

    Quote: You have to duplicate vertices because the same vertex may have different normal or texture coordinate for different triangles it is shared by. If you do it this way then building the buffers is trivial. that to me sounds like I should just have the data as is in the VBO, and dont do indices.
  5. I posted this originally in graphics and theory but doesnt seem to be getting a response. I have a section that will look through all the vertices,uv, normals and create Indices for them, But with larger objects Its really slow. I have this model that is 25K triangles or so and It took maybe 20mins and it didnt load unto the screen. I get setting a break point to see if it was still processing which is was. Models that are in the 500 area took 3-4 seconds from loading the mesh data from file and then building the VBO. With the larger model, loading the mesh data from file is pretty fast, fast enough for me. So its just the building of the VBO that seems to be the issuse. the original forum thread is here http://www.gamedev.net/community/forums/topic.asp?topic_id=490143
  6. OpenGL

    looking over your code, that you supplied that isnt where I have my problem, I load in the mesh data into my program fast and fine. Its when I am building Vertex Buffer with Indices and I dont want duplicates vertices.
  7. I would like some suggestions on making my model loader faster, it is loading .obj file format. There area where it is slow is converting the mesh data to opengl VBO data. so it looks for duplicate vertex,normal and uv data and creates indices as appropriatly. a model with 570 faces loads in like 2 seconds, but i have a model with 25000+ faces, I waited maybe 20mins with it not showing on the screen, yet i kept hitting a break point and it was still processing. I am using stl vectors as my containers I think this is the main problem area, the compare section for(unsigned int h = 0; h < ActualVertexArraySize; h++)//we will already set 0 so move to next element for the IB { //because we start from the beginning each time need to ensure we dont count the current data if(iterVT != endVT) { //check the vertices //use the temp data to compare with the rest of the vertex if(FLOATCOMPARE(pVT.x,iterVT->x)&& FLOATCOMPARE(pVT.y,iterVT->y)&& FLOATCOMPARE(pVT.z,iterVT->z) ) { if(hasNormal) { if(iterNT != endNT) { if(FLOATCOMPARE(pNT.x,iterNT->x)&& FLOATCOMPARE(pNT.y,iterNT->y)&& FLOATCOMPARE(pNT.z,iterNT->z) ) { if(hasUV) { if(FLOATCOMPARE(pUV.u,iterUV->u)&& FLOATCOMPARE(pUV.v,iterUV->v) ) { //it is a old index, so reuse it, then increment the new index place currentMesh.triangleIndexBuffer[index]= h; reuse = true; break; }//end compare UV } else { //it is a old index, so reuse it, then increment the new index place currentMesh.triangleIndexBuffer[index]= h; reuse = true; break; } }//end compare normals }//check if normal iterator in range }//end if hasNormal else if(hasUV) { if(iterUV != endUV) { if(FLOATCOMPARE(pUV.u,iterUV->u)&& FLOATCOMPARE(pUV.v,iterUV->v) ) { //it is a old index, so reuse it, then increment the new index place currentMesh.triangleIndexBuffer[index]= h; reuse = true; break; }//end comapre UV }//check if uv iterator in range }//end else if hasUV //it is a old index, so reuse it, then increment the new index place currentMesh.triangleIndexBuffer[index]= h; reuse = true; break; }//end vert compare } if(iterVT != endVT) iterVT++; if(iterNT != endNT && hasNormal) iterNT++; if(iterUV != endUV && hasUV) iterUV++; }//end for actual vertex size //the element was unique so add it as a new vertexsize, jump and increment the index buffer. if(!reuse) { currentMesh.triangleIndexBuffer[index]= ActualVertexArraySize++; vtBuffer.push_back(pVT); endVT = vtBuffer.end(); if(hasNormal) { ntBuffer.push_back(pNT); endNT = ntBuffer.end(); } if(hasUV) { uvBuffer.push_back(pUV); endUV = uvBuffer.end(); } } //reset the iterators iterVT = vtBuffer.begin(); iterNT = ntBuffer.begin(); iterUV = uvBuffer.begin(); and the model sorting in its entirity for(unsigned int currentFace= 0; currentFace < currentMesh.meshData->numFaces; currentFace++) { bool hasNormal =false; bool hasUV = false; bool reuse = false; //short hand reference pf = currentMesh.meshData->faceList[currentFace]; //did we count normals and uv's when reading the mesh data if(currentMesh.meshData->numNormals > 0) { hasNormal = true; pNT = currentMesh.meshData->normalList[pf.normalIndices[0]]; } if(currentMesh.meshData->numUV > 0) hasUV = true; //check for duplicate vertices,normals and uv /*Here we use K to represent 3 points of a triangle We use index to move along the currentFace and reference the actual data of a uv,normal,or vertex*/ for(int k = 0; k < 3; k++, index++) { pVT = currentMesh.meshData->vertexList[pf.vertIndices[k]]; if(hasNormal && currentMesh.meshData->numNormals > 1 ) { pNT = currentMesh.meshData->normalList[pf.normalIndices[k]]; } if(hasUV) { pUV = currentMesh.meshData->uvList[pf.uvIndices[k]]; } //go through all the list list of normals, UV and vertices to check if they are in the VBO //assign Indices based on, for(unsigned int h = 0; h < ActualVertexArraySize; h++) { //because we start from the beginning each time need to ensure we dont count the current data if(iterVT != endVT) { //check the vertices //use the temp data to compare with the rest of the vertex if(FLOATCOMPARE(pVT.x,iterVT->x)&& FLOATCOMPARE(pVT.y,iterVT->y)&& FLOATCOMPARE(pVT.z,iterVT->z) ) { if(hasNormal) { if(iterNT != endNT) { if(FLOATCOMPARE(pNT.x,iterNT->x)&& FLOATCOMPARE(pNT.y,iterNT->y)&& FLOATCOMPARE(pNT.z,iterNT->z) ) { if(hasUV) { if(FLOATCOMPARE(pUV.u,iterUV->u)&& FLOATCOMPARE(pUV.v,iterUV->v) ) { //it is a old index, so reuse it, then increment the new index place currentMesh.triangleIndexBuffer[index]= h; reuse = true; break; }//end compare UV } else { //it is a old index, so reuse it, then increment the new index place currentMesh.triangleIndexBuffer[index]= h; reuse = true; break; } }//end compare normals }//check if normal iterator in range }//end if hasNormal else if(hasUV) { if(iterUV != endUV) { if(FLOATCOMPARE(pUV.u,iterUV->u)&& FLOATCOMPARE(pUV.v,iterUV->v) ) { //it is a old index, so reuse it, then increment the new index place currentMesh.triangleIndexBuffer[index]= h; reuse = true; break; }//end comapre UV }//check if uv iterator in range }//end else if hasUV //it is a old index, so reuse it, then increment the new index place currentMesh.triangleIndexBuffer[index]= h; reuse = true; break; }//end vert compare } if(iterVT != endVT) iterVT++; if(iterNT != endNT && hasNormal) iterNT++; if(iterUV != endUV && hasUV) iterUV++; }//end for actual vertex size //the element was unique so add it as a new vertexsize, jump and increment the index buffer. if(!reuse) { currentMesh.triangleIndexBuffer[index]= ActualVertexArraySize++; vtBuffer.push_back(pVT); if(hasNormal) { ntBuffer.push_back(pNT); } if(hasUV) { uvBuffer.push_back(pUV); } } //reset the iterators iterVT = vtBuffer.begin(); iterNT = ntBuffer.begin(); iterUV = uvBuffer.begin(); endVT = vtBuffer.end(); endNT = ntBuffer.end(); endUV = uvBuffer.end(); reuse = false; }//end loop per trangle if(currentIterVT != currentMesh.meshData->vertexList.end()) currentIterVT++; if(currentIterUV != currentMesh.meshData->uvList.end() && hasUV) currentIterUV++; if(currentIterNT != currentMesh.meshData->normalList.end() && hasNormal) currentIterNT++; }//for current face
  8. SO i have attempted at reading the vertex,uv and normals and creating a IBO to cross reference the VBO. But It doesnt seem to work at all, now this is taken from robthebloke.org obj loader. http://www.robthebloke.org/opengl_programming.html#5 But I have altered it as he used C style malloc and realloc to change the original uv,vertex and normal arrays which were pointers. I use vectors and my model loading is different from his example. As it stands, small objects, like billboards dont show in the scene and large object go out of bounds. The code below does this gets the mesh data faces,uv,normal,vertex. checks if they have appeared before, if they havnt get the index and assign it to the vertex buffer index array. then create the VBO. But this doesnt work at all, Am i on the right track or is there a simpler way? void ModelManager::ConstructVBO(Object3D &currentMesh) { /* **Create a temporary set of pointers to the old data. * we use the fact that a vector is contiguos set of data */ Vertex *pVT; Vertex *pNT; TexUV *pUT; //short hand pointer Triangle pf; /* ** This is used to keep track of the actual vertex array size created. ** Once the data has been organised into */ unsigned int ActualVertexArraySize=0; /* ** Allocate memory for the vertex array indices */ currentMesh.triangleIndexBuffer = new unsigned int[currentMesh.meshData->numFaces*3]; /*loop the the total number of faces of an object * test each vertex/normal/and uv co-ordinate out of the old data for cross referencing to the index buffer */ bool reuse_element = false; bool end_element = false; unsigned int unreadIndices,m; unreadIndices = m = 0; for(unsigned int currentIn= 0; currentIn < currentMesh.meshData->numFaces; currentIn++) { bool hasNormal =false; bool hasUV = false; //short hand reference pf = currentMesh.meshData->faceList[currentIn]; pVT = &currentMesh.meshData->vertexList[currentIn]; pNT = &currentMesh.meshData->normalList[currentIn]; pUT = &currentMesh.meshData->uvList[currentIn]; //test if we have normals or uvs if(currentMesh.meshData->numUV > 0) hasUV = true; if(currentMesh.meshData->numNormals > 0) hasNormal = true; //loop through a complete triangle, even though this is opengl we have triangulated everything for(unsigned int k = 0 ; k < 3; k++,unreadIndices++) { //temp holders float verts[3]={0},norms[3]={0},uvs[2]={0}; verts[0] = pVT[ pf.vertIndices[k] ].x; verts[1] = pVT[ pf.vertIndices[k] ].y; verts[2] = pVT[ pf.vertIndices[k] ].z; //do we have normals if(hasNormal) { norms[0] = pNT[ pf.normalIndices[k] ].x; norms[1] = pNT[ pf.normalIndices[k] ].y; norms[2] = pNT[ pf.normalIndices[k] ].z; } //do we have textures if(hasUV) { uvs[0] = pUT[ pf.uvIndices[k] ].u; uvs[1] = pUT[ pf.uvIndices[k] ].v; } //if we have incremented the IBO we check against the indices and vertex we have crossed referenced //with the other vertex data of the obj. for(unsigned int l = 0; l < ActualVertexArraySize; l++) { //always have vertices so compare what we have in the VBO and what in the MeshData if( AreEqualRelative( currentMesh.meshData->vertexList[unreadIndices].x, verts[0] ) && AreEqualRelative( currentMesh.meshData->vertexList[unreadIndices].y, verts[1] ) && AreEqualRelative( currentMesh.meshData->vertexList[unreadIndices].z, verts[2] ) ) { //the object has normal data, check if we alreadh have it if(hasNormal) { if( AreEqualRelative(currentMesh.meshData->normalList[unreadIndices].x, norms[0] ) && AreEqualRelative( currentMesh.meshData->normalList[unreadIndices].y, norms[1] ) && AreEqualRelative( currentMesh.meshData->normalList[unreadIndices].z, norms[2] ) ) { //it has texture data as well if(hasUV) { if( AreEqualRelative( currentMesh.meshData->uvList[unreadIndices].u, uvs[0] ) && AreEqualRelative( currentMesh.meshData->uvList[unreadIndices].v, uvs[1] ) ) { reuse_element = true; } } else reuse_element = true; } } //didnt have normal data but still might have texture data else if(hasUV) { if( AreEqualRelative( currentMesh.meshData->uvList[unreadIndices].u, uvs[0] ) && AreEqualRelative( currentMesh.meshData->uvList[unreadIndices].v, uvs[1] ) ) { reuse_element = true; } } else reuse_element = true; }//end the compare of vertex data if(reuse_element) break; }//end l++ actaulvertexarraysize if(!reuse_element) { //populate the currentMesh arrays Vertex tempVT; tempVT.x = verts[0]; tempVT.y = verts[1]; tempVT.z = verts[2]; currentMesh.meshData->vertexList.push_back(verts); if(currentMesh.meshData->numNormals > 0) { Vertex tempNT; tempNT.x = norms[0]; tempNT.y = norms[1]; tempNT.z = norms[2]; currentMesh.meshData->normalList.push_back(tempNT); } if(currentMesh.meshData->numUV > 0) { TexUV tempUV; tempUV.u = uvs[0]; tempUV.v = uvs[1]; currentMesh.meshData->uvList.push_back(tempUV); } //we jumped out of the array, so move our counter forward currentMesh.triangleIndexBuffer[m] = ActualVertexArraySize++; end_element = true; } else { currentMesh.triangleIndexBuffer[m] = unreadIndices; reuse_element = false; } if(end_element) { ++m; end_element = false; } }//end k++ face triangle loop pVT = NULL; pNT = NULL; pUT = NULL; }// end i++ less the total faces currentMesh.meshData->numFaces *=3; /* ** Zero the data counts as they are shared in a union */ currentMesh.meshData->numNormals = 0; currentMesh.meshData->numUV = 0; currentMesh.meshData->numVerts = 0; currentMesh.meshData->vboSize = ActualVertexArraySize; if(GL_ARB_vertex_buffer_object) { /* generate 2 buffers for the vertex buffer objects */ glGenBuffers( 1, &currentMesh.meshData->vboNum ); /* generate a vertex buffer object for the index array */ glGenBuffers( 1, &currentMesh.meshData->vboElemNum ); glBindBuffer( GL_ARRAY_BUFFER, currentMesh.meshData->vboNum ); /* set vertex buffer object size */ glBufferData( GL_ARRAY_BUFFER, 8 * ActualVertexArraySize * sizeof(float), NULL, GL_STATIC_DRAW ); /* load the seperate vertex, normal & tex coord arrays */ glBufferSubData( GL_ARRAY_BUFFER, 0, 3 * ActualVertexArraySize * sizeof(float), &currentMesh.meshData->vertexList[0] ); glBufferSubData( GL_ARRAY_BUFFER, 3 * ActualVertexArraySize * sizeof(float), 3 * ActualVertexArraySize * sizeof(float),&currentMesh.meshData->normalList[0] ); glBufferSubData( GL_ARRAY_BUFFER, 6 * ActualVertexArraySize * sizeof(float), 2 * ActualVertexArraySize * sizeof(float), &currentMesh.meshData->uvList[0]); glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, currentMesh.meshData->vboElemNum ); glBufferData( GL_ELEMENT_ARRAY_BUFFER, currentMesh.meshData->numFaces * sizeof(float), currentMesh.triangleIndexBuffer, GL_STATIC_DRAW ); } }//end constuct vbo
  9. Currently I have successfully read in the model data and done triangle spliting if need be. I want all my models to go to vbo's. but i am a bit confused as to where to go next with the data of the models. When I build the vbo's I need to have a vertex array that has only one instance of the vertex point? and the index array with the instace to where the repeating data exsist? If not how do I go about next. also what about faces with multiple material how do i appraoch them?
  10. yeah I went the vector root and that didnt work at all, well the algorithm didnt work in a Vector situation, I originally set out to change some C model loading code to c++. so went with c++ pointer arrays declared with new, when i came to resizing the it corrupted the heap. So i tried vectors and that was a no go simply based on the algorith used in the original.
  11. I figured that was the reason, so my problem is bigger than this question, will repost the larger problem at hand.
  12. basically in my program a std::string is not behaving like a string should and by that i mean that objMesh->ObjectName = "word"; breaks with the error Unhandled exception at 0x73a7d57c (msvcr80d.dll) in main.exe: 0xC0000005: Access violation writing location 0xcdcdcdcd. the app breaks in iosfwd which is a locked system file. I am using MS VS C++ 2005 static void __CLRCALL_OR_CDECL assign(_Elem& _Left, const _Elem& _Right) { // assign an element _Left = _Right; } SO the only think i can reduce it to is that objMesh is allocated like so objMesh = (OBJECTMESH*)malloc( sizeof(OBJECTMESH) ); and then i spend the next lines assigning each memeber of object mesh, but when i come to the string, at runtime it breaks. Some insight as to why a string is not working correctly please.
  13. OpenGL

    goodperiodical, well that is what i dont know how to do, i have gldrawelements as the call to render whats in the vbo. the code is structured as INIT: load model from file, create the size of the vbo and index array, fill vbo,delete local model data, Update: render. is it just a simple as when you are in the update,call render 100 times with different glrot and gltrans? What i had planned was to have a texture, like a height map texture where ever there was white on the texture draw a tree. a side note isn't glDrawRangeElement better than glDrawElements. I ended up using glDrawElements because i couldnt get the data glDrawRangeElements need correctly.
  14. I say "Instancing" because that is a directX feature. But what i would like to know is If i have placed a model in a vbo. how would i then have more than one object sharing that model data. an example is to load one tree model but have 100 objects of this tree rendered. Also when i have loaded this model in to vertex buffer. how do I move it/rotate if i have deleted the local data? i.e I now what to place these 100 tree objects all over the scene. thanks in advance.