Click here to Skip to main content
15,891,607 members
Home / Discussions / Graphics
   

Graphics

 
GeneralRe: Set the properties of a DirectShow filter (not DMO filter) in code (no GUI) Pin
Richard MacCutchan12-Nov-09 23:18
mveRichard MacCutchan12-Nov-09 23:18 
GeneralRe: Set the properties of a DirectShow filter (not DMO filter) in code (no GUI) Pin
RobstaHendricks13-Nov-09 0:09
RobstaHendricks13-Nov-09 0:09 
GeneralRe: Set the properties of a DirectShow filter (not DMO filter) in code (no GUI) Pin
Richard MacCutchan13-Nov-09 0:29
mveRichard MacCutchan13-Nov-09 0:29 
Questioncolor picking method to select primitive in opengl Pin
gourishsio12-Nov-09 1:53
gourishsio12-Nov-09 1:53 
AnswerRe: color picking method to select primitive in opengl Pin
LunaticFringe22-Nov-09 7:52
LunaticFringe22-Nov-09 7:52 
GeneralRe: color picking method to select primitive in opengl Pin
gourishsio22-Nov-09 17:15
gourishsio22-Nov-09 17:15 
GeneralRe: color picking method to select primitive in opengl Pin
LunaticFringe23-Nov-09 10:12
LunaticFringe23-Nov-09 10:12 
QuestionglDrawElements() draws only part of my mesh... :-x Pin
gourishsio12-Nov-09 1:52
gourishsio12-Nov-09 1:52 
Hello..

I have recently shifted from Display lists to VBOs... It's a very nice thing in OpenGL i found to render huge amount of data smoothly..

Let me explain you the scenario.. I have maintained a list of triangle objects as

std::map<unsigned int, EObjects*> MeshElements



Thus, MeshElements contains all the triangles generated by the mesh generator. Now in order to display, i call a routine first as shown below:

mVertexCount = MeshElements.size();

mVertices = new GLfloat[mVertexCount * 6];
mIndices = new GLuint[mVertexCount * 3];

int v_ind = 0, i_ind = 0;

for( std::map<unsigned int, EObjects*>::iterator it = MeshElements.begin(); it != MeshElements.end(); it++ )
{
     EObjects *ob = (*it).second;
     mVertices[v_ind] = ob->GetNodeOne().GetX(); v_ind++;
     mVertices[v_ind] = ob->GetNodeOne().GetY(); v_ind++;
     mIndices[i_ind] = ob->GetNodeOneIndex(); i_ind++;
     mVertices[v_ind] = ob->GetNodeTwo().GetX(); v_ind++;
     mVertices[v_ind] = ob->GetNodeTwo().GetY(); v_ind++;
     mIndices[i_ind] = ob->GetNodeTwoIndex(); i_ind++;
     mVertices[v_ind] = ob->GetNodeThree().GetX(); v_ind++;
     mVertices[v_ind] = ob->GetNodeThree().GetY(); v_ind++;
     mIndices[i_ind] = ob->GetNodeThreeIndex(); i_ind++;
}

glGenGuffersARB(BufferSize, BufferName);



where BufferSize and BufferName are declared globally as follows:


enum{
  INDEX_OBJECT = 0,
  POSITION_OBJECT = 1
};

static const int BufferSize = 2;
static GLuint BufferName[BufferSize];



Below is my rendering code:


glBindBufferARB( GL_ARRAY_BUFFER_ARB, BufferName[POSITION_OBJECT]);
glBufferDataARB( GL_ARRAY_BUFFER_ARB, mVertexCount * 6 * sizeof(float), mVertices, GL_STREAM_DRAW_ARB );
glVertexPointer(2, GL_FLOAT, 0, 0);

glBindBufferARB( GL_ELEMENT_ARRAY_BUFFER_ARB, BufferName[INDEX_OBJECT] );
glBufferDataARB( GL_ELEMENT_ARRAY_BUFFER_ARB, mVertexCount * 3 * sizeof(GLuint), mIndices, GL_STREAM_DRAW_ARB );

glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_INDEX_ARRAY);

glDrawElements( GL_TRIANGLES, mVertexCount*3, GL_UNSIGNED_INT, NULL );

glDisableClientState(GL_INDEX_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);



This code is working fine.. But, only the outer part of the mesh is displayed.. the Inner part is not displayed.. I mean to say, if the mesh is of shape "D", it should have filled all the triangles in "D".. Instead of doing so, it is rather, drawing triangles only along the border of the shape "D" Inner part, triangles are not drawn..

Before using glDrawElements(), i was using glDrawArrays().. It also produced the same output.. So I used, GL_POINTS with glDrawArrays(), just to check if it is reading all the points.. In response to this test, it rendered all the points.. But when i said, GL_TRIANGLES, it is not rendering the inner part..

On the other hand, GL_POINTS with glDrawElements() is also rendering only at the boundaries.. Not inner part like glDrawArrays()..

Is something wrong with my code above..?? Please someone guide me properly..

Thanks in advance..
AnswerRe: glDrawElements() draws only part of my mesh... :-x Pin
LunaticFringe20-Nov-09 5:36
LunaticFringe20-Nov-09 5:36 
GeneralRe: glDrawElements() draws only part of my mesh... :-x Pin
gourishsio23-Nov-09 18:47
gourishsio23-Nov-09 18:47 
GeneralRe: glDrawElements() draws only part of my mesh... :-x Pin
LunaticFringe23-Nov-09 19:18
LunaticFringe23-Nov-09 19:18 
QuestionOpenGL Lib for SmartPhone application Pin
King Tran11-Nov-09 18:05
King Tran11-Nov-09 18:05 
AnswerRe: OpenGL Lib for SmartPhone application Pin
LunaticFringe20-Nov-09 5:31
LunaticFringe20-Nov-09 5:31 
QuestionIs there any software which can generate OpenGL RGB color code. Pin
WindowsVsLinux9-Nov-09 9:33
WindowsVsLinux9-Nov-09 9:33 
QuestionOverlay DirectDraw Pin
5325233-Nov-09 1:04
5325233-Nov-09 1:04 
QuestionIs it possible to compute the blue channel? Pin
Sonhospa2-Nov-09 8:30
Sonhospa2-Nov-09 8:30 
AnswerRe: Is it possible to compute the blue channel? Pin
Chris Losinger3-Nov-09 6:44
professionalChris Losinger3-Nov-09 6:44 
GeneralRe: Is it possible to compute the blue channel? Pin
Sonhospa3-Nov-09 8:08
Sonhospa3-Nov-09 8:08 
GeneralRe: Is it possible to compute the blue channel? Pin
Chris Losinger3-Nov-09 10:51
professionalChris Losinger3-Nov-09 10:51 
GeneralRe: Is it possible to compute the blue channel? Pin
Sonhospa3-Nov-09 12:10
Sonhospa3-Nov-09 12:10 
GeneralRe: Is it possible to compute the blue channel? Pin
Tim Craig3-Nov-09 14:44
Tim Craig3-Nov-09 14:44 
GeneralRe: Is it possible to compute the blue channel? Pin
Chris Losinger15-Nov-09 6:33
professionalChris Losinger15-Nov-09 6:33 
GeneralRe: Is it possible to compute the blue channel? Pin
Sonhospa19-Nov-09 21:16
Sonhospa19-Nov-09 21:16 
GeneralRe: Is it possible to compute the blue channel? Pin
Chris Losinger20-Nov-09 4:26
professionalChris Losinger20-Nov-09 4:26 
QuestionHow to draw cross hair cursor in opengl while rotating camera ?? Pin
maheshbhoir.home30-Oct-09 20:25
maheshbhoir.home30-Oct-09 20:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.