[QUOTE=robmaister12;35947078]How do you define the origin of your models? IIRC Jitter adjusts the origin of rigid bodies to their center of mass.[/QUOTE]
Fixed it from help of noone (the guy who made the library), but yes, you're right.
[QUOTE=raccoon12;35955764]yes[/QUOTE]
wow you're a lot of help!!
Funley, I found this to at least copy files
[cpp]static void Main(string[] args)
{
DirectoryInfo sourceDir = new DirectoryInfo("c:\\a");
DirectoryInfo destinationDir = new DirectoryInfo("c:\\b");
CopyDirectory(sourceDir, destinationDir);
}
static void CopyDirectory(DirectoryInfo source, DirectoryInfo destination)
{
if (!destination.Exists)
{
destination.Create();
}
// Copy all files.
FileInfo[] files = source.GetFiles();
foreach (FileInfo file in files)
{
file.CopyTo(Path.Combine(destination.FullName,
file.Name));
}
// Process subdirectories.
DirectoryInfo[] dirs = source.GetDirectories();
foreach (DirectoryInfo dir in dirs)
{
// Get destination directory.
string destinationDir = Path.Combine(destination.FullName, dir.Name);
// Call CopyDirectory() recursively.
CopyDirectory(dir, new DirectoryInfo(destinationDir));
}
}[/cpp]
That at least copies the directory, should get you started
[QUOTE=Protocol7;35958074]wow you're a lot of help!!
Funley, I found this to at least copy files
[cpp]static void Main(string[] args)
{
DirectoryInfo sourceDir = new DirectoryInfo("c:\\a");
DirectoryInfo destinationDir = new DirectoryInfo("c:\\b");
CopyDirectory(sourceDir, destinationDir);
}
static void CopyDirectory(DirectoryInfo source, DirectoryInfo destination)
{
if (!destination.Exists)
{
destination.Create();
}
// Copy all files.
FileInfo[] files = source.GetFiles();
foreach (FileInfo file in files)
{
file.CopyTo(Path.Combine(destination.FullName,
file.Name));
}
// Process subdirectories.
DirectoryInfo[] dirs = source.GetDirectories();
foreach (DirectoryInfo dir in dirs)
{
// Get destination directory.
string destinationDir = Path.Combine(destination.FullName, dir.Name);
// Call CopyDirectory() recursively.
CopyDirectory(dir, new DirectoryInfo(destinationDir));
}
}[/cpp]
That at least copies the directory, should get you started[/QUOTE]
Honestly, I thought I was in a different thread
snip im stupid
I'm trying to go through a few sfml tutorials.
[b]Here are the errors I'm getting:[/b]
sfmlHello.cpp: In function ‘int main()’:
sfmlHello.cpp:7:16: error: ‘class sf::RenderWindow’ has no member named ‘isOpen’
sfmlHello.cpp:9:17: error: ‘class sf::RenderWindow’ has no member named ‘pollEvent’
[b]Here is the code:[/b]
[code]
#include <SFML/Graphics.hpp>
int main(){
sf::VideoMode VMode(800, 600, 32);
sf::RenderWindow Window(VMode, "SFMLCoder Tutorial - Empty Window");
while (Window.isOpen()){
sf::Event Event;
while (Window.pollEvent(Event)){
switch(Event.Type) {
case sf::Event::Closed:
Window.Close();
break;
default:
break;
}
}
Window.Clear(sf::Color(0, 255, 255));
Window.Display();
}
return 0;
}
[/code]
[QUOTE=Blackwheel;35974426]I'm trying to go through a few sfml tutorials.
[b]Here are the errors I'm getting:[/b]
sfmlHello.cpp: In function ‘int main()’:
sfmlHello.cpp:7:16: error: ‘class sf::RenderWindow’ has no member named ‘isOpen’
[/QUOTE]
Are you sure you're using the right version of SFML? SFML 2.0 has "isOpen" and "pollEvent", but SFML 1.6 has "isOpened" and no pollEvent.
EDIT: Also, you need to include <SFML/Window.hpp>
[QUOTE=ShaunOfTheLive;35974556]Are you sure you're using the right version of SFML? SFML 2.0 has "isOpen" and "pollEvent", but SFML 1.6 has "isOpened" and no pollEvent.
EDIT: Also, you need to include <SFML/Window.hpp>[/QUOTE]
Tried isOpened and it also didn't recognize that as a member.
I'm on Ubuntu, and I used the official repositories: sudo apt-get install libsfml-dev.
[QUOTE=Blackwheel;35974669]Tried isOpened and it also didn't recognize that as a member.
I'm on Ubuntu, and I used the official repositories: sudo apt-get install libsfml-dev.[/QUOTE]
Older SFML versions don't use camel-back notation. It should be IsOpened, not isOpened.
[QUOTE=Blackwheel;35974669]
I'm on Ubuntu, and I used the official repositories: sudo apt-get install libsfml-dev.[/QUOTE]
The ubuntu packages are the stable version (1.6). You need to compile the 2.0 version yourself. Not hard, the cmake-gui package can help you if you're unfamiliar with cmake
-Figure It out-
I'm trying to minimize the communication between my server and client for example having the server tell the client that a character shoots in one direction, and the client will know what weapon that character is using, what kind of projectile to spawn, and where other players are for the projectile to collide with. Is this is a bad way of doing it because it can potentially be unreliable, or is better because it will reduce lag?
[QUOTE=no-named;35978749]I'm trying to minimize the communication between my server and client for example having the server tell the client that a character shoots in one direction, and the client will know what weapon that character is using, what kind of projectile to spawn, and where other players are for the projectile to collide with. Is this is a bad way of doing it because it can potentially be unreliable, or is better because it will reduce lag?[/QUOTE]
As long as you verify everything on your server, it should be fine.
For example, for a multiplayer game I am (slowly) working on in my spare time, I intend to have the AI be predicted on the client. Whenever an AI updates his movements or behaviors, it will send an update to the relevant clients - in the case of movement, it will simply use vectors, or directions with speed.
So instead of constantly updating an AI's position while traveling in a straight line, I simply send to the client that an AI is going in a straight line with a certain speed, and let the client predict it.
Cuts down on networking, but minimalizes chances of cheating and such because things are still verified by the server. While this means there may be client issues (such as slightly teleporting AI), I personally think it's the best approach.
So you can do your idea there, but just be sure you keep track of everything so you can verify it on the server. While you should never trust your clients to make decisions, there's no reason to hold their hand through everything - just be sure you can verify any important decisions like shooting or movement.
[QUOTE=LuaChobo;35977014]I just remembered why i never learned unrealscript, because OO used to hurt my head.
I have decided to try and pick it up, Anyone got any tips?[/QUOTE]
Mess around with UTGame and see how it works before trying to inherit from the UDK or non-UDK bases. There's a few tutorials around (see [url=http://udn.epicgames.com/Three/DevelopmentKitGems.html]UDKGems[/url]) but you're best off learning from the documentation at UDN and code that ships with the UDK (UnCodeX is a brilliant program).
Don't edit anything in any of the Development/Src/ folders that already exist however, always derive.
thanks for the help guys
Anyon know the formula for accessing element in a 1D array that has been created for 3D?
Like with a 2d one its:
blah ar[X*Y];
ar[X + Y*Width];
[QUOTE=Richy19;35994644]Anyon know the formula for accessing element in a 1D array that has been created for 3D?
Like with a 2d one its:
blah ar[X*Y];
ar[X + Y*Width];[/QUOTE]
[url]http://www.facepunch.com/threads/1099026?p=31830255&viewfull=1#post31830255[/url]
[QUOTE=Richy19;35994644]Anyon know the formula for accessing element in a 1D array that has been created for 3D?
Like with a 2d one its:
blah ar[X*Y];
ar[X + Y*Width];[/QUOTE]
It's the x value...
plus the y value time the width of a row...
plus z value times the number of elements in an xy slice (width * height).
The width factors out, so you get this:
[code]array[x + (y + z * height) * width][/code]
You'll notice that this bit
[code]y + z * height[/code]
looks a lot like what you had for 2D:
[code]X + Y*Width[/code]
...which is because it [B]is[/B] a lot like that.
Try something like this
[editline]18th May 2012[/editline]
[cpp]std::stringstream ss(s);
std::string item;
while(std::getline(ss, item, ' ')) {
Positions[arrVal][posVal] = atoi(item);
}[/cpp]
string::getline has a very nice delimiter parameter that does what you want
[editline]18th May 2012[/editline]
Oh, I forgot, s in the stringstream would be your string
either that or you could just declare the stringstream and do stringstream.str
I got it working by changing the file format to:
[code]0000 0000 0000 0000
0010 0000 0010 0016
0020 0000 0010 0016
0030 0000 0010 0016
0040 0000 0010 0016
0050 0000 0010 0016
0060 0000 0010 0016
0070 0000 0010 0016
0080 0000 0010 0016
0090 0000 0000 0000
0100 0000 0000 0000
0110 0000 0010 0016
0120 0000 0010 0016
0130 0000 0000 0000
0140 0000 0010 0016
0150 0000 0010 0016
0000 0016 0010 0016
0010 0016 0010 0016
0020 0016 0010 0016
0030 0016 0010 0016
...[/code]
IE 4 digits per number
and the code I use now is:
[cpp]
bool result = bitmap.LoadFromFile(imageFile.c_str());
std::ifstream myfile;
try
{
myfile.open(fontFile.c_str());
if (myfile.is_open())
{
int arrVal = 0;
while ( myfile.good() )
{
std::string line;
std::getline (myfile,line);
int jump = 0;
for( int n = 0; n < 4; n++)
{
std::string str = "";
int numb = 0;
int pos = n*5;
str += line[pos];
str += line[pos+1];
str += line[pos+2];
str += line[pos+3];
std::istringstream ( str ) >> numb;
Positions[arrVal][0+n] = numb;
}
arrVal++;
}
myfile.close();
}
}
catch(int e)
{
myfile.close();
result = false;
}
for(int i = 0; i < 256; i++)
{
std::cout << Positions[i][0] << ":" << Positions[i][1] << ":" << Positions[i][2] << ":"<< Positions[i][3] << std::endl;
}
std::cout << "Blah" << std::endl;
[/cpp]
which outputs correctly but creates a segfault on returning, do i have to flush a buffer or something that I have missed out?
[editline]18th May 2012[/editline]
the call stack is:
#0 0x284c6c ??() (/usr/lib/i386-linux-gnu/libstdc++.so.6:??)
#1 0x284cfe std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string() () (/usr/lib/i386-linux-gnu/libstdc++.so.6:??)
#2 0x804fb1b Program::Initialize(this=0x808c7d8) (/home/richy/codeblocks/FPS/src/Program.cpp:33)
#3 0x8052b3a main() (/home/richy/codeblocks/FPS/src/Main.cpp:7)
segfaults with arrays is usually caused by trying to access an index that doesn't exist in the array
don't know your specific cause since your code looks good to me but it's worth looking into
Im putting up the class code incase anyone can see anything:
[cpp]#ifndef BITMAPTEXT_HPP_INCLUDED
#define BITMAPTEXT_HPP_INCLUDED
#include <GL/gl.h>
#include <vector>
#include "soglf/Texture.hpp"
namespace SOGLF
{
///
/// \brief Class for displaying text onscreen Not implemented yet
///
class BitmapText
{
protected:
GLuint vertexbuffer;
GLuint uvbuffer;
std::vector<GLuint> VertexList;
std::vector<GLuint> UVList;
SOGLF::Texture bitmap;
unsigned short Positions[256][4];
public:
///
/// \brief Empty constructor
///
BitmapText();
///
/// \brief Empty deconstructor
///
~BitmapText();
///
/// \brief Construct class from given arguments
/// \param Bitmap image
/// \param Bitmap position array
/// \param Character size used
/// \param Text to display
bool LoadFile(const std::string& imageFile, const std::string& fontFile , int heightSize, int widthSize);
///
/// \brief Set text
///
void SetText(const std::string& text);
};
}
#endif // BITMAPTEXT_HPP_INCLUDED
[/cpp]
[cpp]
#include <GL/glew.h>
#include "soglf/BitmapText.hpp"
#include <GL/glfw.h>
#include <iostream>
#include <fstream>
#include "soglf/Utilities.hpp"
SOGLF::BitmapText::BitmapText()
{
glGenBuffers(1, &vertexbuffer);
glGenBuffers(1, &uvbuffer);
}
SOGLF::BitmapText::~BitmapText()
{
glDeleteBuffers(1, &vertexbuffer);
glDeleteBuffers(1, &uvbuffer);
}
bool SOGLF::BitmapText::LoadFile(const std::string& imageFile, const std::string& fontFile, int heightSize, int widthSize )
{
bool result = bitmap.LoadFromFile(imageFile.c_str());
std::ifstream myfile;
try
{
myfile.open(fontFile.c_str());
if (myfile.is_open())
{
int arrVal = 0;
while ( myfile.good() )
{
std::string line;
std::getline (myfile,line);
for( int n = 0; n < 4; n++)
{
std::string str = "";
int numb = 0;
int pos = n*5;
str += line[pos];
str += line[pos+1];
str += line[pos+2];
str += line[pos+3];
std::istringstream ( str ) >> numb;
Positions[arrVal][0+n] = numb;
}
arrVal++;
}
myfile.close();
}
for(int i = 0; i < 256; i++)
{
std::cout << Positions[i][0] << ":" << Positions[i][1] << ":" << Positions[i][2] << ":" << Positions[i][3] << std::endl;
}
}
catch(int e)
{
std::cout << "Failed to load: " << fontFile << std::endl;
result = false;
}
std::cout << "Blah";
return result;
}
void SOGLF::BitmapText::SetText(const std::string& text)
{
}
[/cpp]
[editline]18th May 2012[/editline]
Changed it from an array of short to just a vector of vec4 and works as planned.
OK so I think I have everything setup so that it should draw... but it doesnt.
this is my Orthogonal:
[cpp]SOGLF::Matrices::Orthogonal =
glm::ortho(
0,
winW,
winH,
0,
1,
-1
);[/cpp]
these are the shaders:
[cpp]#version 120
uniform mat4 MVP;
attribute vec4 Position;
attribute vec2 UV;
varying vec2 uv;
void main(){
uv = UV;
gl_Position = MVP * Position;
}[/cpp]
[cpp]#version 120
varying vec2 uv;
uniform sampler2D Texture;
uniform vec4 Color;
void main(){
vec4 textur = texture2D( Texture, uv ).rgba;
if(textur.rgb == vec3(1.0f,1.0f,1.0f)) textur.a = Color.a;
textur.rgb = Color.rgb;
gl_FragColor = textur;
}[/cpp]
The header :
[cpp]
#ifndef BITMAPTEXT_HPP_INCLUDED
#define BITMAPTEXT_HPP_INCLUDED
#include <GL/gl.h>
#include <vector>
#include "soglf/Texture.hpp"
#include "soglf/Drawable.hpp"
#include "soglf/Shader.hpp"
namespace SOGLF
{
///
/// \brief Class for displaying text onscreen Not implemented yet
///
class BitmapText : public SOGLF::Drawable
{
protected:
GLuint vertexbuffer;
GLuint uvbuffer;
std::vector<GLfloat> VertexList;
std::vector<GLfloat> UVList;
SOGLF::Texture bitmap;
SOGLF::Shader shader;
std::vector<glm::vec4> Positions;
glm::vec2 Pos;
std::string text;
glm::vec4 Color;
glm::mat4 MVP;
GLuint TextureID;
GLuint ColorID;
GLuint MVPID;
GLuint PositionID;
GLuint UVID;
void Rebuild();
public:
///
/// \brief Empty constructor
///
BitmapText();
///
/// \brief Empty deconstructor
///
~BitmapText();
///
/// \brief Construct class from given arguments
/// \param Bitmap image
/// \param Bitmap position array
bool LoadFile(const std::string& imageFile, const std::string& fontFile );
///
/// \brief Set text
///
void SetText(const std::string& eText);
void SetPosition(const glm::vec2 &pos);
virtual void Update();
virtual void Draw();
};
}
#endif // BITMAPTEXT_HPP_INCLUDED[/cpp]
and the cpp
[cpp]
#include <GL/glew.h>
#include "soglf/BitmapText.hpp"
#include <GL/glfw.h>
#include <iostream>
#include <fstream>
#include "soglf/Utilities.hpp"
#include "soglf/Window.hpp"
SOGLF::BitmapText::BitmapText():
shader("./Resources/text.vert" , "./Resources/text.frag")
{
Pos = glm::vec2(0.0f);
Color = glm::vec4(1.0f);
text = "hi";
glGenBuffers(1, &vertexbuffer);
glGenBuffers(1, &uvbuffer);
MVPID = glGetUniformLocation(shader.GetShaderID(), "MVP");
TextureID = glGetUniformLocation(shader.GetShaderID(), "Texture");
PositionID = glGetAttribLocation(shader.GetShaderID(), "Position");
UVID = glGetAttribLocation(shader.GetShaderID(), "UV");
ColorID = glGetUniformLocation(shader.GetShaderID(), "Color");
}
SOGLF::BitmapText::~BitmapText()
{
glDeleteBuffers(1, &vertexbuffer);
glDeleteBuffers(1, &uvbuffer);
}
bool SOGLF::BitmapText::LoadFile(const std::string& imageFile, const std::string& fontFile )
{
bool result = bitmap.LoadFromFile(imageFile.c_str());
std::ifstream myfile;
try
{
myfile.open(fontFile.c_str());
if (myfile.is_open())
{
while ( myfile.good() )
{
std::string line;
std::getline (myfile,line);
float x,y,z,w;
std::stringstream strx, stry, strz, strw;
strx << line[0] << line[1] << line[2] << line[3];
stry << line[5] << line[6] << line[7] << line[8];
strz << line[10] << line[11] << line[12] << line[13];
strw << line[15] << line[16] << line[17] << line[18];
strx >> x; stry >> y; strz >> z; strw >> w;
Positions.push_back(glm::vec4(x, y, z, w));
}
myfile.close();
}
//for (unsigned int i = 0; i < Positions.size(); i++)
//{
//std::cout << Positions[i].x << ":" << Positions[i].y << ":" << Positions[i].z << ":" << Positions[i].w << std::endl;
//}
}
catch(int e)
{
std::cout << "Failed to load: " << fontFile << std::endl;
result = false;
}
return result;
}
void SOGLF::BitmapText::SetText(const std::string& eText)
{
text = eText;
Rebuild();
}
void SOGLF::BitmapText::SetPosition(const glm::vec2& pos)
{
Pos = pos;
Rebuild();
}
void SOGLF::BitmapText::Update()
{
}
void SOGLF::BitmapText::Draw()
{
shader.Bind();
glUniformMatrix4fv(MVPID, 1, GL_FALSE, &MVP[0][0]);
glActiveTexture(GL_TEXTURE0);
bitmap.Bind();
glUniform1i(TextureID, 0);
glUniform4fv(ColorID,1 , &Color[0]);
glEnableVertexAttribArray(PositionID);
glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer);
glVertexAttribPointer(
PositionID, // attribute 0. No particular reason for 0, but must match the layout in the shader.
3, // size
GL_FLOAT, // type
GL_FALSE, // normalized?
0, // stride
(void*)0 // array buffer offset
);
glEnableVertexAttribArray(UVID);
glBindBuffer(GL_ARRAY_BUFFER, uvbuffer);
glVertexAttribPointer(
UVID, // attribute 0. No particular reason for 0, but must match the layout in the shader.
2, // size
GL_FLOAT, // type
GL_FALSE, // normalized?
0, // stride
(void*)0 // array buffer offset
);
glDrawArrays(GL_TRIANGLES, 0, VertexList.size()/3);
glDisableVertexAttribArray(PositionID);
glDisableVertexAttribArray(UVID);
SOGLF::Texture::Unbind();
SOGLF::Shader::Unbind();
}
void SOGLF::BitmapText::Rebuild()
{
VertexList.clear();
UVList.clear();
glm::vec2 winS = SOGLF::WindowClass::Window.GetSize();
float disp = 0.0f;
for(int i = 0; i < text.size(); i++)
{
glm::vec4 charRect = Positions[text.c_str()[i]];
VertexList.push_back(0.0f + disp);
VertexList.push_back(charRect.w/winS.y);
VertexList.push_back(0.0f);
VertexList.push_back(0.0f + disp);
VertexList.push_back(0.0f);
VertexList.push_back(0.0f);
VertexList.push_back(charRect.z/winS.x + disp);
VertexList.push_back(charRect.w/winS.y);
VertexList.push_back(0.0f);
VertexList.push_back(charRect.z/winS.x + disp);
VertexList.push_back(charRect.w/winS.y);
VertexList.push_back(0.0f);
VertexList.push_back(0.0f + disp);
VertexList.push_back(0.0f);
VertexList.push_back(0.0f);
VertexList.push_back(charRect.z/winS.x + disp);
VertexList.push_back(0.0f);
VertexList.push_back(0.0f);
UVList.push_back(charRect.x / bitmap.GetSize().x);
UVList.push_back(charRect.y / bitmap.GetSize().y);
UVList.push_back(charRect.x / bitmap.GetSize().x);
UVList.push_back((charRect.y + charRect.w) / bitmap.GetSize().y);
UVList.push_back((charRect.x + charRect.z ) / bitmap.GetSize().x);
UVList.push_back(charRect.y / bitmap.GetSize().y);
UVList.push_back((charRect.x + charRect.z ) / bitmap.GetSize().x);
UVList.push_back(charRect.y / bitmap.GetSize().y);
UVList.push_back(charRect.x / bitmap.GetSize().x);
UVList.push_back((charRect.y + charRect.w) / bitmap.GetSize().y);
UVList.push_back((charRect.x + charRect.z ) / bitmap.GetSize().x);
UVList.push_back((charRect.y + charRect.w) / bitmap.GetSize().y);
disp += charRect.z;
}
glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer);
glBufferData(GL_ARRAY_BUFFER, VertexList.size() * sizeof(GLfloat), &VertexList[0], GL_STATIC_DRAW);
glBindBuffer(GL_ARRAY_BUFFER, uvbuffer);
glBufferData(GL_ARRAY_BUFFER, UVList.size() * sizeof(GLfloat), &UVList[0], GL_STATIC_DRAW);
Model = glm::translate(Pos.x/winS.x , Pos.y/winS.y, 0.0f);
MVP = SOGLF::Matrices::Matrix.GetOrthogonal() * Model;
}
[/cpp]
I dont get any errors, or anything. Simply nothing displays.
I tried changing the shader so that it would just dsplay a black vertex but nothing showed up either.
[QUOTE=Richy19;36008295]OK so I think I have everything setup so that it should draw... but it doesnt.[/QUOTE]
Talk to me on steam or gmail chat (naelstrof@gmail.com); I develop on Linux as well and can help you out.
I find forums an uncomfortable place to help you when you have so many questions and so much code.
[QUOTE=Naelstrom;36009579]Talk to me on steam or gmail chat (naelstrof@gmail.com); I develop on Linux as well and can help you out.
I find forums an uncomfortable place to help you when you have so many questions and so much code.[/QUOTE]
Y'know for someone posting in the programmers section, you should really realize how easy it is to write a web scraper for emails.
I want to chat with him; I do not want to use email or forums.
[QUOTE=Topgamer7;36009696]Y'know for someone posting in the programmers section, you should really realize how easy it is to write a web scraper for emails.[/QUOTE]
He uses gmail, though, which has some really good spam filters. He should be fine.
[QUOTE=Naelstrom;36009579]Talk to me on steam or gmail chat (naelstrof@gmail.com); I develop on Linux as well and can help you out.
I find forums an uncomfortable place to help you when you have so many questions and so much code.[/QUOTE]
I have actually managed to get it working :D
[IMG]http://i.imgur.com/t0QaN.png[/IMG] <- Not sure if imgur is working or not
One thing I do want to ask about, currently each time I change the text or position I basiccally recrete the vertex/uv data by clearing the vectors and pushing new values then calling
[cpp]
glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer);
glBufferData(GL_ARRAY_BUFFER, VertexList.size() * sizeof(GLfloat), &VertexList[0], GL_STATIC_DRAW);
glBindBuffer(GL_ARRAY_BUFFER, uvbuffer);
glBufferData(GL_ARRAY_BUFFER, UVList.size() * sizeof(GLfloat), &UVList[0], GL_STATIC_DRAW);
[/cpp]
Would there be any benefit in using [B]glbuffersubdata[/B] when im just going to completelly re-write the data?
[QUOTE=Richy19;36009853]I have actually managed to get it working :D
[IMG]http://i.imgur.com/t0QaN.png[/IMG] <- Not sure if imgur is working or not
One thing I do want to ask about, currently each time I change the text or position I basiccally recrete the vertex/uv data by clearing the vectors and pushing new values then calling
[cpp]
glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer);
glBufferData(GL_ARRAY_BUFFER, VertexList.size() * sizeof(GLfloat), &VertexList[0], GL_STATIC_DRAW);
glBindBuffer(GL_ARRAY_BUFFER, uvbuffer);
glBufferData(GL_ARRAY_BUFFER, UVList.size() * sizeof(GLfloat), &UVList[0], GL_STATIC_DRAW);
[/cpp]
Would there be any benefit in using [B]glbuffersubdata[/B] when im just going to completelly re-write the data?[/QUOTE]
I do it the same way just because if the number of characters change, the size of the buffer changes and glBufferSubData does nothing to reconcile that difference. I suppose you could check to see if the sizes are the same (by storing it locally, not by calling glBufferParameter) and call glBufferSubData if they are.
The performance difference would be minimal and the code would become less readable. Keep replacing the data until it becomes a performance issue.
Does anybody have links to good tutorials about how to set up Qt4 with Windows?
I tried following the official one on qt.nokia.com but I am really moronic about setting up compilers and libraries on Windows.
I really just want to get this set up with either Netbeans or just a simple text editor and it's frustrating the hell out of me.
Symptoms:
* Running [I]qmake [/I]on my projects produces a shit-ton of errors but works (something about the EPOC directory being undefined)
* Subsequently running [I]make [/I]on the project doesn't work at all
* Netbeans generally just being an asshole and not working with code highlighting, the Qt libraries or anything else remotely helpful even though I've defined the tool set properly
* All of the tutorials address the directory called C:\Qt... etc; my Qt4 installation is under C:\QtSDK\atonoffuckingsubdirectories and I'm concerned I didn't set it up right
At this point I'm totally fine with just using Notepad++ to edit the source files and designing the UI in QtCreator. That would be ideal, actually, seeing as how Netbeans refuses to work at all.
Any suggestions?
[editline]fuck[/editline]
Note: I really don't care if the tutorial wants me to use cygwin or minGW. Either is fine. Keeping an open mind here. I just want to be able to learn the code instead of fucking around with the libraries and intsallation.
Sorry, you need to Log In to post a reply to this thread.