|
Please, in the future read the posting guidelines before posting (for instance, use the pre tags to format your code properly so that it is readable).
Now to your question: OpenGL only handle images which have a power of 2 as dimensions. Loading images with non-standard dimensions will work on certain graphic cards but not all of them. So, the solution to your problem is to simply create your image as a 1024x1024 image (for instance, additional space is filled with white) and then when the image is used (using glTexCoord2) you only take the part where your image really is (for instance if your image is 768 pixels wide, you have to specify 768/1024=0.75 in your glTexCoord function).
|
|
|
|
|
int iwidth=512;
int iHeight=512;
OK,Now i am create image 512*512 and give in glTexImage2D
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, iwidth,iHeight, 0, GL_RGB, GL_UNSIGNED_BYTE, data);
In Draw Function
glTexSubImage2D (GL_TEXTURE_2D, 0, 0, 0,768, 576, GL_RGB, GL_UNSIGNED_BYTE, data);
float fval=(float)(768.0f/512.0f);
if (TRUE)
{
glBegin(GL_QUADS);
glTexCoord2f(fval, fval);
glVertex3f( 11.0f, 8.3f, -20.0f);
glTexCoord2f(0.0f, fval);
glVertex3f(-11.0f, 8.3f, -20.0f);
glTexCoord2f(0.0f, 0.0f);
glVertex3f(-11.0f, -8.3f, -20.0f);
glTexCoord2f(fval, 0.0f);
glVertex3f( 11.0f, -8.3f, -20.0f);
glEnd();
}
I can not able to load image like above coding.
By the way,My view size if fix 512*512 and i want to support zoom also.
|
|
|
|
|
That doesn't make any sense: tell me how you put an 768x768 image in an 512x512 image
How large is your image finally ? Because your fval (768/512) is bigger than 1 (and so, it is invalid for the glTexCoord function).
|
|
|
|
|
I know that some network car has this function. But how to call network interface?
|
|
|
|
|
be more specific on your question.
|
|
|
|
|
For example, if today is 2012 Jan 1st, the computer boots and then enter the windows system by itself. But I doknow how to call the bios to set it.
|
|
|
|
|
|
|
I am currently taking data from a database that is in the form of char data and attempting to convert to a string and then saving in a char array. It appears that these strings have to be saved in a two dimension array. The first array or inner array containing each element of the date in the form of chars. The outer array then contains each record or occurance of the date. Can someone help me in copying the string data into the array? Listed below is what I have so far.
char Date1[10] = {};
vFieldDate = rec->Fields->GetItem("Date")->Value;
for(int r = 0; r < 1; r++)
{
for(int c = 0; c < 10; c++)
{
strcpy (Date1,vFieldDate);
strcpy (Date[r][c],Date1[10]);
printf ("%s",Date[r][c]);
}
}
|
|
|
|
|
Mike Certini wrote: strcpy (Date[r][c],Date1[10]);
strcpy (Date[r][c],Date1); is correct.
Hope you have declared char Date[MAX][10] (where MAX will be greater than or equal to l) , or dynamically allocated memory for it.
|
|
|
|
|
Through research the following was derived from an MSDN website:
#define ARR 65500 //Total Records
#define TARGSIZE 11 //Field Length
char Date[ARR][TARGSIZE] = {};
orig = rec->Fields->GetItem("Time")->Value;
const size_t newsize = 100;
char nstring[newsize];
strcpy_s(nstring, (char *)orig);
strncpy(Date[cyc],nstring,TARGSIZE - 1);
printf("%s",nstring);
printf("\n");
Original MSDN website:
http://msdn.microsoft.com/en-us/library/ms235631(v=vs.80).aspx[^]
|
|
|
|
|
Why not:
strncpy(Date[cyc], (char *)orig, TARGSIZE - 1);
strncpy(Date[cyc], (char *)rec->Fields->GetItem("Time")->Value, TARGSIZE - 1);
I must get a clever new signature for 2011.
|
|
|
|
|
Gentlemen,
I hope everyone is having a good day.
I have an problem with my .dll that is linked to Excel.
I have 2 functions in the file, they are named in the def file and they work fine.
I added a third this morning, added name to def file.
I declared it in VBE.
For some reason, when I try to type it into a cell and give it a variable, i.e. cell formula is =Hs_P(B8),
immediately Excel has an error and shuts down. I am very perplexed.
Any ideas? Have I given enough information?
This is the error Excel is throwing out "Excel asertion error"
And the line from the code _ASSERTE(_BLOCK_TYPE_IS_VALID(pHead->nBlockUse));
I haven't found the problem, but I believe it is the way I am calling one function from inside of another function.
|
|
|
|
|
Assuming you are talking about some C++ code then you may need to use your debugger to find exactly where it is failing. From the information provided above you have an invalid pointer somewhere.
I must get a clever new signature for 2011.
|
|
|
|
|
This function seems to be causing the assertion failure, but I cannot se why, it compiles without error.
I think I found the error, it appears I cannot delete the arrays before I return x, does anyone know this to be true?
delete [] J0;
delete [] n0;
delete [] Ir;
delete [] Jr;
delete [] nr;
return(x);
}
modified on Thursday, January 27, 2011 5:35 PM
|
|
|
|
|
You can't create any memory errors or access violations without destabilizing Excel.
|
|
|
|
|
Having looked at the code in your original message I see the problem. You are instantiating your arrays on the stack by statements such as:
double J0[10] = {0, 1, -5, -4, -3, -2, -1, 2, 3};
and then trying to dispose of them by delete . This is the cause of your problem, you cannot delete a variable that was not created with new . Stack variables will be disposed of automatically when the function returns.
I must get a clever new signature for 2011.
|
|
|
|
|
Hi all,
I have a CFormView, and a child CListCtrl control. I can handle
accelerator events, like Ctrl+C, Ctrl+V ... in CFormView without
problem, by defining below message handler:
ON_COMMAND(ID_EDIT_COPY, &CMyFormView::OnEditCopy)
Now I want my CListCtrl handle these commands differently. I want to
implement OnEditCopy in CListCtrl class, rather than implement logic
in the view class. How can I pass the accelerator events from CView to
child control, when CListCtrl is on focus? I tried like:
ON_CONTROL_REFLECT(ID_EDIT_COPY, &ThisClass::OnEditCopy)
But it does not work.
|
|
|
|
|
Have a look here[^], I'm not sure if it's posted by you as well (exact same wording of the question), but it appears to have been answered to the poster's satisfaction.
modified 13-Sep-18 21:01pm.
|
|
|
|
|
how we write the c-program of sorting the set of point. w.r.t. convex polygon
|
|
|
|
|
how we write the c-program of sorting the set of point. w.r.t. convex polygon
|
|
|
|
|
Uh, what ?
Could you please explain your problem in more details so that we can understand what you are looking for ?
What is your problem exactly ? What did you try yet ? Where are you stuck precisely ? ...
|
|
|
|
|
Why don't you try to explain better your requirements instead of reposting (and cross-posting) your question?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Do you have the skills necessary to write a C program? If the answer is yes then you can use the simple or STL sort[^].
I must get a clever new signature for 2011.
|
|
|
|
|
Like others already pointed out, your request is rather unspecific. You mention sorting, a 'set of point(s?)' and a convex polygon. What are the predefined parameters of the problem, how do they relate to each other, and what, exactly, is the desired end result?
Just out of interest (about google more than your question) I've put the above terms into google and one of the first useful results is Arrange points so polygon is not self intersecting.
Is this what you try to achieve?
|
|
|
|
|