nope, i disabled it, and i get the same thing, object dissappears if i move it more than 0.1f out.
ill post all the code im trying to use
//---------------------------------------------------------------------------
#ifndef OpenGLUnitH
#define OpenGLUnitH
//---------------------------------------------------------------------------
#include <vcl\Classes.hpp>
#include <vcl\Controls.hpp>
#include <vcl\StdCtrls.hpp>
#include <vcl\Forms.hpp>
#include <gl\gl.h>
#include <gl\glu.h>
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published: // IDE-managed Components
void __fastcall FormCreate(TObject *Sender);
void __fastcall FormDestroy(TObject *Sender);
void __fastcall FormResize(TObject *Sender);
private: // User declarations
HDC hdc;
HGLRC hrc;
int PixelFormat;
public: // User declarations
__fastcall TForm1(TComponent* Owner);
void __fastcall IdleLoop(TObject*, bool&);
void __fastcall RenderGLScene();
void __fastcall SetPixelFormatDescriptor();
void __fastcall SetupRC();
void __fastcall setPixelFormatDescriptor();
};
//---------------------------------------------------------------------------
extern TForm1 *Form1;
//---------------------------------------------------------------------------
#endif
//---------------------------------------------------------------------------
#include <vcl/vcl.h>
#pragma hdrstop
#include “OpenGLUnit.h”
#include “float.h”
#include <gl\gl.h>
#include <gl\glu.h>
//---------------------------------------------------------------------------
#pragma resource ".dfm"
TForm1 Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent Owner)
: TForm(Owner)
{
Application->OnIdle = IdleLoop;
_control87(MCW_EM, MCW_EM);
}
//---------------------------------------------------------------------------
float rquad;
//---------------------------------------------------------------------------
void __fastcall TForm1::IdleLoop(TObject, bool& done)
{
done = false;
TForm1::RenderGLScene();
SwapBuffers(hdc);
}
void __fastcall TForm1::RenderGLScene()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
glTranslatef(0.0f,0.0f,-1.0f);
glBegin(GL_QUADS);
glColor3f(0.0f,1.0f,0.0f);
glVertex3f(-1.0f,1.0f,0.0f);
glColor3f(1.0f,0.0f,0.0f);
glVertex3f(1.0f,1.0f,0.0f);
glColor3f(0.0f,0.0f,1.0f);
glVertex3f(1.0f,-1.0f,0.0f);
glColor3f(0.1f,0.3f,0.5f);
glVertex3f(-1.0f,-1.0f,0.0f);
glEnd();
}
void __fastcall TForm1::FormCreate(TObject *Sender)
{
hdc = GetDC(Handle);
SetPixelFormatDescriptor();
hrc = wglCreateContext(hdc);
wglMakeCurrent(hdc, hrc);
SetupRC();
}
void __fastcall TForm1::SetupRC()
{
glClearColor(0.0f, 0.0f, 0.0f, 0.5f); // Black Background
glClear(GL_COLOR_BUFFER_BIT);
glFlush();
}
void __fastcall TForm1::FormDestroy(TObject *Sender)
{
ReleaseDC(hdc, NULL);
wglMakeCurrent(hdc, NULL);
wglDeleteContext(hrc);
}
void __fastcall TForm1::SetPixelFormatDescriptor()
{
PIXELFORMATDESCRIPTOR pfd = {
sizeof(PIXELFORMATDESCRIPTOR),
1,
PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER,
PFD_TYPE_RGBA,
24,
0,0,0,0,0,0,
0,0,
0,0,0,0,0,
16,
0,
0,
PFD_MAIN_PLANE,
0,
0,0,0
};
PixelFormat = ChoosePixelFormat(hdc, &pfd);
SetPixelFormat(hdc, PixelFormat, &pfd);
}
void __fastcall TForm1::FormResize(TObject *Sender)
{
glViewport(0, 0, ClientWidth, ClientHeight);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(45.0f,ClientWidth/ClientHeight,0.1f,100.0f);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glShadeModel(GL_SMOOTH); // Enable Smooth Shading
glDepthMask(GL_TRUE);
glClearDepth(1.0f); // Depth Buffer Setup
glEnable(GL_DEPTH_TEST); // Enables Depth Testing
glDepthFunc(GL_LEQUAL); // The Type Of Depth Testing To Do
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); // Really Nice Perspective Calculations
}