|
IrrlichtDevice* device = createDevice(EDT_SOFTWARE, core::dimension2d<u32>(800, 600), 16, false);
I've to pass the above device(pointer) as a reference to the following function:
CEGUI::IrrlichtRenderer& myRenderer = new IrrlichtRenderer(device);
The "IrrlichtRenderer" is a constructor which accepts only a reference not a pointer. I
can not modify the above constructor because it's not mine( a third party library).
Is there any way?
|
|
|
|
|
Well, it is the opposite of what you were saying in you first post. In that case, simply dereference the pointer:
CEGUI::IrrlichtRenderer& myRenderer = new IrrlichtRenderer(*device);
|
|
|
|
|
Hi All,
I am new to this forum. I am struggling with the following bug.
I am working with a CEdit control. programmatically i am changing the value of the RTL reading order menu item value on the CEdit control. Following is the code i am using.
void CGMTextBoxCtrl::SetRightToLeft(BOOL bNewValue)
{
if (bNewValue)
{
m_ulExtendedStyle &= ~WS_EX_LTRREADING;
m_ulExtendedStyle |= WS_EX_RTLREADING;
//long ulExtendedStyle = SetWindowLong(GetSafeHwnd(),GWL_EXSTYLE,WS_EX_RTLREADING);
}
else
{
m_ulExtendedStyle &= ~WS_EX_RTLREADING;
m_ulExtendedStyle |= WS_EX_LTRREADING;
//long ulExtendedStyle = SetWindowLong(GetSafeHwnd(),GWL_EXSTYLE,WS_EX_LTRREADING);
}
SetModifiedFlag();
RecreateControlWindow();
}
After executing this, the Right to left reading order option is getting checked when i set the value to true. But the text in the control remains LTR.
I tried with Send message. But that couldn't help me. Can anyone please let me know how to achieve this ASAP. its very urgent.
Thanks in advance,
Lucky
|
|
|
|
|
Hi ALL,
Me myself found the following solution. Posting it here to save your time if u r facing the same problem
long ulExtendedStyle = GetWindowLong(GetSafeHwnd(), GWL_EXSTYLE);
if (ulExtendedStyle & WS_EX_RTLREADING)
{
if (!bNewValue)
SetWindowLong(GetSafeHwnd(), GWL_EXSTYLE,(ulExtendedStyle ^ (WS_EX_RTLREADING|WS_EX_LEFTSCROLLBAR|WS_EX_RIGHT))); //516 DECIMAL = 204 HEX
}
else
{
if (bNewValue)
SetWindowLong(GetSafeHwnd(), GWL_EXSTYLE,(WS_EX_RTLREADING|WS_EX_LEFTSCROLLBAR|WS_EX_RIGHT|ulExtendedStyle)); //29188 DECIMAL = 7204 HEX
}
Regards,
Lucky
|
|
|
|
|
i m working with open GL enviroment in visual C++. i have tried to load texture on circle. it is hapening but texture is copied again and again on a circle. i know that problum is in 'glTexCoord2d()'func. i couldnt get the exact coordinate of texture. can any ony help me?
here is the source code
#include <GL/glut.h>
#include <GL/gl.h>
#include <windows.h>
#include <math.h>
#include<stdio.h>
#include<iostream.h>
double frame;
float rot = 0;
const GLfloat DEG2RAD = 3.14159/180;
GLuint texture;
int refreshMillis = 10000;
GLuint LoadTexture( const char * filename, int width, int height )
{
GLuint texture;
unsigned char * data;
FILE * file;
file = fopen( filename, "rb" );
if ( file == NULL )
return 0;
data = (unsigned char *)malloc( width * height * 3 );
fread( data, width * height * 3, 1, file );
fclose( file );
glGenTextures( 1, &texture );
glBindTexture( GL_TEXTURE_2D, texture );
glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_LINEAR );
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,GL_LINEAR_MIPMAP_LINEAR );
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
gluBuild2DMipmaps( GL_TEXTURE_2D, 3, width, height,GL_RGB, GL_UNSIGNED_BYTE, data );
free( data );
return texture;
}
void FreeTexture( GLuint texture )
{
glDeleteTextures( 1, &texture );
}
void drawEllipse1(void)
{
GLint i;
GLfloat xradius=2;
GLfloat yradius=2;
glBegin(GL_POLYGON);
for (i=0; i < 360; i++)
{
float degInRad = i*DEG2RAD;
glTexCoord2d(-cos (degInRad) *xradius, - sin (degInRad) *yradius);
glVertex2f ( cos (degInRad) *xradius, sin (degInRad) *yradius);
}
glEnd();
}
void display()
{
glClearColor(0.0, 1.0, 1.0, 0);
glClear(GL_COLOR_BUFFER_BIT);
glLoadIdentity ();
glPushMatrix() ;
glEnable( GL_TEXTURE_2D );
glTranslatef(0,0,-17) ;
drawEllipse1() ;
glBindTexture( GL_TEXTURE_2D, texture);
glDisable( GL_TEXTURE_2D );
glPopMatrix() ;
glutSwapBuffers();
rot=rot+1.4;
}
void init (void)
{
texture = LoadTexture( "smiley1.raw", 640, 480);
}
void reshape (int w, int h) {
glViewport (0, 0, (GLsizei)w, (GLsizei)h);
glMatrixMode (GL_PROJECTION);
glLoadIdentity ();
gluPerspective (60, (GLfloat)w / (GLfloat)h, 1.0, 100.0);
glMatrixMode (GL_MODELVIEW);
}
int main(int argc,char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE);
glutInitWindowSize (640, 480);
glutInitWindowPosition (100, 100);
glutCreateWindow("ellipse");
init();
glutDisplayFunc(display);
glutIdleFunc (display);
glutReshapeFunc (reshape);
glutMainLoop();
return 0;
}
|
|
|
|
|
You don't really explain what you want to achieve. What is exactly this texture and how should it be mapped on the circle ? Without knowing that, it will be difficult to help you.
|
|
|
|
|
I looked a bit more into your code and I guess your texture contains a circle which has to be mapped exactly on the circle you are drawing (the "simplest" case). Is that correct ?
If yes, your texture mapping is wrong. You have to map the texture coordinates from 0 to 1, so the center of the circle would be coordinate 0.5;0.5 in the texture.
Furthermore, the xradius and yradius shouldn't have any influence the coordinates in your texture (they are used to make your circle wider or smaller on the screen, thus they shouldn't modify how the texture is mapped).
With this said, you end up with something like this:
glTexCoord2d(0.5 + cos(degInRad)/2, 0.5 + sin(degInRad)/2);
One additional remark: you should call glBindTexture before you draw your ellipse. Here it is not really important because you have only one texture but otherwise, you would end up with another texture mapped on your circle.
|
|
|
|
|
It is happening because you are telling it to :
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
|
|
|
|
|
how can we just toggle all the bits in a variable using the shortest code?
Can anybody give me a sample code?
|
|
|
|
|
See reply under QA - don't post to multiple forums, it just duplicates work and annoys people.
Did you know:
That by counting the rings on a tree trunk, you can tell how many other trees it has slept with.
|
|
|
|
|
By using the ~operator:
int var1 = 0;
int var2 = ~var1;
|
|
|
|
|
Hi!
When I build my project, I got the following linker error:
error LNK2019: unresolved external symbol _D3DXMatrixTransformation@28 referenced in function "protected: void __thiscall CEGUI::Direct3D9GeometryBuffer::updateMatrix(void)const " (?updateMatrix@Direct3D9GeometryBuffer@CEGUI@@IBEXXZ) CEGUIDirect3D9GeometryBuffer.obj
How do I resolve this error?
|
|
|
|
|
It looks like there is a library directive missing form your linker process. Add a reference to the library that contains the D3DXMatrixTransformation function.
It's time for a new signature.
|
|
|
|
|
It means that you haven't linked with anything that contains the implementation of D3DMatrixTransformation. This either means that:
- You're not linking with a dependent library
- You haven't implemented a function that you should
If you wrote the class CEGUI::Direct3D9GeometryBuffer then it's probably the second. If it's someone else's class have a gawp through their documentation and find out what the dependencies are for that library and link it.
Cheers,
Ash
|
|
|
|
|
Hi everyone,
I want to do integration in MFC coding.
Is there any formulas for doing this one.
Actually i want to do the Ramp,Sin waves of formulas
for simulation of signals
Ramp wave required integration.
how to do integration in programming.
Any library or header files which will do integration.
|
|
|
|
|
Do you want to do the integration in real-time ? Is an approximation ok for you ?
There's an easy and quick way to make an integration, but it is an approximation (and the error margin depends on your sample rate and signal variation). If you remember that an integration of a signal is the calculation of the area under the curve of the signal, you can reach a good approximation by using an "average" method.
When you have two consecutive points of your signal, you will approximate the surface under those points by taking the average Y value and calculate the surface of the rectangle made by this Y and the X difference between the two points.
This looks like:
double dSurface = (Y2 + Y1)/2 * (X2 - X1);
You then need to add all these surface together to get an approximation of the total surface under the curve.
|
|
|
|
|
|
It's discrete data. Calculating the integral is really simple. If you can write a loop and use addition you will be fine.
|
|
|
|
|
hi,
im doing conversion of cstrings to std string.
In cstring mid function is available.
But i cant find the equalent function in std string...
can any one help me?
Thanx.
|
|
|
|
|
You can simulate CString::Mid by using substr[^]. Also have a look at this[^] excellent class.
|
|
|
|
|
Hello all,
im using TeeChart Pro AX v6 of Steema Software SL.
i was wondering how, if at all, can i paint a strip line in a chart insted of a regular line.
thank's
code example for regular line that works in my project:
chart->Series(Series).GetAsLine().SetStairs(true);
chart->Series (Series).GetAsLine().SetInvertedStairs(true);
|
|
|
|
|
Hi All
I have problem to read file.I used CStdioFile.FIle like this
Abc
Xyz
Zsd
Code goes to infinite loop.
if(fileread.Open("C:\\Test.txt",CFile::modeRead | CFile::modeNoTruncate))
{
CString readstring="";
fileread.Seek(0,CFile::begin);
while(fileread.end)
{
fileread.ReadString(readstring.Trim());
}
fileread.Close();
}
Or this code only read first line.Rest line skip.
if(fileread.Open("C:\\Test.txt",CFile::modeRead | CFile::modeNoTruncate))
{
CString readstring="";
fileread.Seek(0,CFile::begin);
while(fileread.end)
{
fileread.ReadString(readstring.Trim());
if(readstring.IsEmpty())
{
break;
}
else
{
}
}
fileread.Close();
}
Can any one give me tips for solve the problem.
Thanks in advance
|
|
|
|
|
Try this -
while (fileread.ReadString(readstring))
|
|
|
|
|
|
You beat me to it.
I must refresh my browser more often.
|
|
|
|
|